[PATCH] [TEST] Remove old enumerate* and getInstance in enumclass.py and device.py

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1224470389 25200 # Node ID b87d80615bb3765161d2295e3cefc14c4152fdf2 # Parent a3d9c0a81c27471418993b7c8f907f0b95f79e63 [TEST] Remove old enumerate* and getInstance in enumclass.py and device.py Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r a3d9c0a81c27 -r b87d80615bb3 suites/libvirt-cim/lib/XenKvmLib/devices.py --- a/suites/libvirt-cim/lib/XenKvmLib/devices.py Wed Oct 15 19:13:10 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py Sun Oct 19 19:39:49 2008 -0700 @@ -101,36 +101,6 @@ def get_class(classname): def get_class(classname): return eval(classname) -def enumerate(server, basetype, keys, virt='Xen'): - conn = pywbem.WBEMConnection('http://%s' % server, - (Globals.CIM_USER, Globals.CIM_PASS), - Globals.CIM_NS) - - list = [] - - #FIXME - Remove once all tests are converted for KVM - basetype = basetype.split('_', 1)[-1] - - devtype = eval(get_typed_class(virt, basetype)) - try: - names = conn.EnumerateInstanceNames(devtype.__name__) - except pywbem.CIMError, arg: - raise Exception("%s" % arg[1]) - return list - - for name in names: - key_list = {} - for item in keys: - key_list[item] = name.keybindings[item] - - if len(key_list) == 0: - return list - - list.append(devtype(server, key_list)) - - return list - - def device_of(server, key_list): t = eval(key_list["CreationClassName"]) diff -r a3d9c0a81c27 -r b87d80615bb3 suites/libvirt-cim/lib/XenKvmLib/enumclass.py --- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Wed Oct 15 19:13:10 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Sun Oct 19 19:39:49 2008 -0700 @@ -363,69 +363,6 @@ class LXC_VirtualSystemManagementService # ex: Xen_RegisteredProfile # keyname = The keyvalue # ex: InstanceID in case of Xen_RegisteredProfile -def enumerate_inst(server, classname, virt="Xen"): - classname = "%s" % classname - new_classname = classname.split('_') - if len(new_classname) == 2: - classname = new_classname[1] - classname = eval(get_typed_class(virt, classname)) - instances = [] - conn = pywbem.WBEMConnection('http://%s' % server, - (Globals.CIM_USER, Globals.CIM_PASS), - Globals.CIM_NS) - - try: - instances = conn.EnumerateInstances(classname.__name__) - except pywbem.CIMError, arg: - print arg[1] - return [] - - return instances - -def enumerate(server, basename, keys, virt="Xen"): - #FIXME - Remove once all tests are converted for KVM - basename = "%s" % basename - new_base = basename.split('_') - if len(new_base) == 2: - basename = new_base[1] - - classname = eval(get_typed_class(virt, basename)) - instances = enumerate_inst(server, classname, virt) - - list = [] - - for instance in instances: - key_list = {} - for item in keys: - key_list[item] = instance[item] - - if len(key_list) == 0: - return list - - list.append(classname(server, key_list)) - - return list - -def getInstance(server, basename, keys, virt="Xen"): - conn = pywbem.WBEMConnection('http://%s' % server, - (Globals.CIM_USER, Globals.CIM_PASS), - Globals.CIM_NS) - - #FIXME - Remove once all tests are converted for KVM - basename = "%s" % basename - new_base = basename.split('_') - if len(new_base) == 2: - basename = new_base[1] - - classname = eval(get_typed_class(virt, basename)) - try: - inst = classname(server, keys) - - except pywbem.CIMError, arg: - print arg[1] - return None - - return inst class CIM_CimtestClass(CIM_Instance): def __init__(self, host, ref):

