# HG changeset patch
# User Guolian Yun <yunguol(a)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(a)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):