Skip to contentSkip to conversation

KVM Test: Fix invalid literal bug in ioquit

PATCH Feng Yang 1 participant 1 message Jun 22, 2010 1 message not in the archive KVM

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 89654694.590411277173047710.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com

Feng Yang

author
#1 lore raw
Quoted 28 lines · ----- "Michael Goldish

From: "Michael Goldish" <[email protected]>
To: "Feng Yang" <[email protected]>
Cc: [email protected], [email protected]
Sent: Monday, June 21, 2010 7:19:58 PM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
Subject: Re: [PATCH] KVM Test: Fix invalid literal bug in ioquit

Quoted 5 lines · Feng Yang

Sometime check_cmd could not finish in setting time. Then o="", so int(o) will cause ValueError:
invalid literal for int() with base 10: '' So change to check return status.

Review

Quoted 7 lines
---
 client/tests/kvm/tests/ioquit.py       |    6 +++---
 client/tests/kvm/tests_base.cfg.sample |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/client/tests/kvm/tests/ioquit.py

client/tests/kvm/tests/ioquit.py def run_ioquit(test, params, env): · line 23

Quoted 5 lines

index 389a867..8126139 100644

client/tests/kvm/tests/ioquit.py +0 -0
@@ -23,13 +23,13 @@ def run_ioquit(test, params, env):
         (s, o) = session.get_command_status_output(bg_cmd,

timeout=60)

client/tests/kvm/tests/ioquit.py def run_ioquit(test, params, env): · line 25

Quoted 2 lines
client/tests/kvm/tests/ioquit.py +0 -0
         check_cmd = params.get("check_cmd")
         (s, o) = session2.get_command_status_output(check_cmd,
Quoted 7 lines

timeout=60)

client/tests/kvm/tests/ioquit.py def run_ioquit(test, params, env): · line 27

Quoted 3 lines
client/tests/kvm/tests/ioquit.py +1 -1
-        if int(o) <= 0:
+        if s:
             raise error.TestError("Fail to add IO workload for

Guest OS")

Please use 'if s != 0' because in case of a timeout s is None.

Hi Michael, thanks for your comments!
But here, I think 'if s:' is better.
get_command_status_output(check_cmd, timeout=60) timeout should caused by workload is bigger in the guest. This just what we want. Should not throw an error here.

Only 'if s:' match, we can say 'Fail to add IO workload for Guest OS'.

Thanks!

Quoted 36 lines

client/tests/kvm/tests/ioquit.py def run_ioquit(test, params, env): · line 30

Quoted 4 lines
client/tests/kvm/tests/ioquit.py +0 -1
         logging.info("Sleep for a while")
         time.sleep(random.randrange(30,100))
-        (s, o) = session2.get_command_status_output(check_cmd,

timeout=300)

client/tests/kvm/tests/ioquit.py def run_ioquit(test, params, env): · line 30

Quoted 2 lines
client/tests/kvm/tests/ioquit.py +1 -1
-        if int(o) <= 0:
+        (s, o) = session2.get_command_status_output(check_cmd,

timeout=60)

client/tests/kvm/tests/ioquit.py def run_ioquit(test, params, env): · line 31

Quoted 1 line
client/tests/kvm/tests/ioquit.py +1 -0
+        if s:

Same here.

client/tests/kvm/tests/ioquit.py def run_ioquit(test, params, env): · line 32

Quoted 1 line
client/tests/kvm/tests/ioquit.py +0 -0
             logging.info("IO workload finished before the VM was

killed")

Review

Quoted 3 lines
client/tests/kvm/tests/ioquit.py +0 -0
         logging.info("Kill the virtual machine")
         vm.process.close()
(quoted diff) +0 -0

b/client/tests/kvm/tests_base.cfg.sample

client/tests/kvm/tests_base.cfg.sample variants: · line 413

Quoted 7 lines

index ce88235..0fd5543 100644

client/tests/kvm/tests_base.cfg.sample +0 -0
@@ -411,7 +411,7 @@ variants:
     - ioquit:
         type = ioquit
         background_cmd = "for i in 1 2 3 4; do (nohup dd

if=/dev/urandom of=/tmp/file bs=102400 count=10000000 &) done"

client/tests/kvm/tests_base.cfg.sample variants: · line 417

Quoted 5 lines
client/tests/kvm/tests_base.cfg.sample +1 -1
-        check_cmd = ps -a |grep dd |wc -l
+        check_cmd = ps -a |grep dd
         login_timeout = 360
 
     - qemu_img:

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