[Libvirt-cim] [PATCH] [TEST] Fix HostedService-03_forward_errs.py with sblim base provider installed

yunguol at cn.ibm.com yunguol at cn.ibm.com
Fri Sep 26 09:59:47 UTC 2008


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1222423181 25200
# Node ID 1442364dd0bd1aca61a3afb632e18127ac24a2d1
# Parent  61a90c7c9141a64af825e6d4e5645723879df078
[TEST] Fix HostedService-03_forward_errs.py with sblim base provider installed

Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>

diff -r 61a90c7c9141 -r 1442364dd0bd suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py	Wed Sep 24 20:27:48 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py	Fri Sep 26 02:59:41 2008 -0700
@@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
 from pywbem.cim_obj import CIMInstanceName
 from XenKvmLib import assoc
 from XenKvmLib import enumclass
+from XenKvmLib.common_util import check_sblim
 from XenKvmLib.classes import get_typed_class
 from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
                             CIM_PASS, CIM_NS
@@ -40,24 +41,30 @@ def main():
     options = main.options
     rc = -1
     status = FAIL
-    keys = ['Name', 'CreationClassName']
-    try:
-        host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
-    except Exception:
-        logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
-        return FAIL
+    ret, linux_cs = check_sblim(options.ip, options.virt)
+    if ret == PASS:
+        host_sys = linux_cs
+    else:
+        keys = ['Name', 'CreationClassName']
+        try:
+            host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
+        except Exception:
+            logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+            return FAIL
 
     
     conn = assoc.myWBEMConnection('http://%s' % options.ip,                                        
                                   (CIM_USER, CIM_PASS),
                                    CIM_NS)
     instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), 
-                                  keybindings = {"Wrong" : "wrong", "CreationClassName" : host_sys.CreationClassName})
+                                  keybindings = {"Wrong" : "wrong", \
+                                  "CreationClassName" : host_sys.CreationClassName})
 
     names = []
 
     try:
-        names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
+        names = conn.AssociatorNames(instanceref, \
+                AssocClass = get_typed_class(options.virt, "HostedService"))
         rc = 0
     except pywbem.CIMError, (rc, desc):
         if rc == exp_rc and desc.find(exp_desc) >= 0:
@@ -70,7 +77,8 @@ def main():
         logger.error(details)
 
     if rc == 0:
-        logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of HostSystem input")
+        logger.error("HostedService associator should NOT return excepted result \
+                     with a wrong key name and value of HostSystem input")
         status = FAIL
     
     return status        




More information about the Libvirt-cim mailing list