# HG changeset patch
# User Deepti B. Kalakeri<dkalaker(a)in.ibm.com>
# Date 1220608044 25200
# Node ID fadf48775f32b451a48812cb4b61ee4ef1f8c177
# Parent 3c04faaa67e001ecaf578a13da75f88235257576
[TEST] Modfiying poll_for_state_change() to poll for VS instance to be returned.
Changes:
--------
1) Modfiying poll_for_state_change() to poll for VS instance to be returned.
2) Identing one of the lines in 32_start_reboot.py
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 3c04faaa67e0 -r fadf48775f32
suites/libvirt-cim/cimtest/ComputerSystem/32_start_reboot.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/32_start_reboot.py Tue Sep 02 23:10:52
2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/32_start_reboot.py Fri Sep 05 02:47:24
2008 -0700
@@ -40,6 +40,7 @@
import sys
from VirtLib import utils
+from time import sleep
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
@@ -89,7 +90,7 @@ def main():
break
status, dom_cs = poll_for_state_change(server, virt, default_dom, en_state,
- timeout=10)
+ timeout=10)
if status != PASS or dom_cs.RequestedState != rq_state:
status = FAIL
diff -r 3c04faaa67e0 -r fadf48775f32 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Tue Sep 02 23:10:52 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Fri Sep 05 02:47:24 2008 -0700
@@ -177,20 +177,24 @@ def poll_for_state_change(server, virt,
'Name' : dom,
'CreationClassName' : get_typed_class(virt,
'ComputerSystem')
}
- dom_cs = enumclass.getInstance(server, 'ComputerSystem', keys, virt)
try:
for i in range(1, (timeout + 1)):
+ dom_cs = enumclass.getInstance(server, 'ComputerSystem', keys,
+ virt)
+ if dom_cs is None or dom_cs.Name != dom:
+ continue
+
sleep(1)
- if dom_cs is None or dom_cs.Name != dom:
- logger.error("CS instance not returned for %s." % dom)
- return FAIL, dom_cs
-
if dom_cs.EnabledState == exp_state:
break
except Exception, detail:
logger.error("Exception: %s" % detail)
+ return FAIL, dom_cs
+
+ if dom_cs is None or dom_cs.Name != dom:
+ logger.error("CS instance not returned for %s." % dom)
return FAIL, dom_cs
if dom_cs.EnabledState != exp_state: