[Libvirt-cim] [PATCH] [TEST] Fixing the 04_defineStartVS.py tc failure

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Thu Apr 10 13:34:43 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1207834470 -19800
# Node ID 0e7eb39ed839e03d1dd2635157f19e5acdc4c9be
# Parent  1f4926b238908ff7f4c6610fde37490492ba559c
[TEST] Fixing the 04_defineStartVS.py tc failure.

Signed-off-by: Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>

diff -r 1f4926b23890 -r 0e7eb39ed839 suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py	Thu Apr 10 18:57:34 2008 +0530
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py	Thu Apr 10 19:04:30 2008 +0530
@@ -6,6 +6,7 @@
 #    Kaitlin Rupert <karupert at us.ibm.com>
 #    Veerendra Chandrappa <vechandr at in.ibm.com>
 #    Zhengang Li <lizg at cn.ibm.com>
+#    Deepti B. kalakeri <deeptik at linux.vnet.ibm.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public
@@ -28,10 +29,11 @@
 # 10-Oct-2007
 
 import sys
+from time import sleep
 from XenKvmLib import vxml
 from XenKvmLib import computersystem
-from VirtLib import utils
 from CimTest import Globals
+from XenKvmLib.classes import get_typed_class
 from CimTest.Globals import do_main
 from CimTest.ReturnCodes import PASS, FAIL
 
@@ -53,18 +55,21 @@ def main():
         Globals.logger.error("Failed to Start the dom: %s", test_dom)
         cxml.undefine(options.ip)
         return status
-
+    
+    timeout = 10
     try:
-        cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
-
-        if cs.Name == test_dom:
-            enabState = cs.EnabledState
-        else:
-            Globals.logger.error("VS %s is not defined" % test_dom)
-
-        # Success: VS is in Enabled State after Define and Start 
-        if enabState == 2:
-            status = PASS
+    # Need to poll for XenFV, since enabState is not getting set otherwise. 
+        for i in range(1, (timeout + 1)):
+            sleep(1)
+            cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
+            if cs.Name == test_dom:
+                enabState = cs.EnabledState
+            else:
+                Globals.logger.error("VS %s is not defined" % test_dom)
+    # Success: VS is in Enabled State after Define and Start 
+            if enabState == 2:
+                status = PASS
+                break
 
     except Exception, detail:
         Globals.logger.error(Globals.CIM_ERROR_GETINSTANCE, 




More information about the Libvirt-cim mailing list