# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1225163011 25200
# Node ID 408dbb3a61b43bd0def587a9ea7e648105def002
# Parent 0f340004e1cd48f5ede60a68283a850ae60c9ebe
[TEST] #4 Remove old enumerate and getInstance and update device related tc
Updates from 3 to 4:
Stay changeset 453 of LogicalDisk/03_ld_gi_errs.py
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 0f340004e1cd -r 408dbb3a61b4 suites/libvirt-cim/cimtest/LogicalDisk/01_disk.py
--- a/suites/libvirt-cim/cimtest/LogicalDisk/01_disk.py Fri Oct 24 01:04:38 2008 -0700
+++ b/suites/libvirt-cim/cimtest/LogicalDisk/01_disk.py Mon Oct 27 20:03:31 2008 -0700
@@ -26,7 +26,7 @@
import sys
import pywbem
from VirtLib import utils
-from XenKvmLib import devices
+from XenKvmLib.enumclass import GetInstance
from XenKvmLib.classes import get_typed_class
from XenKvmLib.vxml import XenXML, KVMXML, get_class
from CimTest.Globals import logger
@@ -48,13 +48,13 @@
vsxml.cim_define(options.ip)
devid = "%s/%s" % (test_dom, test_dev)
+ disk = get_typed_class(options.virt, "LogicalDisk")
key_list = { 'DeviceID' : devid,
- 'CreationClassName' : get_typed_class(options.virt,
"LogicalDisk"),
+ 'CreationClassName' : disk,
'SystemName' : test_dom,
'SystemCreationClassName' : get_typed_class(options.virt,
"ComputerSystem")
}
- dev = eval('devices.' + get_typed_class(options.virt,
"LogicalDisk"))(options.ip, key_list)
-
+ dev = GetInstance(options.ip, disk, key_list)
status = 0
if dev.Name != test_dev:
diff -r 0f340004e1cd -r 408dbb3a61b4
suites/libvirt-cim/cimtest/LogicalDisk/03_ld_gi_errs.py
--- a/suites/libvirt-cim/cimtest/LogicalDisk/03_ld_gi_errs.py Fri Oct 24 01:04:38 2008
-0700
+++ b/suites/libvirt-cim/cimtest/LogicalDisk/03_ld_gi_errs.py Mon Oct 27 20:03:31 2008
-0700
@@ -125,7 +125,7 @@
import pywbem
from VirtLib import utils
from XenKvmLib import assoc
-from XenKvmLib import devices
+from XenKvmLib.enumclass import GetInstance
from XenKvmLib.common_util import try_getinstance
from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib.classes import get_typed_class
@@ -198,7 +198,7 @@
'SystemName' : test_dom,
'SystemCreationClassName' : get_typed_class(options.virt,
"ComputerSystem")
}
- disk = eval('devices.' + get_typed_class(options.virt,
"LogicalDisk"))(options.ip, key_list)
+ disk = GetInstance(options.ip, classname, key_list)
except Exception,detail:
logger.error(CIM_ERROR_GETINSTANCE, classname)
logger.error("Exception: %s", detail)
diff -r 0f340004e1cd -r 408dbb3a61b4 suites/libvirt-cim/cimtest/Memory/01_memory.py
--- a/suites/libvirt-cim/cimtest/Memory/01_memory.py Fri Oct 24 01:04:38 2008 -0700
+++ b/suites/libvirt-cim/cimtest/Memory/01_memory.py Mon Oct 27 20:03:31 2008 -0700
@@ -26,7 +26,7 @@
import pywbem
from VirtLib import utils
from VirtLib import live
-from XenKvmLib import devices
+from XenKvmLib.enumclass import GetInstance
from XenKvmLib.classes import get_typed_class
from XenKvmLib.vxml import XenXML, KVMXML, get_class
from CimTest.Globals import logger
@@ -46,12 +46,13 @@
alloc_mem = int(vsxml.xml_get_mem())
devid = "%s/mem" % test_dom
+ mem_class = get_typed_class(options.virt, "Memory")
key_list = { 'DeviceID' : devid,
- 'CreationClassName' : get_typed_class(options.virt,
"Memory"),
+ 'CreationClassName' : mem_class,
'SystemName' : test_dom,
'SystemCreationClassName' : get_typed_class(options.virt,
"ComputerSystem")
}
- dev = eval('devices.' + get_typed_class(options.virt,
"Memory"))(options.ip, key_list)
+ dev = GetInstance(options.ip, mem_class, key_list)
status = 0
diff -r 0f340004e1cd -r 408dbb3a61b4 suites/libvirt-cim/cimtest/NetworkPort/01_netport.py
--- a/suites/libvirt-cim/cimtest/NetworkPort/01_netport.py Fri Oct 24 01:04:38 2008 -0700
+++ b/suites/libvirt-cim/cimtest/NetworkPort/01_netport.py Mon Oct 27 20:03:31 2008 -0700
@@ -33,7 +33,7 @@
import pywbem
from VirtLib import utils
from VirtLib import live
-from XenKvmLib import devices
+from XenKvmLib.enumclass import GetInstance
from XenKvmLib.classes import get_typed_class
from XenKvmLib.vxml import XenXML, KVMXML, get_class
from CimTest.Globals import logger
@@ -67,16 +67,17 @@
vsxml.cim_define(options.ip)
devid = "%s/%s" % (test_dom, test_mac)
+ net_class = get_typed_class(options.virt, "NetworkPort")
key_list = { 'DeviceID' : devid,
- 'CreationClassName' : get_typed_class(options.virt,
"NetworkPort"),
+ 'CreationClassName' : net_class,
'SystemName' : test_dom,
'SystemCreationClassName' : get_typed_class(options.virt,
"ComputerSystem")
}
dev = None
-
+
try:
- dev = eval('devices.' + get_typed_class(options.virt,
"NetworkPort"))(options.ip, key_list)
+ dev = GetInstance(options.ip, net_class, key_list)
except Exception, detail:
logger.error("Exception: %s" % detail)
diff -r 0f340004e1cd -r 408dbb3a61b4
suites/libvirt-cim/cimtest/NetworkPort/03_user_netport.py
--- a/suites/libvirt-cim/cimtest/NetworkPort/03_user_netport.py Fri Oct 24 01:04:38 2008
-0700
+++ b/suites/libvirt-cim/cimtest/NetworkPort/03_user_netport.py Mon Oct 27 20:03:31 2008
-0700
@@ -28,7 +28,7 @@
import sys
import pywbem
from XenKvmLib import const
-from XenKvmLib import devices
+from XenKvmLib.enumclass import GetInstance
from XenKvmLib.vxml import KVMXML
from CimTest.Globals import logger
from XenKvmLib.const import do_main
@@ -57,7 +57,7 @@
dev = None
try:
- dev = devices.KVM_NetworkPort(options.ip, key_list)
+ dev = GetInstance(options.ip, 'KVM_NetworkPort', key_list)
except Exception, detail:
logger.error("Exception: %s" % detail)
cxml.undefine(options.ip)
diff -r 0f340004e1cd -r 408dbb3a61b4 suites/libvirt-cim/cimtest/Processor/01_processor.py
--- a/suites/libvirt-cim/cimtest/Processor/01_processor.py Fri Oct 24 01:04:38 2008 -0700
+++ b/suites/libvirt-cim/cimtest/Processor/01_processor.py Mon Oct 27 20:03:31 2008 -0700
@@ -26,7 +26,7 @@
import pywbem
from VirtLib import utils
from VirtLib import live
-from XenKvmLib import devices
+from XenKvmLib.enumclass import GetInstance
from XenKvmLib.test_xml import testxml
from XenKvmLib.classes import get_typed_class
from XenKvmLib.vxml import XenXML, KVMXML, get_class
@@ -49,6 +49,7 @@
# Processor instance enumerate need the domain to be active
domlist = live.active_domain_list(options.ip, options.virt)
+ proc_class = get_typed_class(options.virt, "Processor")
if test_dom not in domlist:
status = FAIL
logger.error("Domain not started, we're not able to check vcpu")
@@ -56,12 +57,12 @@
for i in range(0, test_vcpus):
devid = "%s/%s" % (test_dom, i)
key_list = { 'DeviceID' : devid,
- 'CreationClassName' : get_typed_class(options.virt,
"Processor"),
+ 'CreationClassName' : proc_class,
'SystemName' : test_dom,
'SystemCreationClassName' :
get_typed_class(options.virt, "ComputerSystem")
}
try:
- dev = eval(('devices.' + get_typed_class(options.virt,
'Processor')))(options.ip, key_list)
+ dev = GetInstance(options.ip, proc_class, key_list)
if dev.DeviceID == devid:
logger.info("Checked device %s" % devid)
else:
diff -r 0f340004e1cd -r 408dbb3a61b4
suites/libvirt-cim/cimtest/SettingsDefine/01_forward.py
--- a/suites/libvirt-cim/cimtest/SettingsDefine/01_forward.py Fri Oct 24 01:04:38 2008
-0700
+++ b/suites/libvirt-cim/cimtest/SettingsDefine/01_forward.py Mon Oct 27 20:03:31 2008
-0700
@@ -30,7 +30,7 @@
from VirtLib import utils
from XenKvmLib import vxml
from XenKvmLib import assoc
-from XenKvmLib import devices
+from XenKvmLib.enumclass import GetInstance
from XenKvmLib.classes import get_typed_class
from CimTest import Globals
from XenKvmLib.const import do_main
@@ -99,8 +99,8 @@
exp_inst_id_val[cn] = key_list['DeviceID']
try:
- dev_class = devices.get_class(get_typed_class(options.virt, cn))
- devlist[cn] = dev_class(options.ip, key_list)
+ dev_class = get_typed_class(options.virt, cn)
+ devlist[cn] = GetInstance(options.ip, dev_class, key_list)
logelelst[cn] = devlist[cn].DeviceID
except Exception, detail:
print_error(cn, detail)
diff -r 0f340004e1cd -r 408dbb3a61b4 suites/libvirt-cim/lib/XenKvmLib/devices.py
--- a/suites/libvirt-cim/lib/XenKvmLib/devices.py Fri Oct 24 01:04:38 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py Mon Oct 27 20:03:31 2008 -0700
@@ -40,63 +40,6 @@
def __str__(self):
print self.inst.items()
-class CIM_LogicalDevice(CIM_Instance):
- def __init__(self, server, keys):
- conn = pywbem.WBEMConnection('http://%s' % server,
- (Globals.CIM_USER, Globals.CIM_PASS),
- Globals.CIM_NS)
-
- try:
- classname = self.__class__.__name__
- ref = CIMInstanceName(classname,
- keybindings=keys)
- inst = conn.GetInstance(ref)
- except pywbem.CIMError, arg:
- raise arg
-
- CIM_Instance.__init__(self, inst)
-
-class CIM_LogicalDisk(CIM_LogicalDevice):
- pass
-
-class CIM_NetworkPort(CIM_LogicalDevice):
- pass
-
-class CIM_Memory(CIM_LogicalDevice):
- pass
-
-class CIM_Processor(CIM_LogicalDevice):
- pass
-
-class Xen_LogicalDisk(CIM_LogicalDisk):
- pass
-
-class KVM_LogicalDisk(CIM_LogicalDisk):
- pass
-
-class LXC_LogicalDisk(CIM_LogicalDisk):
- pass
-
-class Xen_NetworkPort(CIM_NetworkPort):
- pass
-
-class KVM_NetworkPort(CIM_NetworkPort):
- pass
-
-class Xen_Memory(CIM_Memory):
- pass
-
-class KVM_Memory(CIM_Memory):
- pass
-
-class LXC_Memory(CIM_Memory):
- pass
-
-class Xen_Processor(CIM_Processor):
- pass
-
-class KVM_Processor(CIM_Processor):
- pass
def get_class(classname):
return eval(classname)
diff -r 0f340004e1cd -r 408dbb3a61b4 suites/libvirt-cim/lib/XenKvmLib/enumclass.py
--- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Fri Oct 24 01:04:38 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Mon Oct 27 20:03:31 2008 -0700
@@ -30,332 +30,6 @@
from CimTest import Globals, CimExt
from VirtLib import utils
from CimTest.Globals import logger
-
-class CIM_MyClass(CIM_Instance):
- def __init__(self, server, keys):
- conn = pywbem.WBEMConnection('http://%s' % server,
- (Globals.CIM_USER, Globals.CIM_PASS),
- Globals.CIM_NS)
-
- try:
- classname = self.__class__.__name__
- ref = CIMInstanceName(classname,
- keybindings=keys)
- inst = conn.GetInstance(ref)
- except pywbem.CIMError, arg:
- raise arg
-
- self.conn = conn
- self.inst = inst
- self.ref = ref
-
- CIM_Instance.__init__(self, inst)
-
- def __invoke(self, method, params):
- try:
- return self.conn.InvokeMethod(method,
- self.ref,
- **params)
- except pywbem.CIMError, arg:
- print 'InvokeMethod(%s): %s' % (method, arg[1])
- raise
-
- def __getattr__(self, attr):
- if self.inst.has_key(attr):
- return self.inst[attr]
- else:
- return CimExt._Method(self.__invoke, attr)
-
-class Linux_ComputerSystem(CIM_Instance):
- def __init__(self, server, keys):
- conn = pywbem.WBEMConnection('http://%s' % server,
- (Globals.CIM_USER, Globals.CIM_PASS),
- Globals.CIM_NS)
-
- try:
- classname = self.__class__.__name__
- ref = CIMInstanceName(classname,
- keybindings=keys)
- inst = conn.GetInstance(ref)
- except pywbem.CIMError, arg:
- raise arg
-
- CIM_Instance.__init__(self, inst)
-
-
-class CIM_ComputerSystem(CIM_MyClass):
- pass
-
-class CIM_System(CIM_MyClass):
- pass
-
-class CIM_AllocationCapabilities(CIM_MyClass):
- pass
-
-class CIM_RegisteredProfile(CIM_MyClass):
- pass
-
-class CIM_LogicalDevice(CIM_MyClass):
- pass
-
-class CIM_ResourcePool(CIM_MyClass):
- pass
-
-class CIM_VirtualSystemManagementCapabilities(CIM_MyClass):
- pass
-
-class CIM_ResourcePoolConfigurationCapabilities(CIM_MyClass):
- pass
-
-class CIM_EnabledLogicalElementCapabilities(CIM_MyClass):
- pass
-
-class Virt_VirtualSystemMigrationCapabilities(CIM_MyClass):
- pass
-
-class CIM_VirtualSystemMigrationSettingData(CIM_MyClass):
- pass
-
-class CIM_VirtualSystemSnapshotService(CIM_MyClass):
- pass
-
-class CIM_VirtualSystemSnapshotServiceCapabilities(CIM_MyClass):
- pass
-
-class CIM_NetResourceAllocationSettingData(CIM_MyClass):
- pass
-
-class CIM_MemResourceAllocationSettingData(CIM_MyClass):
- pass
-
-class CIM_ProcResourceAllocationSettingData(CIM_MyClass):
- pass
-
-class CIM_DiskResourceAllocationSettingData(CIM_MyClass):
- pass
-
-class Xen_ComputerSystem(CIM_ComputerSystem):
- pass
-
-class KVM_ComputerSystem(CIM_ComputerSystem):
- pass
-
-class LXC_ComputerSystem(CIM_ComputerSystem):
- pass
-
-class Xen_HostSystem(CIM_System):
- pass
-
-class KVM_HostSystem(CIM_System):
- pass
-
-class LXC_HostSystem(CIM_System):
- pass
-
-class Xen_MigrationJob(CIM_MyClass):
- pass
-
-class Xen_RegisteredProfile(CIM_RegisteredProfile):
- pass
-
-class KVM_RegisteredProfile(CIM_RegisteredProfile):
- pass
-
-class LXC_RegisteredProfile(CIM_RegisteredProfile):
- pass
-
-class Xen_VirtualSystemSettingData(CIM_MyClass):
- pass
-
-class KVM_VirtualSystemSettingData(CIM_MyClass):
- pass
-
-class LXC_VirtualSystemSettingData(CIM_MyClass):
- pass
-
-class Xen_LogicalDisk(CIM_LogicalDevice):
- pass
-
-class KVM_LogicalDisk(CIM_LogicalDevice):
- pass
-
-class Xen_Memory(CIM_LogicalDevice):
- pass
-
-class KVM_Memory(CIM_LogicalDevice):
- pass
-
-class LXC_Memory(CIM_LogicalDevice):
- pass
-
-class LXC_Memory(CIM_LogicalDevice):
- pass
-
-class Xen_Processor(CIM_LogicalDevice):
- pass
-
-class KVM_Processor(CIM_LogicalDevice):
- pass
-
-class Xen_NetworkPort(CIM_LogicalDevice):
- pass
-
-class KVM_NetworkPort(CIM_LogicalDevice):
- pass
-
-class Xen_MemoryPool(CIM_ResourcePool):
- pass
-
-class KVM_MemoryPool(CIM_ResourcePool):
- pass
-
-class LXC_MemoryPool(CIM_ResourcePool):
- pass
-
-class Xen_ProcessorPool(CIM_ResourcePool):
- pass
-
-class KVM_ProcessorPool(CIM_ResourcePool):
- pass
-
-class LXC_ProcessorPool(CIM_ResourcePool):
- pass
-
-class Xen_VirtualSystemManagementCapabilities(CIM_VirtualSystemManagementCapabilities):
- pass
-
-class KVM_VirtualSystemManagementCapabilities(CIM_VirtualSystemManagementCapabilities):
- pass
-
-class LXC_VirtualSystemManagementCapabilities(CIM_VirtualSystemManagementCapabilities):
- pass
-
-class
Xen_ResourcePoolConfigurationCapabilities(CIM_ResourcePoolConfigurationCapabilities):
- pass
-
-class
KVM_ResourcePoolConfigurationCapabilities(CIM_ResourcePoolConfigurationCapabilities):
- pass
-
-class
LXC_ResourcePoolConfigurationCapabilities(CIM_ResourcePoolConfigurationCapabilities):
- pass
-
-class Xen_EnabledLogicalElementCapabilities(CIM_EnabledLogicalElementCapabilities):
- pass
-
-class KVM_EnabledLogicalElementCapabilities(CIM_EnabledLogicalElementCapabilities):
- pass
-
-class LXC_EnabledLogicalElementCapabilities(CIM_EnabledLogicalElementCapabilities):
- pass
-
-class Xen_DiskPool(CIM_ResourcePool):
- pass
-
-class KVM_DiskPool(CIM_ResourcePool):
- pass
-
-class LXC_DiskPool(CIM_ResourcePool):
- pass
-
-class Xen_NetworkPool(CIM_ResourcePool):
- pass
-
-class KVM_NetworkPool(CIM_ResourcePool):
- pass
-
-class LXC_NetworkPool(CIM_ResourcePool):
- pass
-
-class Xen_VirtualSystemMigrationCapabilities(Virt_VirtualSystemMigrationCapabilities):
- pass
-
-class KVM_VirtualSystemMigrationCapabilities(Virt_VirtualSystemMigrationCapabilities):
- pass
-
-class LXC_VirtualSystemMigrationCapabilities(Virt_VirtualSystemMigrationCapabilities):
- pass
-
-class Xen_AllocationCapabilities(CIM_AllocationCapabilities):
- pass
-
-class KVM_AllocationCapabilities(CIM_AllocationCapabilities):
- pass
-
-class LXC_AllocationCapabilities(CIM_AllocationCapabilities):
- pass
-
-class Xen_VirtualSystemMigrationSettingData(CIM_VirtualSystemMigrationSettingData):
- pass
-
-class KVM_VirtualSystemMigrationSettingData(CIM_VirtualSystemMigrationSettingData):
- pass
-
-class LXC_VirtualSystemMigrationSettingData(CIM_VirtualSystemMigrationSettingData):
- pass
-
-class Xen_VirtualSystemSnapshotService(CIM_VirtualSystemSnapshotService):
- pass
-
-class KVM_VirtualSystemSnapshotService(CIM_VirtualSystemSnapshotService):
- pass
-
-class LXC_VirtualSystemSnapshotService(CIM_VirtualSystemSnapshotService):
- pass
-
-class
Xen_VirtualSystemSnapshotServiceCapabilities(CIM_VirtualSystemSnapshotServiceCapabilities):
- pass
-
-class
KVM_VirtualSystemSnapshotServiceCapabilities(CIM_VirtualSystemSnapshotServiceCapabilities):
- pass
-
-class
LXC_VirtualSystemSnapshotServiceCapabilities(CIM_VirtualSystemSnapshotServiceCapabilities):
- pass
-
-class Xen_MemResourceAllocationSettingData(CIM_MemResourceAllocationSettingData):
- pass
-
-class KVM_MemResourceAllocationSettingData(CIM_MemResourceAllocationSettingData):
- pass
-
-class LXC_MemResourceAllocationSettingData(CIM_MemResourceAllocationSettingData):
- pass
-
-class Xen_NetResourceAllocationSettingData(CIM_NetResourceAllocationSettingData):
- pass
-
-class KVM_NetResourceAllocationSettingData(CIM_NetResourceAllocationSettingData):
- pass
-
-class Xen_ProcResourceAllocationSettingData(CIM_ProcResourceAllocationSettingData):
- pass
-
-class KVM_ProcResourceAllocationSettingData(CIM_ProcResourceAllocationSettingData):
- pass
-
-class Xen_DiskResourceAllocationSettingData(CIM_DiskResourceAllocationSettingData):
- pass
-
-class KVM_DiskResourceAllocationSettingData(CIM_DiskResourceAllocationSettingData):
- pass
-
-class KVM_VirtualSystemMigrationService(CIM_MyClass):
- pass
-
-class Xen_VirtualSystemMigrationService(CIM_MyClass):
- pass
-
-class LXC_VirtualSystemMigrationService(CIM_MyClass):
- pass
-
-class Xen_VirtualSystemManagementService(CIM_MyClass):
- pass
-
-class KVM_VirtualSystemManagementService(CIM_MyClass):
- pass
-
-class LXC_VirtualSystemManagementService(CIM_MyClass):
- pass
-
class CIM_CimtestClass(CIM_Instance):