All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yolkfull Chow <yzhou@redhat.com>
To: kvm@vger.kernel.org
Cc: Michael Goldish <mgoldish@redhat.com>, Uri Lublin <uril@redhat.com>
Subject: [KVM-AUTOTEST PATCH] stress_boot - Boot VMs until one of them becomes unresponsive - Version2
Date: Fri, 12 Jun 2009 21:27:24 +0800	[thread overview]
Message-ID: <4A3257BC.2080207@redhat.com> (raw)
In-Reply-To: <805753750.1747761244710384743.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>

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

Following are the differences between version 1:

1) use framework to destroy VMs except the main_vm
2) use snapshot to boot other VMs except the first one


Regards,
Yolkfull

[-- Attachment #2: stress_boot_v2.patch --]
[-- Type: text/plain, Size: 4431 bytes --]

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index 9428162..1f553b4 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -53,6 +53,7 @@ class kvm(test.test):
                 "autotest":     test_routine("kvm_tests", "run_autotest"),
                 "kvm_install":  test_routine("kvm_install", "run_kvm_install"),
                 "linux_s3":     test_routine("kvm_tests", "run_linux_s3"),
+		"stress_boot":	test_routine("kvm_tests", "run_stress_boot"),
                 }
 
         # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample b/client/tests/kvm/kvm_tests.cfg.sample
index c73da7c..ff7abea 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -81,6 +81,10 @@ variants:
     - linux_s3:      install setup
         type = linux_s3
 
+    - stress_boot:
+	type = stress_boot
+	max_vms = 5
+
 # NICs
 variants:
     - @rtl8139:
@@ -101,6 +105,8 @@ variants:
         ssh_status_test_command = echo $?
         username = root
         password = 123456
+	stress_boot:
+	    alive_test_cmd = ps aux
 
         variants:
             - Fedora:
@@ -291,6 +297,8 @@ variants:
         password = 123456
         migrate:
             migration_test_command = ver && vol
+	stress_boot:
+	    alive_test_cmd = systeminfo
 
         variants:
             - Win2000:
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 54d2a7a..fde33bb 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -466,3 +466,77 @@ def run_linux_s3(test, params, env):
     logging.info("VM resumed after S3")
 
     session.close()
+
+
+def run_stress_boot(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
+    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 first 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 first guest")
+
+    num = 1
+    vms = []
+    sessions = [session]
+
+    # boot the VMs
+    while num <= int(params.get("max_vms")):
+        try:
+            vm_name = "vm" + str(num)
+
+            # clone vm according to the first one
+            vm_params = params.copy()
+            vm_params['image_snapshot'] = "yes"
+            vm_params['kill_vm'] = "yes"
+            vm_params['kill_vm_gracefully'] = "no"
+            curr_vm = vm.clone(vm_name, vm_params)
+            kvm_utils.env_register_vm(env, vm_name, curr_vm)
+            params['vms'] += " " + vm_name
+
+            #vms.append(curr_vm)
+            logging.info("Booting guest #%d" % num)
+            if not curr_vm.create():
+                raise error.TestFail("Cannot create VM #%d" % num)
+
+            curr_vm_session = kvm_utils.wait_for(curr_vm.ssh_login, 240, 0, 2)
+            if not curr_vm_session:
+                raise error.TestFail("Could not log into guest #%d" % num)
+
+            logging.info("Guest #%d boots up successfully" % num)
+            sessions.append(curr_vm_session)
+
+            # check whether all previous ssh sessions are responsive
+            for i, vm_session in enumerate(sessions):
+                if vm_session.get_command_status(params.get("alive_test_cmd")):
+                    raise error.TestFail("Session #%d is not responsive" % i)
+            num += 1
+
+        except (error.TestFail, OSError):
+            for se in sessions:
+                se.close()
+            logging.info("Total number booted: %d" % num)
+            raise
+    else:
+        for se in sessions:
+            se.close()
+        logging.info("Total number booted: %d" % num)

  parent reply	other threads:[~2009-06-12 13:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <120253480.1747631244710010660.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-11  8:53 ` [KVM-AUTOTEST PATCH] A test patch - Boot VMs until one of them becomes unresponsive Michael Goldish
2009-06-11  9:46   ` Yolkfull Chow
2009-06-12 13:27   ` Yolkfull Chow [this message]
2009-06-18  8:17     ` [KVM-AUTOTEST PATCH] stress_boot - Boot VMs until one of them becomes unresponsive - Version2 Lucas Meneghel Rodrigues
2009-06-18  9:16       ` Yolkfull Chow
2009-06-19 13:06         ` Lucas Meneghel Rodrigues

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=4A3257BC.2080207@redhat.com \
    --to=yzhou@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mgoldish@redhat.com \
    --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.