diff mbox

[KVM-AUTOTEST] Iterate over reboot

Message ID 49ECC158.9070003@in.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

supriya kannery April 20, 2009, 6:39 p.m. UTC
A patch for iterating over VM reboot

- Supriya Kannery,
  LTC, IBM

Comments

Ryan Harper April 20, 2009, 7:38 p.m. UTC | #1
* supriya kannery <supriyak@in.ibm.com> [2009-04-20 13:49]:
> A patch for iterating over VM reboot
> 
> - Supriya Kannery,
>  LTC, IBM

Needs a Signed-off-by:


> diff -Naurp kvm-autotest/client/tests/kvm_runtest_2/kvm_tests.cfg.sample kvm-autotest.mod/client/tests/kvm_runtest_2/kvm_tests.cfg.sample
> --- kvm-autotest/client/tests/kvm_runtest_2/kvm_tests.cfg.sample	2009-04-13 17:20:56.000000000 +0530
> +++ kvm-autotest.mod/client/tests/kvm_runtest_2/kvm_tests.cfg.sample	2009-04-20 23:22:33.000000000 +0530
> @@ -50,6 +50,7 @@ variants:
>          reboot = yes
>          extra_params += " -snapshot"
>          kill_vm_on_error = yes
> +        reboot_iterations = 1
> 
>      - migrate:      install setup
>          type = migration
> diff -Naurp kvm-autotest/client/tests/kvm_runtest_2/kvm_tests.py kvm-autotest.mod/client/tests/kvm_runtest_2/kvm_tests.py
> --- kvm-autotest/client/tests/kvm_runtest_2/kvm_tests.py	2009-04-13 17:20:56.000000000 +0530
> +++ kvm-autotest.mod/client/tests/kvm_runtest_2/kvm_tests.py	2009-04-20 23:28:08.000000000 +0530
> @@ -31,25 +31,28 @@ def run_boot(test, params, env):
>      kvm_log.info("Logged in")
> 
>      if params.get("reboot") == "yes":
> -        session.sendline(params.get("cmd_reboot"))
> -        kvm_log.info("Reboot command sent; waiting for guest to go down...")
> +        iteration = int(params.get("reboot_iterations",1))
> +        while iteration:
> +            session.sendline(params.get("cmd_reboot"))
> +            kvm_log.info("Reboot command sent; waiting for guest to go down...")
> +
> +            if not kvm_utils.wait_for(lambda: not session.is_responsive(), 120, 0, 1):
> +                message = "Guest refuses to go down"
> +                kvm_log.error(message)
> +                raise error.TestFail, message
> +
> +            session.close()
> +
> +            kvm_log.info("Guest is down; waiting for it to go up again...")
> +
> +            session = kvm_utils.wait_for(vm.ssh_login, 120, 0, 2)
> +            if not session:
> +                message = "Could not log into guest after reboot"
> +                kvm_log.error(message)
> +                raise error.TestFail, message
> 
> -        if not kvm_utils.wait_for(lambda: not session.is_responsive(), 120, 0, 1):
> -            message = "Guest refuses to go down"
> -            kvm_log.error(message)
> -            raise error.TestFail, message
> -
> -        session.close()
> -
> -        kvm_log.info("Guest is down; waiting for it to go up again...")
> -
> -        session = kvm_utils.wait_for(vm.ssh_login, 120, 0, 2)
> -        if not session:
> -            message = "Could not log into guest after reboot"
> -            kvm_log.error(message)
> -            raise error.TestFail, message
> -
> -        kvm_log.info("Guest is up again")
> +            kvm_log.info("Guest is up again")
> +            iteration -= 1
> 
>      session.close()
>
Uri Lublin April 22, 2009, 2:47 p.m. UTC | #2
supriya kannery wrote:
> A patch for iterating over VM reboot
> 
> - Supriya Kannery,
>  LTC, IBM
> 

I think adding iterations capability belongs to the infrastructure, not the test 
itself. Implement it once in the infrastructure, instead of once per test.
Also I think autotest has such a capability (adding iteration=n to job.run_test 
parameters).

Thanks,
     Uri.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
supriya kannery May 1, 2009, 9:18 a.m. UTC | #3
Uri Lublin wrote:
> supriya kannery wrote:
>> A patch for iterating over VM reboot
>>
>
> I think adding iterations capability belongs to the infrastructure, 
> not the test itself. Implement it once in the infrastructure, instead 
> of once per test.
> Also I think autotest has such a capability (adding iteration=n to 
> job.run_test parameters).
>
In the older version of kvm_runtest (kvm_runtest_old), the iteration 
parameter can be added to the corresponding job.runtest() of each test 
type (boot, reboot, migration).Different Class and execute function are 
defined for each test type in old runtest infrastructure which gives the 
flexibility of providing independent iteration values. But in the 
current infrastructure, I am not sure how we can apply that way to 
iterate each test type. My guess is, defining an iteration parameter 
under corresponding test type variant in the  kvm_test.cfg file  is one 
of the ways.  Pls let me know if I overlooked anything here.  

Thanks, Supriya
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff -Naurp kvm-autotest/client/tests/kvm_runtest_2/kvm_tests.cfg.sample kvm-autotest.mod/client/tests/kvm_runtest_2/kvm_tests.cfg.sample
--- kvm-autotest/client/tests/kvm_runtest_2/kvm_tests.cfg.sample	2009-04-13 17:20:56.000000000 +0530
+++ kvm-autotest.mod/client/tests/kvm_runtest_2/kvm_tests.cfg.sample	2009-04-20 23:22:33.000000000 +0530
@@ -50,6 +50,7 @@  variants:
         reboot = yes
         extra_params += " -snapshot"
         kill_vm_on_error = yes
+        reboot_iterations = 1
 
     - migrate:      install setup
         type = migration
diff -Naurp kvm-autotest/client/tests/kvm_runtest_2/kvm_tests.py kvm-autotest.mod/client/tests/kvm_runtest_2/kvm_tests.py
--- kvm-autotest/client/tests/kvm_runtest_2/kvm_tests.py	2009-04-13 17:20:56.000000000 +0530
+++ kvm-autotest.mod/client/tests/kvm_runtest_2/kvm_tests.py	2009-04-20 23:28:08.000000000 +0530
@@ -31,25 +31,28 @@  def run_boot(test, params, env):
     kvm_log.info("Logged in")
 
     if params.get("reboot") == "yes":
-        session.sendline(params.get("cmd_reboot"))
-        kvm_log.info("Reboot command sent; waiting for guest to go down...")
+        iteration = int(params.get("reboot_iterations",1))
+        while iteration:
+            session.sendline(params.get("cmd_reboot"))
+            kvm_log.info("Reboot command sent; waiting for guest to go down...")
+
+            if not kvm_utils.wait_for(lambda: not session.is_responsive(), 120, 0, 1):
+                message = "Guest refuses to go down"
+                kvm_log.error(message)
+                raise error.TestFail, message
+
+            session.close()
+
+            kvm_log.info("Guest is down; waiting for it to go up again...")
+
+            session = kvm_utils.wait_for(vm.ssh_login, 120, 0, 2)
+            if not session:
+                message = "Could not log into guest after reboot"
+                kvm_log.error(message)
+                raise error.TestFail, message
 
-        if not kvm_utils.wait_for(lambda: not session.is_responsive(), 120, 0, 1):
-            message = "Guest refuses to go down"
-            kvm_log.error(message)
-            raise error.TestFail, message
-
-        session.close()
-
-        kvm_log.info("Guest is down; waiting for it to go up again...")
-
-        session = kvm_utils.wait_for(vm.ssh_login, 120, 0, 2)
-        if not session:
-            message = "Could not log into guest after reboot"
-            kvm_log.error(message)
-            raise error.TestFail, message
-
-        kvm_log.info("Guest is up again")
+            kvm_log.info("Guest is up again")
+            iteration -= 1
 
     session.close()