All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yolkfull Chow <yzhou@redhat.com>
To: kvm@vger.kernel.org
Cc: Uri Lublin <uril@redhat.com>
Subject: [KVM-AUTOTEST PATCH] A test patch - Boot VMs until one of them becomes unresponsive
Date: Tue, 09 Jun 2009 16:41:54 +0800	[thread overview]
Message-ID: <4A2E2052.7050304@redhat.com> (raw)
In-Reply-To: <1244433717-3391-1-git-send-email-lmr@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 156 bytes --]


Hi,

This test will boot VMs until one of them becomes unresponsive, and 
records the maximum number of VMs successfully started.


-- 
Yolkfull
Regards,


[-- Attachment #2: kvm_tests.py.patch --]
[-- Type: text/plain, Size: 2892 bytes --]

diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index cccc48e..7d00277 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -466,3 +466,70 @@ def run_linux_s3(test, params, env):
     logging.info("VM resumed after S3")
 
     session.close()
+
+def run_boot_vms(tests, params, env):
+    """
+    Boots VMs until one of them becomes unresponsive, and records the maximum
+    number of VMs successfully started:
+    1) boot the first vm
+    2) boot the second vm cloned from the first vm, check whether it boots up
+       and all booted vms can ssh-login
+    3) go on until cannot create VM anymore or cannot allocate memory for VM
+
+    @param test: kvm test object
+    @param params: Dictionary with the test parameters
+    @param env: Dictionary with test environment.
+    """
+    # boot the first vm
+    vm1 = kvm_utils.env_get_vm(env, params.get("main_vm"))
+
+    if not vm1:
+        raise error.TestError("VM object not found in environment")
+    if not vm1.is_alive():
+        raise error.TestError("VM seems to be dead; Test requires a living VM")
+
+    logging.info("Waiting for first guest to be up...")
+
+    vm1_session = kvm_utils.wait_for(vm1.ssh_login, 240, 0, 2)
+    if not vm1_session:
+        raise error.TestFail("Could not log into first guest")
+
+    num = 1
+    vms = [vm1]
+    sessions = [vm1_session]
+
+    # boot the VMs
+    while True:
+        try:
+            num += 1
+            vm_name = "vm" + str(num)
+
+            # clone vm according to the first one
+            curr_vm = vm1.clone(vm_name)
+            logging.info(" Booting the %dth guest" % num)
+            if not curr_vm.create():
+                raise error.TestFail("Cannot boot vm anylonger")
+
+            curr_vm_session = kvm_utils.wait_for(curr_vm.ssh_login, 240, 0, 2)
+
+            if not curr_vm_session:
+                curr_vm.send_monitor_cmd("quit")
+                raise error.TestFail("Could not log into %dth guest" % num)
+
+            logging.info(" %dth guest boots up successfully" % num)
+            sessions.append(curr_vm_session)
+            vms.append(curr_vm)
+
+            # check whether all previous ssh sessions are responsive
+            for vm_session in sessions:
+                if not vm_session.is_responsive():
+                    logging.error("%dth guest's session is not responsive" \
+                                       % (sessions.index(vm_session) + 1))
+
+        except (error.TestFail, OSError):
+            for vm in vms:
+                logging.info("Shut down the %dth guest" % (vms.index(vm) + 1))
+                vm.destroy(gracefully = params.get("kill_vm_gracefully") \
+                                                               == "yes")
+            logging.info("Total number booted successfully: %d" % (num - 1))
+            break

  parent reply	other threads:[~2009-06-09  8:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08  4:01 [KVM-AUTOTEST PATCH 0/8] Re-submitting some of the patches on the patch queue Lucas Meneghel Rodrigues
2009-06-08  4:01 ` [KVM-AUTOTEST PATCH 1/8] kvm_config: Allow for "=" in the value of a config parameter Lucas Meneghel Rodrigues
2009-06-08  4:01   ` [PATCH 1/3] Make possible to use kvm_config as a standalone program Lucas Meneghel Rodrigues
2009-06-08  4:01     ` [PATCH 2/3] Fixing bad line breaks Lucas Meneghel Rodrigues
2009-06-08  4:01       ` [KVM-AUTOTEST PATCH 2/8] RHEL-4.7 step files: fix the initial boot barriers Lucas Meneghel Rodrigues
2009-06-08  4:01         ` [PATCH 3/3] Fix bad logging calls Lucas Meneghel Rodrigues
2009-06-08  4:01           ` [KVM-AUTOTEST PATCH 3/8] WinXP step file fixes Lucas Meneghel Rodrigues
2009-06-08  4:01             ` [KVM-AUTOTEST PATCH 4/8] RHEL 5.3 " Lucas Meneghel Rodrigues
2009-06-08  4:01               ` [KVM-AUTOTEST PATCH 5/8] stepeditor.py: get rid of some shortcuts Lucas Meneghel Rodrigues
2009-06-08  4:01                 ` [KVM-AUTOTEST PATCH 6/8] Choose a monitor filename in the constructor of VM class Lucas Meneghel Rodrigues
2009-06-08 15:19                   ` Lucas Meneghel Rodrigues
2009-06-08 15:19                 ` [KVM-AUTOTEST PATCH 5/8] stepeditor.py: get rid of some shortcuts Lucas Meneghel Rodrigues
2009-06-08 15:18               ` [KVM-AUTOTEST PATCH 4/8] RHEL 5.3 step file fixes Lucas Meneghel Rodrigues
2009-06-08 15:18             ` [KVM-AUTOTEST PATCH 3/8] WinXP " Lucas Meneghel Rodrigues
2009-06-08 15:17         ` [KVM-AUTOTEST PATCH 2/8] RHEL-4.7 step files: fix the initial boot barriers Lucas Meneghel Rodrigues
2009-06-08 15:16   ` [KVM-AUTOTEST PATCH 1/8] kvm_config: Allow for "=" in the value of a config parameter Lucas Meneghel Rodrigues
2009-06-09  8:41 ` Yolkfull Chow [this message]
2009-06-09  9:37   ` [KVM-AUTOTEST PATCH] A test patch - Boot VMs until one of them becomes unresponsive Yaniv Kaul
2009-06-09  9:57     ` Michael Goldish
2009-06-09 12:45   ` Uri Lublin
2009-06-10  8:12     ` Yolkfull Chow
     [not found] <2021156332.1536421244540393444.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-09  9:44 ` Michael Goldish
2009-06-10  8:10   ` Yolkfull Chow
     [not found] <219655199.1650051244627445364.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-10 10:03 ` Michael Goldish
2009-06-10 10:31   ` Yolkfull Chow
     [not found] <443392010.1660281244634434026.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-10 11:52 ` Michael Goldish
2009-06-11  3:37   ` Yolkfull Chow
     [not found] <120253480.1747631244710010660.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-11  8:53 ` Michael Goldish
2009-06-11  9:46   ` Yolkfull Chow

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=4A2E2052.7050304@redhat.com \
    --to=yzhou@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=uril@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.