# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208488335 -28800
# Node ID a2306ae3ec7d442913108f7073ab07c6b92579f8
# Parent c1d9b3ba06ca4c76fe9b1cf63a77a7f92bb01d22
[TEST] add VirtualSystemSettingDataComponent/02_reverse.py.02 for XenFV & KVM support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r c1d9b3ba06ca -r a2306ae3ec7d
suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py Thu Apr
17 10:12:46 2008 +0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py Fri Apr
18 11:12:15 2008 +0800
@@ -47,28 +47,25 @@
import sys
from XenKvmLib import enumclass
from VirtLib import utils
-from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
-from XenKvmLib import test_xml
-from XenKvmLib.test_xml import testxml
+from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
from CimTest import Globals
from XenKvmLib import assoc
from XenKvmLib.rasd import InstId_err
from CimTest.Globals import log_param, logger, do_main
from CimTest.ReturnCodes import PASS, FAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
test_dom = "VSSDC_dom"
test_vcpus = 1
test_mem = 128
test_mac = "00:11:22:33:44:aa"
-test_disk = 'xvdb'
-VSType = "Xen"
def check_rasd_values(id, exp_id):
try:
if id != exp_id:
- InstId_err(assoc_info[i], rasd_list['proc_rasd'])
return FAIL
except Exception, detail :
@@ -77,7 +74,7 @@
return PASS
-def assoc_values(ip, assoc_info):
+def assoc_values(ip, assoc_info, virt="Xen"):
"""
The association info of
Xen_VirtualSystemSettingDataComponent is
@@ -94,28 +91,28 @@
if len(assoc_info) <= 0:
logger.error("No RASD instances returned")
return FAIL
+
+ proc_cn = get_typed_class(virt, 'ProcResourceAllocationSettingData')
+ net_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
+ disk_cn = get_typed_class(virt, 'DiskResourceAllocationSettingData')
+ mem_cn = get_typed_class(virt, 'MemResourceAllocationSettingData')
for inst in assoc_info:
- if inst.classname == 'Xen_ProcResourceAllocationSettingData':
+ if inst.classname == proc_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['proc_rasd'])
- elif inst.classname == 'Xen_NetResourceAllocationSettingData':
+ elif inst.classname == net_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['net_rasd'])
- elif inst.classname == 'Xen_DiskResourceAllocationSettingData':
+ elif inst.classname == disk_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['disk_rasd'])
- elif inst.classname == 'Xen_MemResourceAllocationSettingData':
+ elif inst.classname == mem_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['mem_rasd'])
else:
logger.error("Unexpected RASD instance type" )
status = FAIL
-
- if status != FAIL:
- logger.error("Mistmatching association value" )
- break
-
except Exception, detail :
logger.error("Exception in assoc_values function: %s" % detail)
status = FAIL
@@ -129,32 +126,40 @@
log_param()
destroy_and_undefine_all(options.ip)
- test_xml1 = testxml(test_dom, mem = test_mem, \
- vcpus = test_vcpus, \
- mac = test_mac, \
- disk = test_disk)
- ret = test_domain_function(test_xml1, options.ip, cmd = "create")
+ global test_disk
+ if options.virt == "Xen":
+ test_disk = "xvdb"
+ else:
+ test_disk = "hdb"
+ virt_xml = vxml.get_class(options.virt)
+ cxml = virt_xml(test_dom, vcpus = test_vcpus, mac = test_mac, disk = test_disk)
+ ret = cxml.create(options.ip)
if not ret:
- logger.error("Failed to create the dom: %s", test_dom)
- status = FAIL
- return status
+ logger.error('Unable to create domain %s' % test_dom)
+ return FAIL
+ if options.virt == "Xen" or options.virt == "XenFV":
+ instIdval = "Xen:%s" % test_dom
+ else:
+ instIdval = "KVM:%s" % test_dom
- instIdval = "%s:%s" % (VSType, test_dom)
try:
assoc_info = assoc.AssociatorNames(options.ip,
- 'Xen_VirtualSystemSettingDataComponent',
- 'Xen_VirtualSystemSettingData',
- InstanceID = instIdval)
- status = assoc_values(options.ip, assoc_info)
+ 'VirtualSystemSettingDataComponent',
+ 'VirtualSystemSettingData',
+ options.virt,
+ InstanceID = instIdval)
+ status = assoc_values(options.ip, assoc_info, options.virt)
except Exception, detail :
logger.error(Globals.CIM_ERROR_ASSOCIATORS,
- 'Xen_VirtualSystemSettingDataComponent')
+ 'VirtualSystemSettingDataComponent')
logger.error("Exception : %s" % detail)
status = FAIL
- test_domain_function(test_dom, options.ip, "destroy")
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
+
return status
if __name__ == "__main__":