Index: client/tests/kvm/tests/timedrift_with_reboot.py |
diff --git a/client/tests/kvm/tests/timedrift_with_reboot.py b/client/tests/kvm/tests/timedrift_with_reboot.py |
index 22dfd452d4eb11e3f57c6621b0d18e03256591bd..05ef21f6b31ae33e8e0ac41829fe7ea59c806fb9 100644 |
--- a/client/tests/kvm/tests/timedrift_with_reboot.py |
+++ b/client/tests/kvm/tests/timedrift_with_reboot.py |
@@ -1,6 +1,6 @@ |
-import logging, time, commands, re |
+import logging |
from autotest_lib.client.common_lib import error |
-import kvm_subprocess, kvm_test_utils, kvm_utils |
+import kvm_test_utils |
def run_timedrift_with_reboot(test, params, env): |
@@ -17,9 +17,10 @@ def run_timedrift_with_reboot(test, params, env): |
@param params: Dictionary with test parameters. |
@param env: Dictionary with the test environment. |
""" |
- vm = kvm_test_utils.get_living_vm(env, params.get("main_vm")) |
+ vm = env.get_vm(params["main_vm"]) |
+ vm.verify_alive() |
timeout = int(params.get("login_timeout", 360)) |
- session = kvm_test_utils.wait_for_login(vm, timeout=timeout) |
+ session = vm.wait_for_login(timeout=timeout) |
# Collect test parameters: |
# Command to run to get the current time |
@@ -44,9 +45,9 @@ def run_timedrift_with_reboot(test, params, env): |
(ht0_, gt0_) = kvm_test_utils.get_time(session, time_command, |
time_filter_re, time_format) |
# Run current iteration |
- logging.info("Rebooting: iteration %d of %d..." % |
- (i + 1, reboot_iterations)) |
- session = kvm_test_utils.reboot(vm, session) |
+ logging.info("Rebooting: iteration %d of %d...", |
+ (i + 1), reboot_iterations) |
+ session = vm.reboot(session) |
# Get time after current iteration |
(ht1_, gt1_) = kvm_test_utils.get_time(session, time_command, |
time_filter_re, time_format) |
@@ -54,12 +55,12 @@ def run_timedrift_with_reboot(test, params, env): |
host_delta = ht1_ - ht0_ |
guest_delta = gt1_ - gt0_ |
drift = abs(host_delta - guest_delta) |
- logging.info("Host duration (iteration %d): %.2f" % |
- (i + 1, host_delta)) |
- logging.info("Guest duration (iteration %d): %.2f" % |
- (i + 1, guest_delta)) |
- logging.info("Drift at iteration %d: %.2f seconds" % |
- (i + 1, drift)) |
+ logging.info("Host duration (iteration %d): %.2f", |
+ (i + 1), host_delta) |
+ logging.info("Guest duration (iteration %d): %.2f", |
+ (i + 1), guest_delta) |
+ logging.info("Drift at iteration %d: %.2f seconds", |
+ (i + 1), drift) |
# Fail if necessary |
if drift > drift_threshold_single: |
raise error.TestFail("Time drift too large at iteration %d: " |
@@ -77,12 +78,12 @@ def run_timedrift_with_reboot(test, params, env): |
host_delta = ht1 - ht0 |
guest_delta = gt1 - gt0 |
drift = abs(host_delta - guest_delta) |
- logging.info("Host duration (%d reboots): %.2f" % |
- (reboot_iterations, host_delta)) |
- logging.info("Guest duration (%d reboots): %.2f" % |
- (reboot_iterations, guest_delta)) |
- logging.info("Drift after %d reboots: %.2f seconds" % |
- (reboot_iterations, drift)) |
+ logging.info("Host duration (%d reboots): %.2f", |
+ reboot_iterations, host_delta) |
+ logging.info("Guest duration (%d reboots): %.2f", |
+ reboot_iterations, guest_delta) |
+ logging.info("Drift after %d reboots: %.2f seconds", |
+ reboot_iterations, drift) |
# Fail if necessary |
if drift > drift_threshold: |