Skip to contentSkip to conversation

Iterate over reboot

PATCH Applied Michael Goldish 3 participants 3 messages May 1, 2009 – May 25, 2009 1 message not in the archive KVM

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 16 lines · ----- "supriya kannery
Quoted 7 lines · Uri Lublin
Quoted 2 lines · supriya kannery

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

Quoted 4 lines

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

Quoted 10 lines

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

#2 lore raw
Quoted 18 lines · Michael Goldish
Quoted 11 lines · ----- "supriya kannery
Quoted 9 lines · Uri Lublin
Quoted 3 lines · supriya kannery

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.

Quoted 7 lines

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.

Quoted 1 line
client/tests/kvm_runtest_2/control.mod renamed from client/tests/kvm_runtest_2/control +2 -1
@@ -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
Applied
#3 lore raw

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

A commit-message is useful here.

client/tests/kvm_runtest_2/control.mod for dict in list: · line 102

Quoted 11 lines
client/tests/kvm_runtest_2/control.mod renamed from client/tests/kvm_runtest_2/control +1 -1
@@ -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 ^

client/tests/kvm_runtest_2/control.mod for dict in list: · line 103

Quoted 1 line
client/tests/kvm_runtest_2/control.mod renamed from client/tests/kvm_runtest_2/control +1 -0
+        current_status = job.run_test("kvm_runtest_2", params=dict, tag=dict.get("shortname"),iterations=test_iterations)

Please use shorter lines.

client/tests/kvm_runtest_2/control.mod for dict in list: · line 106

Quoted 3 lines
client/tests/kvm_runtest_2/control.mod renamed from client/tests/kvm_runtest_2/control +0 -0
    else:
        current_status = False
    status_dict[dict.get("name")] = current_status

Applied, with above mentioned changes.

Thanks,
Uri.