[Libvirt-cim] [PATCH] [TEST] Fixing 01_forward.py tc of HostedDependency, accomdating sblim-base-provider changes

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Thu Sep 25 20:06:03 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1222369936 25200
# Node ID cdf9d7ee99cac967eb9ec0935709b02db6c9dabd
# Parent  375ae129b8e910fe42a5e4434b67ada5589bc72f
[TEST] Fixing 01_forward.py tc of HostedDependency, accomdating sblim-base-provider changes.

This tc changes requires the check_sblim() fn changes.

Tested with Xen, XenFV, KVM on current sources and witjh/without sblim-base-provider installed.

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

diff -r 375ae129b8e9 -r cdf9d7ee99ca suites/libvirt-cim/cimtest/HostedDependency/01_forward.py
--- a/suites/libvirt-cim/cimtest/HostedDependency/01_forward.py	Tue Sep 23 04:45:04 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedDependency/01_forward.py	Thu Sep 25 12:12:16 2008 -0700
@@ -31,7 +31,7 @@
 #
 # The output should be a single record and it will look something like this:
 # localhost:5988/root/virt:Xen_HostSystem.CreationClassName="Xen_HostSystem",
-# Name="mx3650b.in.ibm.com"
+# Name="x3650"
 # ......
 # -CommunicationStatus
 # -CreationClassName="Xen_HostSystem"
@@ -51,8 +51,10 @@ from XenKvmLib import enumclass
 from XenKvmLib import enumclass
 from XenKvmLib.classes import get_class_basename
 from CimTest import Globals
+from CimTest.Globals import logger
 from XenKvmLib.const import do_main
 from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.common_util import check_sblim
 
 sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
 
@@ -71,25 +73,41 @@ def main():
         cxml = virtxml(test_dom, mac = test_mac)
     ret = cxml.define(options.ip)
     if not ret:
-        Globals.logger.error("Failed to Create the dom: %s", test_dom)
+        logger.error("Failed to Create the dom: %s", test_dom)
         status = FAIL
         return status
+
     keys = ['Name', 'CreationClassName']
+    
     try:
-        host = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
+        ret, linux_cs = check_sblim(options.ip)
+        host_info = enumclass.enumerate(options.ip, 'HostSystem', keys, 
+                                        options.virt)
     except Exception,detail:
-        Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, 'Hostsystem')
-        Globals.logger.error("Exception: %s", detail)
+        logger.error(Globals.CIM_ERROR_ENUMERATE, 'Hostsystem')
+        logger.error("Exception: %s", detail)
         status = FAIL
         cxml.undefine(options.ip)
         return status
-    
-    keys = ['Name', 'CreationClassName']
+
+    # This below modification is req to accomadate the 
+    # sblim-base-provider provider related changes
+    if ret == PASS and len(host_info) == 0:
+        host = linux_cs
+    elif ret == FAIL  and len(host_info) == 1:
+        host = host_info[0]
+    elif (ret == FAIL and len(host_info) == 0)  or \
+         (ret == PASS and len(host_info) == 1):
+        logger.error("Error in getting HostSystem information, Exiting...")
+        cxml.undefine(options.ip)
+        return FAIL
+
     try: 
-        cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
+        cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, 
+                                 options.virt)
     except Exception,detail:
-        Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, 'ComputerSystem')
-        Globals.logger.error("Exception: %s", detail)
+        logger.error(Globals.CIM_ERROR_ENUMERATE, 'ComputerSystem')
+        logger.error("Exception: %s", detail)
         status = FAIL
         cxml.undefine(options.ip)
         return status
@@ -104,14 +122,15 @@ def main():
 
             if not hs:
                 cxml.undefine(options.ip)
-                Globals.logger.error("HostName seems to be empty")
+                logger.error("HostName seems to be empty")
                 status = FAIL
                 break
 
             if len(hs) != 1:
                 test =  "(len(hs), system.name)"
-                Globals.logger.error("HostedDependency returned %i HostSystem \
-objects for domain '%s'", len(hs), system.name)
+                logger.error("'%s' returned %i HostSystem " 
+                             "objects for domain '%s'", 
+                              hs_cn, len(hs), system.name)
                 status = FAIL
                 break
 
@@ -119,19 +138,19 @@ objects for domain '%s'", len(hs), syste
             sn = hs[0]["Name"]
 
             if cn != host.CreationClassName:
-                Globals.logger.error("CreationClassName does not match")
+                logger.error("CreationClassName does not match")
                 status = FAIL
                 
             if sn != host.Name:
-                Globals.logger.error("Name does not match")
+                logger.error("Name does not match")
                 status = FAIL
 
-            if status != 0:
+            if status != PASS:
                 break
             
     except Exception,detail:
-        Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORS, hs_cn)
-        Globals.logger.error("Exception: %s", detail)
+        logger.error(Globals.CIM_ERROR_ASSOCIATORS, hs_cn)
+        logger.error("Exception: %s", detail)
         status = FAIL
         cxml.undefine(options.ip)
         return status




More information about the Libvirt-cim mailing list