# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212425305 25200
# Node ID c43fd555c6f3d6e1ce67004aa6a5fc297631c94d
# Parent 76b7fc25cf2ed76481c002c8d3fef1e2e4c6effa
[TEST] Modify VSMS 06 to support both a defined and running guest.
These changes also include:
-Move the AddResource() calls to vsms_util.
-Add support for adding memory resources.
-Add logic so that test only adds mem/proc resources to a defined guest.
-Add logic so the test doesn't add a disk ro a running KVM guest (KVM only supports
attaching CD type devices, another test case is needed for this).
This test currently fails on KVM due to an issue adding network - will follow up on this.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 76b7fc25cf2e -r c43fd555c6f3
suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py Mon Jun
02 09:42:13 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py Mon Jun
02 09:48:25 2008 -0700
@@ -31,11 +31,13 @@
from CimTest.Globals import logger
from CimTest.Globals import do_main
from CimTest.ReturnCodes import FAIL, PASS
+from XenKvmLib import vsms_util
sup_types = ['Xen', 'KVM']
default_dom = 'rstest_domain'
nnmac = '99:aa:bb:cc:ee:ff'
npvcpu = 2
+nmem = 256
@do_main(sup_types)
def main():
@@ -49,8 +51,9 @@
service = vsms.get_vsms_class(options.virt)(options.ip)
cxml = vxml.get_class(options.virt)(default_dom)
classname = get_typed_class(options.virt, 'VirtualSystemSettingData')
+ inst_id = '%s:%s' % (options.virt, default_dom)
vssd_ref = CIMInstanceName(classname, keybindings = {
- 'InstanceID' : '%s:%s' % (options.virt,
default_dom),
+ 'InstanceID' : inst_id,
'CreationClassName' : classname})
dasd = vsms.get_dasd_class(options.virt)(dev=nddev,
source=cxml.secondary_disk_path,
@@ -58,41 +61,48 @@
nasd = vsms.get_nasd_class(options.virt)(type='ethernet', mac=nnmac,
name=default_dom)
pasd = vsms.get_pasd_class(options.virt)(vcpu=npvcpu, name=default_dom)
+ masd = vsms.get_masd_class(options.virt)(megabytes=nmem, name=default_dom)
status = FAIL
- try:
- cxml.define(options.ip)
- # Add disk resource setting
- service.AddResourceSettings(AffectedConfiguration=vssd_ref,
- ResourceSettings=[str(dasd)])
- cxml.dumpxml(options.ip)
- disk_dev = cxml.get_value_xpath(
- '/domain/devices/disk/target/@dev[. = "%s"]' %
nddev)
- if disk_dev != nddev:
- raise Exception('Error adding rs for disk_dev')
- logger.info('good status for disk_dev')
- # Add net resource setting
- service.AddResourceSettings(AffectedConfiguration=vssd_ref,
- ResourceSettings=[str(nasd)])
- cxml.dumpxml(options.ip)
- net_mac = cxml.get_value_xpath(
- '/domain/devices/interface/mac/@address[. = "%s"]'
% nnmac)
- if net_mac.lower() != nnmac:
- raise Exception('Error adding rs for net_mac')
- logger.info('good status for net_mac')
- # Add processor resource setting
- service.AddResourceSettings(AffectedConfiguration=vssd_ref,
- ResourceSettings=[str(pasd)])
- cxml.dumpxml(options.ip)
- proc_vcpu = cxml.xml_get_vcpu()
- if int(proc_vcpu) != int(npvcpu):
- raise Exception('Error adding rs for proc_vcpu')
- logger.info('good status for proc_vcpu')
- status = PASS
- except Exception, details:
- logger.error('Error invoking AddRS')
- logger.error(details)
+ test_cases = ["define", "start"]
+
+ for case in test_cases:
+ if case == "define":
+ ret = cxml.define(options.ip)
+ if not ret:
+ logger.error("Failed to define the dom: %s", default_dom)
+ return FAIL
+ else:
+ ret = cxml.start(options.ip)
+ if not ret:
+ cxml.undefine(options.ip)
+ logger.error("Failed to start the dom: %s", default_dom)
+ return FAIL
+
+ if case == "define" or options.virt == "Xen" or options.virt
== "XenFV":
+ status = vsms_util.add_disk_res(options.ip, service, cxml, vssd_ref,
+ dasd, nddev)
+ if status != PASS:
+ break
+
+ status = vsms_util.add_net_res(options.ip, service, cxml, vssd_ref,
+ nasd, nnmac)
+ if status != PASS:
+ break
+
+ if case == "define":
+ status = vsms_util.add_proc_res(options.ip, service, cxml, vssd_ref,
+ pasd, npvcpu)
+ if status != PASS:
+ break
+
+ status = vsms_util.add_mem_res(options.ip, service, cxml, vssd_ref,
+ masd, nmem)
+ if status != PASS:
+ break
+
+ cxml.destroy(options.ip)
cxml.undefine(options.ip)
return status