From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: Michael Goldish <mgoldish@redhat.com>
Cc: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: Re: [Autotest] [KVM-AUTOTEST PATCH 1/2] KVM test: add shutdown test
Date: Thu, 18 Jun 2009 12:06:55 -0300 [thread overview]
Message-ID: <1245337616.16589.13.camel@freedom> (raw)
In-Reply-To: <a295eb2502adecf55843f6142c4644d65f282d8b.1245137635.git.mgoldish@redhat.com>
On Tue, 2009-06-16 at 10:37 +0300, Michael Goldish wrote:
> The shutdown test logs into a VM and sends a shutdown command.
> It serves two purposes:
> - Test KVM's ability to shut down.
> - Clean up after the other tests:
> Currently VMs of the last test remain alive when Autotest finishes running.
> When one guest finishes testing and another begins, the VM is automatically
> shut down by the preprocessor because the QEMU command required for the next
> guest differs from that of the guest that just finished. In the case of the
> final guest this doesn't happen because no guest follows it, so the preprocessor
> must be explicitly instructed to kill the VM.
> However, we have no easy way of knowing which test runs last because the user
> usually selects a subset of the tests/guests.
> The addition of a shutdown test can be a decent solution to this small problem:
> by convention the shutdown test will always be the last to run, and if users
> wish to clean up after the tests, they must select the shutdown test.
>
> Note: it is beneficial to allow users to leave the VMs of the last test running
> because it saves time when developing and testing tests. A test writer can run
> the test once on a VM, and when the test exits, make some modifications to its
> code and re-run it on the same living VM, and repeat this procedure without
> having to shutdown/boot the VM every time.
Ok, patch set applied. Thank you!
> Signed-off-by: Michael Goldish <mgoldish@redhat.com>
> ---
> client/tests/kvm/kvm.py | 1 +
> client/tests/kvm/kvm_tests.py | 37 +++++++++++++++++++++++++++++++++++++
> 2 files changed, 38 insertions(+), 0 deletions(-)
>
> diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
> index 9428162..aa727da 100644
> --- a/client/tests/kvm/kvm.py
> +++ b/client/tests/kvm/kvm.py
> @@ -48,6 +48,7 @@ class kvm(test.test):
> "steps": test_routine("kvm_guest_wizard", "run_steps"),
> "stepmaker": test_routine("stepmaker", "run_stepmaker"),
> "boot": test_routine("kvm_tests", "run_boot"),
> + "shutdown": test_routine("kvm_tests", "run_shutdown"),
> "migration": test_routine("kvm_tests", "run_migration"),
> "yum_update": test_routine("kvm_tests", "run_yum_update"),
> "autotest": test_routine("kvm_tests", "run_autotest"),
> diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
> index ffe9116..4c9653f 100644
> --- a/client/tests/kvm/kvm_tests.py
> +++ b/client/tests/kvm/kvm_tests.py
> @@ -57,6 +57,43 @@ def run_boot(test, params, env):
> session.close()
>
>
> +def run_shutdown(test, params, env):
> + """
> + KVM shutdown test:
> + 1) Log into a guest
> + 2) Send a shutdown command to the guest
> + 3) Wait until it's down
> +
> + @param test: kvm test object
> + @param params: Dictionary with the test parameters
> + @param env: Dictionary with test environment
> + """
> + vm = kvm_utils.env_get_vm(env, params.get("main_vm"))
> + if not vm:
> + raise error.TestError("VM object not found in environment")
> + if not vm.is_alive():
> + raise error.TestError("VM seems to be dead; Test requires a living VM")
> +
> + logging.info("Waiting for guest to be up...")
> +
> + session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
> + if not session:
> + raise error.TestFail("Could not log into guest")
> +
> + logging.info("Logged in")
> +
> + # Send the VM's shutdown command
> + session.sendline(vm.get_params().get("cmd_shutdown"))
> + session.close()
> +
> + logging.info("Shutdown command sent; waiting for guest to go down...")
> +
> + if not kvm_utils.wait_for(vm.is_dead, 120, 0, 1):
> + raise error.TestFail("Guest refuses to go down")
> +
> + logging.info("Guest is down")
> +
> +
> def run_migration(test, params, env):
> """
> KVM migration test:
--
Lucas Meneghel Rodrigues
Software Engineer (QE)
Red Hat - Emerging Technologies
prev parent reply other threads:[~2009-06-18 15:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-16 7:37 [KVM-AUTOTEST PATCH 1/2] KVM test: add shutdown test Michael Goldish
2009-06-16 7:37 ` [KVM-AUTOTEST PATCH 2/2] KVM test: include shutdown test in kvm_tests.cfg.sample Michael Goldish
2009-06-16 10:42 ` [KVM-AUTOTEST PATCH 1/2] KVM test: add shutdown test Alexey Eromenko
2009-06-16 11:05 ` Michael Goldish
2009-06-18 14:46 ` [Autotest] " Lucas Meneghel Rodrigues
2009-06-17 3:10 ` jason wang
2009-06-18 15:06 ` Lucas Meneghel Rodrigues [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1245337616.16589.13.camel@freedom \
--to=lmr@redhat.com \
--cc=autotest@test.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mgoldish@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox