public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [KVM-AUTOTEST] [PATCH] Iterate over reboot
@ 2009-04-20 18:39 supriya kannery
  2009-04-20 19:38 ` Ryan Harper
  2009-04-22 14:47 ` Uri Lublin
  0 siblings, 2 replies; 8+ messages in thread
From: supriya kannery @ 2009-04-20 18:39 UTC (permalink / raw)
  To: Uri Lublin, kvm

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

A patch for iterating over VM reboot

- Supriya Kannery,
  LTC, IBM


[-- Attachment #2: reboot-iterate --]
[-- Type: text/plain, Size: 2636 bytes --]

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()
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [KVM-AUTOTEST] [PATCH] Iterate over reboot
  2009-04-20 18:39 supriya kannery
@ 2009-04-20 19:38 ` Ryan Harper
  2009-04-22  7:54   ` supriya kannery
  2009-04-22 14:47 ` Uri Lublin
  1 sibling, 1 reply; 8+ messages in thread
From: Ryan Harper @ 2009-04-20 19:38 UTC (permalink / raw)
  To: supriya kannery; +Cc: Uri Lublin, kvm

* 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()
> 


-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh@us.ibm.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [KVM-AUTOTEST] [PATCH] Iterate over reboot
  2009-04-20 19:38 ` Ryan Harper
@ 2009-04-22  7:54   ` supriya kannery
  0 siblings, 0 replies; 8+ messages in thread
From: supriya kannery @ 2009-04-22  7:54 UTC (permalink / raw)
  To: Ryan Harper; +Cc: Uri Lublin, kvm

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

Ryan Harper wrote:
> * 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:
>
>   
Pls find attached the patch including "Signed-off-by"

[-- Attachment #2: reboot-iterate --]
[-- Type: text/plain, Size: 2864 bytes --]

diffstat output:
 kvm_tests.cfg.sample |    1 +
 kvm_tests.py         |   39 +++++++++++++++++++++------------------
 2 files changed, 22 insertions(+), 18 deletions(-)

Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
---

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()
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [KVM-AUTOTEST] [PATCH] Iterate over reboot
  2009-04-20 18:39 supriya kannery
  2009-04-20 19:38 ` Ryan Harper
@ 2009-04-22 14:47 ` Uri Lublin
  2009-05-01  9:18   ` supriya kannery
  1 sibling, 1 reply; 8+ messages in thread
From: Uri Lublin @ 2009-04-22 14:47 UTC (permalink / raw)
  To: supriya kannery; +Cc: kvm

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [KVM-AUTOTEST] [PATCH] Iterate over reboot
  2009-04-22 14:47 ` Uri Lublin
@ 2009-05-01  9:18   ` supriya kannery
  0 siblings, 0 replies; 8+ messages in thread
From: supriya kannery @ 2009-05-01  9:18 UTC (permalink / raw)
  To: Uri Lublin; +Cc: kvm

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [KVM-AUTOTEST] [PATCH] Iterate over reboot
       [not found] <670003666.547921241172530227.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
@ 2009-05-01 10:13 ` Michael Goldish
  2009-05-04 12:08   ` supriya kannery
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Goldish @ 2009-05-01 10:13 UTC (permalink / raw)
  To: supriya kannery; +Cc: kvm, Uri Lublin


----- "supriya kannery" <supriyak@in.ibm.com> wrote:

> 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.  

There are two quick ways I can think of.
In both cases, the user needs to define something like "iterations = 4" in the config file, where desired.
Different tests can have different iteration values, depending on where the parameter is set.

1. Read the 'iterations' parameter in the control file, and pass its value as the 'iterations' parameter to job.run_test(), e.g.

iterations =  int(dict.get("iterations", "1"))
current_status = job.run_test("kvm_runtest_new", params=dict, tag=dict.get("shortname"), iterations=iterations)

Hopefully the iteration number will be appended to the test tag (e.g. Fedora.8.32.reboot.1, Fedora.8.32.reboot.2...).

- or -

2. Call job.run_test() as many times as desired (with a for loop), and append the iteration number to the test tag yourself, e.g.

iterations = int(dict.get("iterations", "1"))
for i in range(iterations):
    current_status = job.run_test("kvm_runtest_new", params=dict, tag=dict.get("shortname")+"."+str(i+1))
    if not current_status:
        break

While the first option is slightly shorter, I think the second one is safer (more predictable).

Migration is a special case because it currently comprises two tests (.1 and .2). Right now the only way to run multiple paired migrations is to add another 'variants' block inside the migration test block, e.g.

variants:
  - 1:
  - 2:
  - 3:

Michael

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [KVM-AUTOTEST] [PATCH] Iterate over reboot
  2009-05-01 10:13 ` [KVM-AUTOTEST] [PATCH] Iterate over reboot Michael Goldish
@ 2009-05-04 12:08   ` supriya kannery
  2009-05-25 11:21     ` Uri Lublin
  0 siblings, 1 reply; 8+ messages in thread
From: supriya kannery @ 2009-05-04 12:08 UTC (permalink / raw)
  To: Michael Goldish; +Cc: kvm, Uri Lublin

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

Michael Goldish wrote:
> ----- "supriya kannery" <supriyak@in.ibm.com> wrote:
>
>   
>> 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,
>>>       
> There are two quick ways I can think of.
> In both cases, the user needs to define something like "iterations = 4" in the config file, where desired.
> Different tests can have different iteration values, depending on where the parameter is set.
>
> 1. Read the 'iterations' parameter in the control file, and pass its value as the 'iterations' parameter to job.run_test(), e.g.
>
> iterations =  int(dict.get("iterations", "1"))
> current_status = job.run_test("kvm_runtest_new", params=dict, tag=dict.get("shortname"), iterations=iterations)
>
> Hopefully the iteration number will be appended to the test tag (e.g. Fedora.8.32.reboot.1, Fedora.8.32.reboot.2...).
>   
Michael,
   Thanks! for pointing out how to use job.runtest().

Attaching a patch that implements the test iterations through 
job.runtest(). Here, we are not appending shortname with iteration value 
because the iteration values corresponding to each dict which we pass 
through job.runtest() is received by tests.py and is being used to loop 
over kvm_runtest_2 . And kvm_runtest_2 in turn calls the corresponding 
test routine (boot, reboot, migration etc). That way the aim of looping 
over the respective test type is accomplished.

But still I need to confirm whether this does the actual iteration over 
rebooting of VM in a loop, because kvm_runtest  _2 calls the "boot" 
routine even for reboot test type. When iterating over reboot, my 
expectation is that, qemu window shouldn't get killed, while the VM 
should be rebooting multiple times.
>   


[-- Attachment #2: iterate-tests.patch --]
[-- Type: text/plain, Size: 793 bytes --]

Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
Cc : Michael Goldish <mgoldish@redhat.com>

--- kvm-autotest-tap/client/tests/kvm_runtest_2/control	2009-05-04 17:03:20.000000000 +0530
+++ kvm-autotest-tap/client/tests/kvm_runtest_2/control.mod	2009-05-04 17:02:52.000000000 +0530
@@ -99,7 +99,8 @@ for dict in list:
                 dependencies_satisfied = False
                 break
     if dependencies_satisfied:
-        current_status = job.run_test("kvm_runtest_2", params=dict, tag=dict.get("shortname"))
+        test_iterations=int(dict.get("iterations",1))
+        current_status = job.run_test("kvm_runtest_2", params=dict, tag=dict.get("shortname"),iterations=test_iterations)
     else:
         current_status = False
     status_dict[dict.get("name")] = current_status

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [KVM-AUTOTEST] [PATCH] Iterate over reboot
  2009-05-04 12:08   ` supriya kannery
@ 2009-05-25 11:21     ` Uri Lublin
  0 siblings, 0 replies; 8+ messages in thread
From: Uri Lublin @ 2009-05-25 11:21 UTC (permalink / raw)
  To: supriya kannery; +Cc: Michael Goldish, kvm

On 05/04/2009 03:08 PM, supriya kannery wrote:

A commit-message is useful here.

> Signed-off-by: Supriya Kannery<supriyak@in.ibm.com>
> Cc : Michael Goldish<mgoldish@redhat.com>
>
 > --- kvm-autotest-tap/client/tests/kvm_runtest_2/control	2009-05-04 
17:03:20.000000000 +0530
 > +++ kvm-autotest-tap/client/tests/kvm_runtest_2/control.mod	2009-05-04 
17:02:52.000000000 +0530
 > @@ -99,7 +99,8 @@ for dict in list:
 >                  dependencies_satisfied = False
 >                  break
 >      if dependencies_satisfied:
 > -        current_status = job.run_test("kvm_runtest_2", params=dict, 
tag=dict.get("shortname"))
 >+        test_iterations=int(dict.get("iterations",1))

Please leave a space following a comma, here       ^

 >+        current_status = job.run_test("kvm_runtest_2", params=dict, 
tag=dict.get("shortname"),iterations=test_iterations)

Please use shorter lines.

 >     else:
 >         current_status = False
 >     status_dict[dict.get("name")] = current_status


Applied, with above mentioned changes.

Thanks,
     Uri.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-05-25 11:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <670003666.547921241172530227.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-05-01 10:13 ` [KVM-AUTOTEST] [PATCH] Iterate over reboot Michael Goldish
2009-05-04 12:08   ` supriya kannery
2009-05-25 11:21     ` Uri Lublin
2009-04-20 18:39 supriya kannery
2009-04-20 19:38 ` Ryan Harper
2009-04-22  7:54   ` supriya kannery
2009-04-22 14:47 ` Uri Lublin
2009-05-01  9:18   ` supriya kannery

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox