| Index: client/tests/kvm/tests/timedrift.py
|
| diff --git a/client/tests/kvm/tests/timedrift.py b/client/tests/kvm/tests/timedrift.py
|
| index a6d307686aaff3a252d368f5026e5ceaca15d372..9f62b4ac872790b8735f69d367cf8e933ed25939 100644
|
| --- a/client/tests/kvm/tests/timedrift.py
|
| +++ b/client/tests/kvm/tests/timedrift.py
|
| @@ -1,6 +1,6 @@
|
| -import logging, time, commands, re
|
| +import logging, time, commands
|
| from autotest_lib.client.common_lib import error
|
| -import kvm_subprocess, kvm_test_utils, kvm_utils
|
| +import kvm_subprocess, kvm_test_utils
|
|
|
|
|
| def run_timedrift(test, params, env):
|
| @@ -52,9 +52,10 @@ def run_timedrift(test, params, env):
|
| for tid, mask in prev_masks.items():
|
| commands.getoutput("taskset -p %s %s" % (mask, tid))
|
|
|
| - 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
|
| @@ -87,9 +88,7 @@ def run_timedrift(test, params, env):
|
| # Open shell sessions with the guest
|
| logging.info("Starting load on guest...")
|
| for i in range(guest_load_instances):
|
| - load_session = vm.remote_login()
|
| - if not load_session:
|
| - raise error.TestFail("Could not log into guest")
|
| + load_session = vm.login()
|
| # Set output func to None to stop it from being called so we
|
| # can change the callback function and the parameters it takes
|
| # with no problems
|
| @@ -123,7 +122,7 @@ def run_timedrift(test, params, env):
|
| set_cpu_affinity(pid, cpu_mask)
|
|
|
| # Sleep for a while (during load)
|
| - logging.info("Sleeping for %s seconds..." % load_duration)
|
| + logging.info("Sleeping for %s seconds...", load_duration)
|
| time.sleep(load_duration)
|
|
|
| # Get time delta after load
|
| @@ -136,9 +135,9 @@ def run_timedrift(test, params, env):
|
| host_delta = ht1 - ht0
|
| guest_delta = gt1 - gt0
|
| drift = 100.0 * (host_delta - guest_delta) / host_delta
|
| - logging.info("Host duration: %.2f" % host_delta)
|
| - logging.info("Guest duration: %.2f" % guest_delta)
|
| - logging.info("Drift: %.2f%%" % drift)
|
| + logging.info("Host duration: %.2f", host_delta)
|
| + logging.info("Guest duration: %.2f", guest_delta)
|
| + logging.info("Drift: %.2f%%", drift)
|
|
|
| finally:
|
| logging.info("Cleaning up...")
|
| @@ -146,7 +145,7 @@ def run_timedrift(test, params, env):
|
| restore_cpu_affinity(prev_affinity)
|
| # Stop the guest load
|
| if guest_load_stop_command:
|
| - session.get_command_output(guest_load_stop_command)
|
| + session.cmd_output(guest_load_stop_command)
|
| # Close all load shell sessions
|
| for load_session in guest_load_sessions:
|
| load_session.close()
|
| @@ -154,7 +153,7 @@ def run_timedrift(test, params, env):
|
| load_session.close()
|
|
|
| # Sleep again (rest)
|
| - logging.info("Sleeping for %s seconds..." % rest_duration)
|
| + logging.info("Sleeping for %s seconds...", rest_duration)
|
| time.sleep(rest_duration)
|
|
|
| # Get time after rest
|
| @@ -170,9 +169,9 @@ def run_timedrift(test, params, env):
|
| host_delta_total = ht2 - ht0
|
| guest_delta_total = gt2 - gt0
|
| drift_total = 100.0 * (host_delta_total - guest_delta_total) / host_delta
|
| - logging.info("Total host duration including rest: %.2f" % host_delta_total)
|
| - logging.info("Total guest duration including rest: %.2f" % guest_delta_total)
|
| - logging.info("Total drift after rest: %.2f%%" % drift_total)
|
| + logging.info("Total host duration including rest: %.2f", host_delta_total)
|
| + logging.info("Total guest duration including rest: %.2f", guest_delta_total)
|
| + logging.info("Total drift after rest: %.2f%%", drift_total)
|
|
|
| # Fail the test if necessary
|
| if abs(drift) > drift_threshold:
|
|
|