From: Amos Kong <akong@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [PATCH 2/3] KVM-test: Simple stop/continue test
Date: Fri, 06 May 2011 23:03:47 +0800 [thread overview]
Message-ID: <20110506150347.5847.29528.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <BANLkTi=H9zx7cBoNbcJ-e7dDYCZdBG9QOQ@mail.gmail.com>
Change guest state by monitor cmd, verify guest status,
and try to login guest by network.
Changes from v1:
- use new method verify_status() to check vm status
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
---
client/tests/kvm/tests/stop_continue.py | 43 +++++++++++++++++++++++++++++++
client/tests/kvm/tests_base.cfg.sample | 4 +++
2 files changed, 47 insertions(+), 0 deletions(-)
create mode 100644 client/tests/kvm/tests/stop_continue.py
diff --git a/client/tests/kvm/tests/stop_continue.py b/client/tests/kvm/tests/stop_continue.py
new file mode 100644
index 0000000..62df48e
--- /dev/null
+++ b/client/tests/kvm/tests/stop_continue.py
@@ -0,0 +1,43 @@
+import logging
+from autotest_lib.client.common_lib import error
+
+
+def run_stop_continue(test, params, env):
+ """
+ Suspend a running Virtual Machine and verify its state.
+
+ 1) Boot the vm
+ 2) Suspend the vm through stop command
+ 3) Verify the state through info status command
+ 4) Check is the ssh session to guest is still responsive,
+ if succeed, fail the test.
+
+ @param test: Kvm test object
+ @param params: Dictionary with the test parameters
+ @param env: Dictionary with test environment.
+ """
+ vm = env.get_vm(params["main_vm"])
+ vm.verify_alive()
+ timeout = float(params.get("login_timeout", 240))
+ session = vm.wait_for_login(timeout=timeout)
+
+ try:
+ logging.info("Stop the VM")
+ vm.monitor.cmd("stop")
+ logging.info("Verifying the status of VM is 'paused'")
+ vm.verify_status("paused")
+
+ logging.info("Check the session is responsive")
+ if session.is_responsive():
+ raise error.TestFail("Session is still responsive after stop")
+
+ logging.info("Try to resume the guest")
+ vm.monitor.cmd("cont")
+ logging.info("Verifying the status of VM is 'running'")
+ vm.verify_status("running")
+
+ logging.info("Try to re-log into guest")
+ session = vm.wait_for_login(timeout=timeout)
+
+ finally:
+ session.close()
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 78c84c6..1e659bc 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -261,6 +261,10 @@ variants:
- systemtap:
test_control_file = systemtap.control
+ - stop_continue:
+ type = stop_continue
+ kill_vm_on_error = yes
+
- linux_s3: install setup unattended_install.cdrom
only Linux
type = linux_s3
next prev parent reply other threads:[~2011-05-06 15:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-21 6:21 [Autotest PATCH] KVM-test: Simple stop/continue test Amos Kong
2011-04-29 5:05 ` [Autotest] " Lucas Meneghel Rodrigues
2011-05-06 15:03 ` [PATCH 1/3] KVM-test: introduce a verify_status method Amos Kong
2011-05-06 15:03 ` Amos Kong [this message]
2011-05-06 15:04 ` [PATCH 3/3] KVM-test: Check if guest bootable after reseting several times Amos Kong
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=20110506150347.5847.29528.stgit@localhost6.localdomain6 \
--to=akong@redhat.com \
--cc=autotest@test.kernel.org \
--cc=kvm@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).