+1 for me. Did you try to run the tc in the batch mode and verify if all the affected tc have been changed. Thanks and Regards, Deepti. yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1224470389 25200 # Node ID b87d80615bb3765161d2295e3cefc14c4152fdf2 # Parent a3d9c0a81c27471418993b7c8f907f0b95f79e63 [TEST] Remove old enumerate* and getInstance in enumclass.py and device.py
Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>
diff -r a3d9c0a81c27 -r b87d80615bb3 suites/libvirt-cim/lib/XenKvmLib/devices.py --- a/suites/libvirt-cim/lib/XenKvmLib/devices.py Wed Oct 15 19:13:10 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py Sun Oct 19 19:39:49 2008 -0700 @@ -101,36 +101,6 @@ def get_class(classname): def get_class(classname): return eval(classname)
-def enumerate(server, basetype, keys, virt='Xen'): - conn = pywbem.WBEMConnection('http://%s' % server, - (Globals.CIM_USER, Globals.CIM_PASS), - Globals.CIM_NS) - - list = [] - - #FIXME - Remove once all tests are converted for KVM - basetype = basetype.split('_', 1)[-1] - - devtype = eval(get_typed_class(virt, basetype)) - try: - names = conn.EnumerateInstanceNames(devtype.__name__) - except pywbem.CIMError, arg: - raise Exception("%s" % arg[1]) - return list - - for name in names: - key_list = {} - for item in keys: - key_list[item] = name.keybindings[item] - - if len(key_list) == 0: - return list - - list.append(devtype(server, key_list)) - - return list - - def device_of(server, key_list): t = eval(key_list["CreationClassName"])
diff -r a3d9c0a81c27 -r b87d80615bb3 suites/libvirt-cim/lib/XenKvmLib/enumclass.py --- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Wed Oct 15 19:13:10 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Sun Oct 19 19:39:49 2008 -0700 @@ -363,69 +363,6 @@ class LXC_VirtualSystemManagementService # ex: Xen_RegisteredProfile # keyname = The keyvalue # ex: InstanceID in case of Xen_RegisteredProfile -def enumerate_inst(server, classname, virt="Xen"): - classname = "%s" % classname - new_classname = classname.split('_') - if len(new_classname) == 2: - classname = new_classname[1] - classname = eval(get_typed_class(virt, classname)) - instances = [] - conn = pywbem.WBEMConnection('http://%s' % server, - (Globals.CIM_USER, Globals.CIM_PASS), - Globals.CIM_NS) - - try: - instances = conn.EnumerateInstances(classname.__name__) - except pywbem.CIMError, arg: - print arg[1] - return [] - - return instances - -def enumerate(server, basename, keys, virt="Xen"): - #FIXME - Remove once all tests are converted for KVM - basename = "%s" % basename - new_base = basename.split('_') - if len(new_base) == 2: - basename = new_base[1] - - classname = eval(get_typed_class(virt, basename)) - instances = enumerate_inst(server, classname, virt) - - list = [] - - for instance in instances: - key_list = {} - for item in keys: - key_list[item] = instance[item] - - if len(key_list) == 0: - return list - - list.append(classname(server, key_list)) - - return list - -def getInstance(server, basename, keys, virt="Xen"): - conn = pywbem.WBEMConnection('http://%s' % server, - (Globals.CIM_USER, Globals.CIM_PASS), - Globals.CIM_NS) - - #FIXME - Remove once all tests are converted for KVM - basename = "%s" % basename - new_base = basename.split('_') - if len(new_base) == 2: - basename = new_base[1] - - classname = eval(get_typed_class(virt, basename)) - try: - inst = classname(server, keys) - - except pywbem.CIMError, arg: - print arg[1] - return None - - return inst
class CIM_CimtestClass(CIM_Instance): def __init__(self, host, ref):
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1224470389 25200 # Node ID b87d80615bb3765161d2295e3cefc14c4152fdf2 # Parent a3d9c0a81c27471418993b7c8f907f0b95f79e63 [TEST] Remove old enumerate* and getInstance in enumclass.py and device.py
Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>
When I attempt to run the test suite with this patch applied, I get the following error: Traceback (most recent call last): File "main.py", line 40, in <module> from XenKvmLib.common_util import create_netpool_conf, destroy_netpool, \ File "./lib/XenKvmLib/common_util.py", line 41, in <module> from XenKvmLib.enumclass import getInstance ImportError: cannot import name getInstance Also, you'll want to remove the following from enumclass.py: CIM_MyClass Linux_ComputerSystem All other CIM_* class definitions From devices.py, you'll want to remove: CIM_Instance CIM_LogicalDevice All of the other CIM_* class definitions get_class() definition Be sure to run cimtest to make sure none of the tests fail after these pieces are removed. Thanks! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (3)
-
Deepti B Kalakeri
-
Kaitlin Rupert
-
yunguol@cn.ibm.com