[PATCH] [TEST] Fix HostedService-02_reverse.py with sblim base provider installed

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1222422572 25200 # Node ID 198c30c31203d1b2c58322732509565479b52c18 # Parent 61a90c7c9141a64af825e6d4e5645723879df078 [TEST] Fix HostedService-02_reverse.py with sblim base provider installed Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 61a90c7c9141 -r 198c30c31203 suites/libvirt-cim/cimtest/HostedService/02_reverse.py --- a/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Wed Sep 24 20:27:48 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Fri Sep 26 02:49:32 2008 -0700 @@ -25,6 +25,7 @@ from VirtLib import utils from VirtLib import utils from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import check_sblim from XenKvmLib.classes import get_typed_class from CimTest import Globals from XenKvmLib.const import do_main @@ -36,12 +37,16 @@ sup_types = ['Xen', 'XenFV', 'KVM', 'LXC @do_main(sup_types) def main(): options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) - 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(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) + return FAIL servicelist = {"ResourcePoolConfigurationService" : "RPCS", "VirtualSystemManagementService" : "Management Service", "VirtualSystemMigrationService" : "MigrationService"} @@ -67,7 +72,8 @@ def main(): ccn = assoc_host[0].keybindings['CreationClassName'] name = assoc_host[0].keybindings['Name'] - if ccn != get_typed_class(options.virt, "HostSystem"): + if ccn != get_typed_class(options.virt, "HostSystem")\ + and ccn != 'Linux_ComputerSystem': logger.error("CreationClassName Error") return FAIL elif name != host_sys.Name:

options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) - 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(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) + return FAIL
With Deepti's patch, you can use get_host_info() instead.
servicelist = {"ResourcePoolConfigurationService" : "RPCS", "VirtualSystemManagementService" : "Management Service", "VirtualSystemMigrationService" : "MigrationService"} @@ -67,7 +72,8 @@ def main(): ccn = assoc_host[0].keybindings['CreationClassName'] name = assoc_host[0].keybindings['Name']
- if ccn != get_typed_class(options.virt, "HostSystem"): + if ccn != get_typed_class(options.virt, "HostSystem")\ + and ccn != 'Linux_ComputerSystem':
Instead of using HostSystem and Linux_ComputerSystem here, you can use the host_sys CreationClassName. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

libvirt-cim-bounces@redhat.com wrote on 2008-09-27 05:53:39:
options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem',
keys, options.virt)[0]
- except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys. CreationClassName) - 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(Globals.CIM_ERROR_ENUMERATE % host_sys. CreationClassName) + return FAIL
With Deepti's patch, you can use get_host_info() instead.
servicelist = {"ResourcePoolConfigurationService" : "RPCS", "VirtualSystemManagementService" :
"ManagementService",
"VirtualSystemMigrationService" :
"MigrationService"}
@@ -67,7 +72,8 @@ def main(): ccn = assoc_host[0].keybindings['CreationClassName'] name = assoc_host[0].keybindings['Name']
- if ccn != get_typed_class(options.virt, "HostSystem"): + if ccn != get_typed_class(options.virt, "HostSystem")\ + and ccn != 'Linux_ComputerSystem':
Instead of using HostSystem and Linux_ComputerSystem here, you can use the host_sys CreationClassName.
Good catch. Thanks!
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (3)
-
Guo Lian Yun
-
Kaitlin Rupert
-
yunguol@cn.ibm.com