[Libvirt-cim] [PATCH] [TEST] Updating the get_host_info() to accomadate the sblim-provider-changes

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Fri Sep 26 09:39:32 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1222421934 25200
# Node ID 931425aa2a7970ec2894d6059d7d176c9f80ea96
# Parent  61a90c7c9141a64af825e6d4e5645723879df078
[TEST] Updating the get_host_info() to accomadate the sblim-provider-changes.

Tested with Xen, XenFV and KVM on current sources.

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

diff -r 61a90c7c9141 -r 931425aa2a79 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Wed Sep 24 20:27:48 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Fri Sep 26 02:38:54 2008 -0700
@@ -210,18 +210,32 @@ def get_host_info(server, virt="Xen"):
     host_name = ''
     host_ccn  = ''
     keys = ['Name', 'CreationClassName']
-    try :
-        host_sys = enumclass.enumerate(server, 'HostSystem', keys, virt)
-        if host_sys[0].Name == "":
+
+    try:
+
+        # This following modification is req to accomadate the 
+        # sblim-base-provider provider related changes
+
+        ret, linux_cs = check_sblim(server)
+        host_info = enumclass.enumerate(server, 'HostSystem', keys, virt)
+        if ret == PASS:
+            host_sys = linux_cs
+        elif len(host_info) == 1:
+            host_sys = host_info[0]
+        else:
+            logger.error("Error in getting HostSystem information, Exiting...")
+            return FAIL,  host_name, host_ccn
+
+        if host_sys.Name == "":
             logger.error("HostName seems to be empty")
             status = FAIL
         else:
-        # Instance of the HostSystem
-            host_sys = host_sys[0]
+            # Instance of the HostSystem
             host_ccn = host_sys.CreationClassName
             host_name = host_sys.Name
-    except Exception, detail:
-        logger.error(CIM_ERROR_ENUMERATE, 'HostSystem')
+
+    except Exception,detail:
+        logger.error(CIM_ERROR_ENUMERATE, 'Hostsystem')
         logger.error("Exception: %s", detail)
         status = FAIL
     return status, host_name, host_ccn




More information about the Libvirt-cim mailing list