Skip to contentSkip to conversation

A test patch - Boot VMs until one of them becomes unresponsive

PATCH Michael Goldish 2 participants 2 messages Jun 10, 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 63 lines · ----- "Yolkfull Chow
Quoted 8 lines · Michael Goldish

The test looks pretty nicely written. Comments:

1. Consider making all the cloned VMs use image snapshots:

curr_vm = vm1.clone() curr_vm.get_params()["extra_params"] += " -snapshot"

I'm not sure it's a good idea to let all VMs use the same disk

image.

Quoted 1 line

Or maybe you shouldn't add -snapshot yourself, but rather do it in

the config

Quoted 1 line

file for the first VM, and then all cloned VMs will have -snapshot

as well.

Quoted 1 line

Yes I use 'image_snapshot = yes' in config file.

Quoted 6 lines

2. Consider changing the message
" Booting the %dth guest" % num
to
"Booting guest #%d" % num
(because there's no such thing as 2th and 3th)

Quoted 7 lines

3. Consider changing the message
"Cannot boot vm anylonger"
to
"Cannot create VM #%d" % num

4. Why not add curr_vm to vms immediately after cloning it? That way you can kill it in the exception handler later, without

having

Quoted 2 lines

to send it a 'quit' if you can't login ('if not curr_vm_session').

Yes, good idea.

Quoted 1 line

5. " %dth guest boots up successfully" % num --> again, 2th and 3th

make no sense.

Quoted 8 lines

Also, I wonder why you add those spaces before every info message.

6. "%dth guest's session is not responsive" --> same (maybe use "Guest session #%d is not responsive" % num)

7. "Shut down the %dth guest" --> same
(maybe "Shutting down guest #%d"? or destroying/killing?)

Quoted 6 lines

8. Shouldn't we fail the test when we find an unresponsive session? It seems you just display an error message. You can simply replace logging.error( with raise error.TestFail(.

9. Consider using a stricter test than just

vm_session.is_responsive().

Quoted 1 line

vm_session.is_responsive() just sends ENTER to the sessions and

returns

Quoted 1 line

True if it gets anything as a result (usually a prompt, or even just

a

Quoted 2 lines

newline echoed back). If the session passes this test it is indeed responsive, so it's a decent test, but maybe you can send some

command

Quoted 1 line

(user configurable?) and test for some output. I'm really not sure

this

Quoted 1 line

is important, because I can't imagine a session would respond to a

newline

Quoted 1 line

but not to other commands, but who knows. Maybe you can send the

first VM

Quoted 8 lines
Quoted 1 line

a user-specified command when the test begins, remember the output,

and

Quoted 1 line

then send all other VMs the same command and make sure the output is

the

Quoted 2 lines

same.

maybe use 'info status' and send command 'help' via session to vms and compare their output?

I'm not sure I understand. What does 'info status' do? We're talking about an SSH shell, not the monitor. You can do whatever you like, like 'uname -a', and 'ls /', but you should leave it up to the user to decide, so he/she can specify different commands for different guests. Linux commands won't work under Windows, so Linux and Windows must have different commands in the config file. In the Linux section, under '- @Linux:' you can add something like:

stress_boot:
stress_boot_test_command = uname -a

and under '- @Windows:':

stress_boot:

    stress_boot_test_command = ver && vol

These commands are just naive suggestions. I'm sure someone can think of much more informative commands.

Quoted 20 lines
Quoted 1 line

10. I'm not sure you should use the param "kill_vm_gracefully"

because that's

Quoted 1 line

a postprocessor param (probably not your business). You can just

call

Quoted 1 line

destroy() in the exception handler with gracefully=False, because if

the VMs

Quoted 1 line

are non- responsive, I don't expect them to shutdown nicely with an

SSH

Quoted 1 line

command (that's what gracefully does). Also, we're using -snapshot,

so

Quoted 2 lines

there's no reason to shut them down nicely.

Yes, I agree. :)

Quoted 1 line

11. "Total number booted successfully: %d" % (num - 1) --> why not

just num?

Quoted 2 lines

We really have num VMs including the first one.
Or you can say: "Total number booted successfully in addition to the

first one"

Quoted 2 lines

but that's much longer.

Quoted 7 lines

Since after the first guest booted, I set num = 1 and then 'num += 1'

at first in while loop ( for the purpose of getting a new vm ). So curr_vm is vm2 ( num is 2) now. If the second vm failed to boot up, the num booted successfully should be (num - 1).
I would use enumerate(vms) that Uri suggested to make number easier to count.

OK, I didn't notice that.

Quoted 14 lines
Quoted 1 line

12. Consider adding a 'max_vms' (or 'threshold') user param to the

test. If

Quoted 1 line

num reaches 'max_vms', we stop adding VMs and pass the test.

Otherwise the

Quoted 1 line

test will always fail (which is depressing). If

params.get("threshold") is

Quoted 1 line

None or "", or in short -- 'if not params.get("threshold")', disable

this

Quoted 1 line

feature and keep adding VMs forever. The user can enable the feature

with:

Quoted 4 lines

max_vms = 50
or disable it with:
max_vms =

Quoted 8 lines

This is a good idea for hardware resource limit of host.

Quoted 1 line

13. Why are you catching OSError? If you get OSError it might be a

framework bug.

Quoted 1 line

Since sometimes, vm.create() successfully but failed to ssh-login since
the running python cannot allocate physical memory (OSError). Add max_vms could fix this problem I think.

Do you remember exactly where OSError was thrown? Do you happen to have a backtrace? (I just want to be very it's not a bug.)

Quoted 8 lines
Quoted 1 line

14. At the end of the exception handler you should proably re-raise

the exception

Quoted 1 line

you caught. Otherwise the user won't see the error message. You can

simply replace

Quoted 1 line

'break' with 'raise' (no parameters), and it should work,

hopefully.

Quoted 1 line

Yes I should if add a 'max_vms'.

I think you should re-raise anyway. Otherwise, what's the point in writing error messages such as "raise error.TestFail("Cannot boot vm anylonger")"? I you don't re-raise, the user won't see the messages.

Quoted 33 lines
Quoted 1 line

I know these are quite a few comments, but they're all rather minor

and the test

Quoted 2 lines

is well written in my opinion.

Thank you, I will do modification according to your and Uri's comments,
and will re-submit it here later. :)

Thanks and Best Regards,
Yolkfull

Quoted 9 lines

Thanks,
Michael

----- Original Message -----
From: "Yolkfull Chow"<[email protected]> To:[email protected]
Cc: "Uri Lublin"<[email protected]>
Sent: Tuesday, June 9, 2009 11:41:54 AM (GMT+0200) Auto-Detected
Subject: [KVM-AUTOTEST PATCH] A test patch - Boot VMs until one of

them becomes unresponsive

Quoted 9 lines

Hi,

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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 121 lines · Michael Goldish
Quoted 99 lines · ----- "Yolkfull Chow
Quoted 9 lines · Michael Goldish

The test looks pretty nicely written. Comments:

1. Consider making all the cloned VMs use image snapshots:

curr_vm = vm1.clone() curr_vm.get_params()["extra_params"] += " -snapshot"

I'm not sure it's a good idea to let all VMs use the same disk

image.

Quoted 2 lines

Or maybe you shouldn't add -snapshot yourself, but rather do it in

the config

Quoted 2 lines

file for the first VM, and then all cloned VMs will have -snapshot

as well.

Quoted 2 lines

Yes I use 'image_snapshot = yes' in config file.

Quoted 6 lines

2. Consider changing the message
" Booting the %dth guest" % num
to
"Booting guest #%d" % num
(because there's no such thing as 2th and 3th)

Quoted 8 lines

3. Consider changing the message
"Cannot boot vm anylonger"
to
"Cannot create VM #%d" % num

4. Why not add curr_vm to vms immediately after cloning it? That way you can kill it in the exception handler later, without

having

Quoted 3 lines

to send it a 'quit' if you can't login ('if not curr_vm_session').

Yes, good idea.

Quoted 2 lines

5. " %dth guest boots up successfully" % num --> again, 2th and 3th

make no sense.

Quoted 8 lines

Also, I wonder why you add those spaces before every info message.

6. "%dth guest's session is not responsive" --> same
(maybe use "Guest session #%d is not responsive" % num)

7. "Shut down the %dth guest" --> same
(maybe "Shutting down guest #%d"? or destroying/killing?)

Quoted 8 lines

8. Shouldn't we fail the test when we find an unresponsive session? It seems you just display an error message. You can simply replace logging.error( with raise error.TestFail(.

9. Consider using a stricter test than just

vm_session.is_responsive().

Quoted 2 lines

vm_session.is_responsive() just sends ENTER to the sessions and

returns

Quoted 2 lines

True if it gets anything as a result (usually a prompt, or even just

a

Quoted 3 lines

newline echoed back). If the session passes this test it is indeed responsive, so it's a decent test, but maybe you can send some

command

Quoted 2 lines

(user configurable?) and test for some output. I'm really not sure

this

Quoted 2 lines

is important, because I can't imagine a session would respond to a

newline

Quoted 2 lines

but not to other commands, but who knows. Maybe you can send the

first VM

Quoted 2 lines

a user-specified command when the test begins, remember the output,

and

Quoted 2 lines

then send all other VMs the same command and make sure the output is

Quoted 8 lines

the

Quoted 3 lines

same.

maybe use 'info status' and send command 'help' via session to vms and compare their output?

I'm not sure I understand. What does 'info status' do? We're talking about an SSH shell, not the monitor. You can do whatever you like, like 'uname -a', and 'ls /', but you should leave it up to the user to decide, so he/she can specify different commands for different guests. Linux commands won't work under Windows, so Linux and Windows must have different commands in the config file. In the Linux section, under '- @Linux:' you can add something like:

stress_boot:
stress_boot_test_command = uname -a

Quoted 8 lines

and under '- @Windows:':

stress_boot:

     stress_boot_test_command = ver&&  vol

These commands are just naive suggestions. I'm sure someone can think of much more informative commands.

That's really good suggestions. Thanks, Michael. And can I use 'migration_test_command' instead?

Quoted 82 lines
Quoted 38 lines
Quoted 3 lines

10. I'm not sure you should use the param "kill_vm_gracefully"

because that's

Quoted 2 lines

a postprocessor param (probably not your business). You can just

call

Quoted 2 lines

destroy() in the exception handler with gracefully=False, because if

the VMs

Quoted 2 lines

are non- responsive, I don't expect them to shutdown nicely with an

SSH

Quoted 2 lines

command (that's what gracefully does). Also, we're using -snapshot,

so

Quoted 3 lines

there's no reason to shut them down nicely.

Yes, I agree. :)

Quoted 2 lines

11. "Total number booted successfully: %d" % (num - 1) --> why not

just num?

Quoted 3 lines

We really have num VMs including the first one.
Or you can say: "Total number booted successfully in addition to the

first one"

Quoted 3 lines

but that's much longer.

Quoted 8 lines

Since after the first guest booted, I set num = 1 and then 'num += 1'

at first in while loop ( for the purpose of getting a new vm ). So curr_vm is vm2 ( num is 2) now. If the second vm failed to boot up, the num booted successfully should be (num - 1).
I would use enumerate(vms) that Uri suggested to make number easier to count.

OK, I didn't notice that.

Quoted 33 lines
Quoted 2 lines

12. Consider adding a 'max_vms' (or 'threshold') user param to the

test. If

Quoted 2 lines

num reaches 'max_vms', we stop adding VMs and pass the test.

Otherwise the

Quoted 2 lines

test will always fail (which is depressing). If

params.get("threshold") is

Quoted 2 lines

None or "", or in short -- 'if not params.get("threshold")', disable

this

Quoted 2 lines

feature and keep adding VMs forever. The user can enable the feature

with:

Quoted 5 lines

max_vms = 50
or disable it with:
max_vms =

This is a good idea for hardware resource limit of host.

Quoted 2 lines

13. Why are you catching OSError? If you get OSError it might be a

framework bug.

Quoted 2 lines
Quoted 8 lines
Quoted 5 lines

Since sometimes, vm.create() successfully but failed to ssh-login since
the running python cannot allocate physical memory (OSError). Add max_vms could fix this problem I think.

Do you remember exactly where OSError was thrown? Do you happen to have a backtrace? (I just want to be very it's not a bug.)

The OSError was thrown when checking all VMs are responsive and I got many traceback about "OSError: [Errno 12] Cannot allocate memory". Maybe since when last VM was created successfully with lucky, whereas python cannot get physical memory after that when checking all sessions. So can we now catch the OSError and tell user the number of max_vms is too large?

Quoted 61 lines
Quoted 8 lines
Quoted 2 lines

14. At the end of the exception handler you should proably re-raise

the exception

Quoted 2 lines

you caught. Otherwise the user won't see the error message. You can

simply replace

Quoted 8 lines
Quoted 2 lines

'break' with 'raise' (no parameters), and it should work,

hopefully.

Quoted 2 lines

Yes I should if add a 'max_vms'.

I think you should re-raise anyway. Otherwise, what's the point in writing error messages such as "raise error.TestFail("Cannot boot vm anylonger")"? I you don't re-raise, the user won't see the messages.

Quoted 40 lines
Quoted 2 lines

I know these are quite a few comments, but they're all rather minor

and the test

Quoted 3 lines

is well written in my opinion.

Thank you, I will do modification according to your and Uri's comments,
and will re-submit it here later. :)

Thanks and Best Regards,
Yolkfull

Quoted 10 lines

Thanks,
Michael

----- Original Message -----
From: "Yolkfull Chow"<[email protected]> To:[email protected]
Cc: "Uri Lublin"<[email protected]>
Sent: Tuesday, June 9, 2009 11:41:54 AM (GMT+0200) Auto-Detected
Subject: [KVM-AUTOTEST PATCH] A test patch - Boot VMs until one of

them becomes unresponsive

Quoted 9 lines

Hi,

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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Yolkfull
Regards,