On Thu, 2010-04-15 at 16:09 -0300, Marcelo Tosatti wrote: > This test boots a guest while periodically running savevm/loadvm. Ok Marcelo, test looks good, applied. Thanks! > Adjust savevm_delay/guest memory size to reduce run time, if > excessive. > > Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx> > > Index: autotest/client/tests/kvm/tests/boot_savevm.py > =================================================================== > --- /dev/null > +++ autotest/client/tests/kvm/tests/boot_savevm.py > @@ -0,0 +1,54 @@ > +import logging, time > +from autotest_lib.client.common_lib import error > +import kvm_subprocess, kvm_test_utils, kvm_utils > + > +def run_boot_savevm(test, params, env): > + """ > + KVM boot savevm test: > + 1) Start guest > + 2) Periodically savevm/loadvm > + 4) Log into the guest to verify it's up, fail after timeout seconds > + > + @param test: kvm test object > + @param params: Dictionary with the test parameters > + @param env: Dictionary with test environment. > + """ > + vm = kvm_test_utils.get_living_vm(env, params.get("main_vm")) > + savevm_delay = float(params.get("savevm_delay")) > + savevm_login_delay = float(params.get("savevm_login_delay")) > + logging.info("savevm_delay = %f" % savevm_delay) > + login_expire = time.time() + savevm_login_delay > + end_time = time.time() + float(params.get("savevm_timeout")) > + > + while time.time() < end_time: > + time.sleep(savevm_delay) > + > + s, o = vm.send_monitor_cmd("stop") > + if s: > + logging.error("stop failed: %r" % o) > + s, o = vm.send_monitor_cmd("savevm 1") > + if s: > + logging.error("savevm failed: %r" % o) > + s, o = vm.send_monitor_cmd("system_reset") > + if s: > + logging.error("system_reset: %r" % o) > + s, o = vm.send_monitor_cmd("loadvm 1") > + if s: > + logging.error("loadvm failed: %r" % o) > + s, o = vm.send_monitor_cmd("cont") > + if s: > + logging.error("cont failed: %r" % o) > + > + # Log in > + if (time.time() > login_expire): > + login_expire = time.time() + savevm_login_delay > + logging.info("Logging in after loadvm...") > + session = kvm_utils.wait_for(vm.remote_login, 1, 0, 1) > + if not session: > + logging.info("Failed to login") > + else: > + logging.info("Logged in to guest!") > + break > + > + if (time.time() > end_time): > + raise error.TestFail("fail: timeout") > Index: autotest/client/tests/kvm/tests_base.cfg.sample > =================================================================== > --- autotest.orig/client/tests/kvm/tests_base.cfg.sample > +++ autotest/client/tests/kvm/tests_base.cfg.sample > @@ -105,6 +105,15 @@ variants: > iterations = 2 > used_mem = 1024 > > + - boot_savevm: install setup unattended_install > + type = boot_savevm > + savevm_delay = 0.3 > + savevm_login_delay = 120 > + savevm_timeout = 2000 > + kill_vm_on_error = yes > + kill_vm_gracefully = yes > + kill_vm = yes > + > - autotest: install setup unattended_install > type = autotest > test_timeout = 1800 > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html