[Libvirt-cim] [PATCH] [TEST] Fixing the 40_RSC_start.py tc

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Mon Aug 4 12:20:09 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1217851690 25200
# Node ID 6773c2717b6d2a1ccc3143a27bc2209dabc81e4b
# Parent  56ae86dadb4d67ebcfce703e3895c7fb8a118c58
[TEST] Fixing the 40_RSC_start.py tc.
1) Used poll_for_state_change() to verify the poll and verify the EnabledState and RequestedState value.
2) Removed the invalid bug nos.
3) Removed check_attributes().
4) Adding create_netpool_conf(), destroy_netpool() since the VSMS now requires networkpool.
5) Used destroy_and_undefine_domain() to undefine and destroy the VS.

The changes are verified with KVM on current sources.

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

diff -r 56ae86dadb4d -r 6773c2717b6d suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py	Sun Aug 03 23:22:49 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py	Mon Aug 04 05:08:10 2008 -0700
@@ -36,60 +36,49 @@
 import sys
 import pywbem
 from VirtLib import utils
-from XenKvmLib.test_doms import undefine_test_domain 
+from XenKvmLib.test_doms import destroy_and_undefine_domain 
 from XenKvmLib.common_util import *
 from CimTest.Globals import logger
 from CimTest.Globals import do_main
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
 
 sup_types = ['Xen', 'KVM', 'XenFV']
-bug = "00001"
-bug_req_state = "00002"
 
-default_dom = 'test_domain'
+default_dom = 'cs_test_domain'
 REQUESTED_STATE = 2
 TIME = "00000000000000.000000:000"
-
-def check_attributes(domain_name, ip, virt):
-    rc, cs = get_cs_instance(domain_name, ip, virt)
-    if rc != 0:
-        return rc
-
-    if cs.RequestedState != REQUESTED_STATE:
-        logger.error("RequestedState should be %d not %d",
-                     REQUESTED_STATE, cs.RequestedState)
-        return FAIL
-
-    if cs.EnabledState != REQUESTED_STATE:
-        logger.error("EnabledState should be %d not %d",
-                     REQUESTED_STATE, cs.EnabledState)
-        return FAIL
-
-    return PASS
 
 @do_main(sup_types)
 def main():
     options = main.options
+    server = options.ip
+    virt = options.virt
     status = FAIL
 
+    status, test_network = create_netpool_conf(server, virt, False)
+    if status != PASS:
+        return FAIL
+
     try:
-        rc = create_using_definesystem(default_dom, options.ip, 
-                                       virt=options.virt)
+        rc = create_using_definesystem(default_dom, server, 
+                                       virt=virt)
         if rc != 0:
-            raise Exception("DefineSystem() failed to create domain: %s" % 
+            status = FAIL
+            raise Exception("DefineSystem() failed to create domain: '%s'" % 
                             default_dom)
 
-        rc = call_request_state_change(default_dom, options.ip, 
-                                       REQUESTED_STATE, TIME, options.virt)
+        rc = call_request_state_change(default_dom, server, 
+                                       REQUESTED_STATE, TIME, virt)
         if rc != 0:
-            status = XFAIL_RC(bug)
+            status = FAIL
             raise Exception("RequestedStateChange() could not be used to start"
                             " domain: '%s'" % default_dom)
 
+        status, dom_cs = poll_for_state_change(server, virt, default_dom, 
+                                               REQUESTED_STATE, timeout=10)
 
-        rc = check_attributes(default_dom, options.ip, options.virt)
-        if rc != 0:
-            status = XFAIL_RC(bug_req_state)
+        if status != PASS or dom_cs.RequestedState != REQUESTED_STATE:
+            status = FAIL
             raise Exception("Attributes were not set as expected for "
                             "domain: '%s'" % default_dom)
         else:
@@ -98,8 +87,8 @@
     except Exception, detail:
         logger.error("Exception: %s", detail)
 
-    undefine_test_domain(default_dom, options.ip, options.virt)
-
+    destroy_netpool(server, virt, test_network)
+    destroy_and_undefine_domain(default_dom, server, virt)
     return status
 
 if __name__ == "__main__":




More information about the Libvirt-cim mailing list