# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216706533 25200
# Node ID e32675a6d5ca7d92d0ebcd826dbf1332c3b6690f
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] #3 Update VSSDC.01 for KVM/XenFV/LXC support
The test defines non-bootloader guests for all platform types, also remove the
part of thet test that verifies the bootloader
Updates from 2 to 3:
Remove build_vssd_info() and call compare_all_prop() in assoc_values()
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 3703b7be5a10 -r e32675a6d5ca
suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py Wed Jul
16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py Mon Jul
21 23:02:13 2008 -0700
@@ -52,32 +52,31 @@
import sys
from XenKvmLib import enumclass
from VirtLib import utils
-from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
-from XenKvmLib.test_xml import testxml_bl
-from XenKvmLib.test_xml import xml_get_dom_bootloader
+from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib.assoc import compare_all_prop
from CimTest import Globals
from XenKvmLib import assoc
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, do_main
from CimTest.ReturnCodes import FAIL, PASS
-sup_types = ['Xen']
+sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "VSSDC_dom"
test_vcpus = 2
test_mac = "00:11:22:33:44:aa"
test_disk = 'xvda'
-status = 0
-VSType = "Xen"
-def init_list():
+def init_list(test_disk, test_mac, virt='Xen'):
"""
Creating the lists that will be used for comparisons.
"""
- rlist = ['Xen_DiskResourceAllocationSettingData',
- 'Xen_MemResourceAllocationSettingData',
- 'Xen_NetResourceAllocationSettingData',
- 'Xen_ProcResourceAllocationSettingData'
+ rlist = [get_typed_class(virt, 'DiskResourceAllocationSettingData'),
+ get_typed_class(virt, 'MemResourceAllocationSettingData'),
+ get_typed_class(virt, 'NetResourceAllocationSettingData'),
+ get_typed_class(virt, 'ProcResourceAllocationSettingData')
]
prop_list = {rlist[0] : "%s/%s" % (test_dom, test_disk),
@@ -85,32 +84,13 @@
rlist[2] : "%s/%s" % (test_dom, test_mac),
rlist[3] : "%s/%s" % (test_dom, "proc")
}
+ if virt == 'LXC':
+ rlist = [get_typed_class(virt, 'MemResourceAllocationSettingData')]
+ prop_list = {rlist[0] : "%s/%s" % (test_dom, "mem")}
return prop_list
-def build_vssd_info(ip, vssd):
- """
- Creating the vssd fileds lists that will be used for comparisons.
- """
-
- if vssd.Bootloader == "" or vssd.Caption == "" or \
- vssd.InstanceID == "" or vssd.ElementName == "" or \
- vssd.VirtualSystemIdentifier == "" or vssd.VirtualSystemType ==
"":
- logger.error("One of the required VSSD details seems to be empty")
- test_domain_function(test_dom, ip, "undefine")
- return FAIL
-
- vssd_vals = {'Bootloader' : vssd.Bootloader,
- 'Caption' : vssd.Caption,
- 'InstanceID' : vssd.InstanceID,
- 'ElementName' : vssd.ElementName,
- 'VirtualSystemIdentifier' : vssd.VirtualSystemIdentifier,
- 'VirtualSystemType' : vssd.VirtualSystemType
- }
-
- return vssd_vals
-
-def assoc_values(ip, assoc_info, cn, an, vals):
+def assoc_values(ip, assoc_info, cn, an, vssd):
"""
The association info of
Xen_VirtualSystemSettingDataComponent with every RASDclass is
@@ -124,15 +104,8 @@
Globals.logger.error("%s returned %i resource objects for
'%s'" % \
(an, len(assoc_info), cn))
return FAIL
-
- for prop, val in vals.iteritems():
- if assoc_info[0][prop] != val:
- Globals.logger.error("%s mismatch: returned %s instead of %s"
%\
- (prop, assoc_info[0][prop], val))
- return FAIL
-
- return PASS
-
+ status = compare_all_prop(assoc_info[0], vssd)
+ return status
except Exception, detail :
logger.error("Exception in assoc_values function: %s" % detail)
return FAIL
@@ -143,49 +116,53 @@
status = FAIL
destroy_and_undefine_all(options.ip)
- test_xml = testxml_bl(test_dom, vcpus = test_vcpus, \
- mac = test_mac, disk = test_disk, \
- server = options.ip,\
- gtype = 0)
- ret = test_domain_function(test_xml, options.ip, cmd = "define")
+ prop_list = init_list(test_disk, test_mac, options.virt)
+ virt_xml = vxml.get_class(options.virt)
+ if options.virt == 'LXC':
+ cxml = virt_xml(test_dom)
+ else:
+ cxml = virt_xml(test_dom, vcpus = test_vcpus, \
+ mac = test_mac, disk = test_disk)
+ ret = cxml.define(options.ip)
if not ret:
logger.error("Failed to define the dom: %s", test_dom)
return FAIL
- instIdval = "%s:%s" % (VSType, test_dom)
+ if options.virt == 'XenFV':
+ instIdval = "Xen:%s" % test_dom
+ else:
+ instIdval = "%s:%s" % (options.virt, test_dom)
+
keyname = "InstanceID"
+ key_list = { 'InstanceID' : instIdval }
+ vssd_cn = get_typed_class(options.virt, 'VirtualSystemSettingData')
- key_list = { 'InstanceID' : instIdval }
try:
vssd = enumclass.getInstance(options.ip, \
- enumclass.Xen_VirtualSystemSettingData, \
- key_list)
+ 'VirtualSystemSettingData', \
+ key_list, \
+ options.virt)
if vssd is None:
logger.error("VSSD instance for %s not found" % test_dom)
- test_domain_function(test_dom, options.ip, "undefine")
+ cxml.undefine(options.ip)
return FAIL
-
- vssd_vals = build_vssd_info(options.ip, vssd)
-
except Exception, detail :
- logger.error(Globals.CIM_ERROR_GETINSTANCE, \
- 'Xen_VirtualSystemSettingData')
+ logger.error(Globals.CIM_ERROR_GETINSTANCE, vssd_cn)
logger.error("Exception : %s" % detail)
- test_domain_function(test_dom, options.ip, "undefine")
+ cxml.undefine(options.ip)
return FAIL
- prop_list = init_list()
try:
# Looping through the RASD_cllist, call association
# Xen_VirtualSystemSettingDataComponent with each class in RASD_cllist
- an = 'Xen_VirtualSystemSettingDataComponent'
+ an = get_typed_class(options.virt, 'VirtualSystemSettingDataComponent')
for rasd_cname, prop in prop_list.iteritems():
assoc_info = assoc.Associators(options.ip, an, rasd_cname,
- InstanceID = prop)
+ options.virt, InstanceID = prop)
# Verify the association fields returned for particular rasd_cname.
status = assoc_values(options.ip, assoc_info, rasd_cname, an,
- vssd_vals)
+ vssd)
if status != PASS:
break
@@ -194,7 +171,7 @@
logger.error("Exception : %s" % detail)
status = FAIL
- test_domain_function(test_dom, options.ip, "undefine")
+ cxml.undefine(options.ip)
return status
if __name__ == "__main__":