kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: autotest@test.kernel.org
Cc: lmr@redhat.com, kvm@vger.kernel.org
Subject: [PATCH 3/3] KVM-test: Check if guest bootable after reseting several times
Date: Fri, 06 May 2011 23:04:09 +0800	[thread overview]
Message-ID: <20110506150409.5847.72444.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <BANLkTi=H9zx7cBoNbcJ-e7dDYCZdBG9QOQ@mail.gmail.com>

This test comes from a regression bug:
Guest can not found bootable device after reseting several times by
monitor command.

https://bugzilla.redhat.com/show_bug.cgi?id=531026

Changes from v1:
- add bug id to commitlog
- remove unnecessary imports
- add some log message

Signed-off-by: Amos Kong <akong@redhat.com>
---
 client/tests/kvm/tests/system_reset_bootable.py |   31 +++++++++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample          |    7 +++++
 2 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100755 client/tests/kvm/tests/system_reset_bootable.py

diff --git a/client/tests/kvm/tests/system_reset_bootable.py b/client/tests/kvm/tests/system_reset_bootable.py
new file mode 100755
index 0000000..54536dc
--- /dev/null
+++ b/client/tests/kvm/tests/system_reset_bootable.py
@@ -0,0 +1,31 @@
+import logging, time
+from autotest_lib.client.common_lib import error
+
+def run_system_reset_bootable(test, params, env):
+    """
+    KVM reset test:
+    1) Boot guest.
+    2) Reset system by monitor command for several times.
+    3) Log into the guest to verify it could normally boot.
+
+    @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))
+    reset_times = int(params.get("reset_times",20))
+    interval = int(params.get("reset_interval",10))
+    wait_time = int(params.get("wait_time_for_reset",60))
+
+    logging.info("Wait for %d seconds before reset" % wait_time)
+    time.sleep(wait_time)
+
+    for i in range(reset_times):
+        logging.info("Reset the system by monitor cmd")
+        vm.monitor.cmd("system_reset")
+        time.sleep(interval)
+
+    logging.info("Try to login guest after reset")
+    session = vm.wait_for_login(timeout=timeout)
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 1e659bc..3b69b37 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -962,6 +962,13 @@ variants:
         sleep_before_reset = 20
         kill_vm_on_error = yes
 
+    - system_reset_bootable:
+        type = system_reset_bootable
+        interval = 1
+        reset_times = 20
+        wait_time_for_reset = 120
+        kill_vm_on_error = yes
+
     - shutdown:     install setup unattended_install.cdrom
         type = shutdown
         shutdown_method = shell


      parent reply	other threads:[~2011-05-06 15:04 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   ` [PATCH 2/3] KVM-test: Simple stop/continue test Amos Kong
2011-05-06 15:04   ` Amos Kong [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=20110506150409.5847.72444.stgit@localhost6.localdomain6 \
    --to=akong@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lmr@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;
as well as URLs for NNTP newsgroup(s).