# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1222062868 25200
# Node ID 83e6f32be2ae455bfec0f014374889a5217f1168
# Parent 892ce3fce2340df3fb51a1160f510d15838f2d54
[TEST]Fix HostSystem-01_enum.py with sblim cmpi base provider installed, add
Linux_ComputerSystem to enumclass
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 892ce3fce234 -r 83e6f32be2ae suites/libvirt-cim/cimtest/HostSystem/01_enum.py
--- a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py Fri Sep 12 14:35:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py Sun Sep 21 22:54:28 2008 -0700
@@ -32,8 +32,9 @@ from VirtLib import utils
from VirtLib import utils
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL
+from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+bug = '00007'
SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV', 'LXC']
@do_main(SUPPORTED_TYPES)
@@ -43,27 +44,35 @@ def main():
status = FAIL
keys = ['Name', 'CreationClassName']
- try:
- hs = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)
- name = get_typed_class(options.virt, 'HostSystem')
+
+ linux_cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys,
'Linux')
+ hs = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)
+ if len(linux_cs) == 1 and len(hs) == 0:
+ return PASS
+ if len(linux_cs) == 0 and len(hs) == 0:
+ return XFAIL_RC(bug)
+ elif len(linux_cs) == 0 and len(hs)== 1:
+ try:
+ hs = enumclass.enumerate(options.ip, 'HostSystem', keys,
options.virt)
+ name = get_typed_class(options.virt, 'HostSystem')
- if len(hs) != 1:
- logger.error("Expected 1 %s instance returned" % name)
- return FAIL
+ if len(hs) != 1:
+ logger.error("Expected 1 %s instance returned" % name)
+ return FAIL
- system = hs[0]
+ system = hs[0]
- if system.CreationClassName != name or system.Name != host:
- logger.error("Exp %s, got %s" % (name, system.CreationClassName))
- logger.error("Exp %s, got %s" % (host, system.Name))
+ if system.CreationClassName != name or system.Name != host:
+ logger.error("Exp %s, got %s" % (name,
system.CreationClassName))
+ logger.error("Exp %s, got %s" % (host, system.Name))
+ status = FAIL
+ else:
+ logger.info("%s is %s" % (name, host))
+ status = PASS
+
+ except Exception, details:
+ logger.error("%s %s: %s" % (CIM_ERROR_ENUMERATE, name, details))
status = FAIL
- else:
- logger.info("%s is %s" % (name, host))
- status = PASS
-
- except Exception, details:
- logger.error("%s %s: %s" % (CIM_ERROR_ENUMERATE, name, details))
- status = FAIL
return status
diff -r 892ce3fce234 -r 83e6f32be2ae suites/libvirt-cim/lib/XenKvmLib/classes.py
--- a/suites/libvirt-cim/lib/XenKvmLib/classes.py Fri Sep 12 14:35:12 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/classes.py Sun Sep 21 22:54:28 2008 -0700
@@ -23,6 +23,8 @@ virt_types = ['Xen', 'KVM', 'XenFV', 'LX
def get_typed_class(virt, basename):
if virt not in virt_types:
+ if virt == "Linux" and basename == "ComputerSystem":
+ return 'Linux_ComputerSystem'
if virt != "Virt" and basename != "MigrationJob":
raise ValueError('Invalid class type')
diff -r 892ce3fce234 -r 83e6f32be2ae suites/libvirt-cim/lib/XenKvmLib/enumclass.py
--- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Fri Sep 12 14:35:12 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Sun Sep 21 22:54:28 2008 -0700
@@ -68,6 +68,9 @@ class CIM_ComputerSystem(CIM_MyClass):
pass
class CIM_System(CIM_MyClass):
+ pass
+
+class Linux_ComputerSystem(CIM_MyClass):
pass
class CIM_AllocationCapabilities(CIM_MyClass):