# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208241728 -28800
# Node ID 823907d0d5b3c03ff675f9fe116307b5570622b6
# Parent a22ea10d1e46adfcd2e878328c1746b5c618230b
[TEST] Add KVM support for ElementSettingData.01
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r a22ea10d1e46 -r 823907d0d5b3
suites/libvirt-cim/cimtest/ElementSettingData/01_forward.py
--- a/suites/libvirt-cim/cimtest/ElementSettingData/01_forward.py Tue Apr 15 10:25:08 2008
+0800
+++ b/suites/libvirt-cim/cimtest/ElementSettingData/01_forward.py Tue Apr 15 14:42:08 2008
+0800
@@ -51,34 +51,33 @@ from VirtLib import utils
from VirtLib import utils
from XenKvmLib import enumclass
from XenKvmLib import assoc
+from XenKvmLib.classes import get_class_basename
from CimTest import Globals
from CimTest.Globals import do_main
-sup_types = ['Xen']
+sup_types = ['Xen', 'KVM']
+esd_cn = 'ElementSettingData'
+vssd_cn = 'VirtualSystemSettingData'
+vssdc_cn = 'VirtualSystemSettingDataComponent'
+rasd_cn = 'ResourceAllocationSettingData'
-def test_assoc(host, class_name, id):
+def test_assoc(host, class_name, id, virt):
try:
- ret_inst = assoc.AssociatorNames(host,
- "Xen_ElementSettingData",
- class_name,
+ ret_inst = assoc.AssociatorNames(host,esd_cn, class_name, virt,
InstanceID = id)
except Exception:
- Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORS,
- 'Xen_ElementSettingData')
+ Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORS, esd_cn)
return 1
if len(ret_inst) != 1:
- Globals.logger.error("Xen_ElementSettingData returned %i %s
instances",
- len(ret_inst),
- class_name)
+ Globals.logger.error("%s returned %i %s instances", esd_cn,
+ len(ret_inst), class_name)
return 1
ret_id = ret_inst[0].keybindings["InstanceID"]
if ret_id != id:
Globals.logger.error("%s returned %s instance with wrong id %s",
- "Xen_ElementSettingData",
- class_name,
- ret_id)
+ esd_cn, class_name, ret_id)
return 1
return 0;
@@ -90,9 +89,8 @@ def main():
try:
key_list = ["InstanceID"]
- vssd_lst = enumclass.enumerate(options.ip,
- enumclass.Xen_VirtualSystemSettingData,
- key_list)
+ vssd_lst = enumclass.enumerate(options.ip, vssd_cn, key_list,
+ options.virt)
except Exception, details:
Globals.logger.error("Exception %s", details)
@@ -100,40 +98,31 @@ def main():
for vssd in vssd_lst:
- rc = test_assoc(options.ip,
- "Xen_VirtualSystemSettingData",
- vssd.InstanceID)
+ rc = test_assoc(options.ip, vssd_cn, vssd.InstanceID, options.virt)
if rc != 0:
Globals.logger.error("Unable to get associated %s from %s",
- "Xen_VirtualSystemSettingData",
- "Xen_ElementSettingData")
+ vssd_cn, esd_cn)
return 1
try:
- rasd_list = assoc.Associators(options.ip,
-
"Xen_VirtualSystemSettingDataComponent",
- "Xen_VirtualSystemSettingData",
- InstanceID = vssd.InstanceID)
+ rasd_list = assoc.Associators(options.ip, vssdc_cn, vssd_cn,
+ options.virt,
+ InstanceID = vssd.InstanceID)
except Exception:
- Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORS,
- 'Xen_VirtualSystemSettingDataComponent')
+ Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORS, vssdc_cn)
return 1
if len(rasd_list) == 0:
- Globals.logger.error("%s returned %i %s instances",
- "Xen_ElementSettingData",
- len(rasd_list),
- "Xen_VirtualSystemSettingData")
+ Globals.logger.error("%s returned %i %s instances", esd_cn,
+ len(rasd_list), vssd_cn)
return 1
for rasd in rasd_list:
- rc = test_assoc(options.ip,
- rasd.classname,
- rasd["InstanceID"])
+ rc = test_assoc(options.ip, get_class_basename(rasd.classname),
+ rasd["InstanceID"], options.virt)
if rc != 0:
Globals.logger.error("Unable to get associated %s from %s",
- "Xen_ResourceAllocationSettingData",
- "Xen_ElementSettingData")
+ rasd_cn, esd_cn)
return 1
return 0