
# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1217331585 25200 # Node ID ec303feee0e302ddf29b8dad81d0d4416e0fb48a # Parent f2f1c1899247df3a68d885a73bbfbb989a6e7941 changes in vsms.py ------------------ 1) Added mvirtquantity to be passed for MemRASD. 2) Set the default mvirtquantity to 1024 units since this is the mininmum value that is req for KVM. 3) Added mem_allocunit param to default_vssd_rasd_str() to pass the AllocationUnits. The above changes are required to be able to start KVM guest using DefineSystem(). changes in 40_RSC_start.py -------------------------- 1) Used poll_for_state_change() to verify the poll and verify the EnabledState value. 2) Removed the invalid bug nos. 3) Removed check_attributes() and used check_reqstate_value() library function instead. 4) Adding create_netpool_conf(), destroy_netpool() since the VSMS now requires networkpool. 5) Used destroy_and_undefine_domain() to undefine and destroy the VS. The changes are verified with KVM Xen, XenFV with current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r f2f1c1899247 -r ec303feee0e3 suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py --- a/suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py Tue Jul 29 04:23:52 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py Tue Jul 29 04:39:45 2008 -0700 @@ -36,60 +36,49 @@ import sys import pywbem from VirtLib import utils -from XenKvmLib.test_doms import undefine_test_domain +from XenKvmLib.test_doms import destroy_and_undefine_domain from XenKvmLib.common_util import * from CimTest.Globals import logger from CimTest.Globals import do_main -from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC +from CimTest.ReturnCodes import PASS, FAIL sup_types = ['Xen', 'KVM', 'XenFV'] -bug = "00001" -bug_req_state = "00002" -default_dom = 'test_domain' +default_dom = 'cs_test_domain' REQUESTED_STATE = 2 TIME = "00000000000000.000000:000" - -def check_attributes(domain_name, ip, virt): - rc, cs = get_cs_instance(domain_name, ip, virt) - if rc != 0: - return rc - - if cs.RequestedState != REQUESTED_STATE: - logger.error("RequestedState should be %d not %d", - REQUESTED_STATE, cs.RequestedState) - return FAIL - - if cs.EnabledState != REQUESTED_STATE: - logger.error("EnabledState should be %d not %d", - REQUESTED_STATE, cs.EnabledState) - return FAIL - - return PASS @do_main(sup_types) def main(): options = main.options + server = options.ip + virt = options.virt status = FAIL + status, test_network = create_netpool_conf(server, virt, False) + if status != PASS: + return FAIL + try: - rc = create_using_definesystem(default_dom, options.ip, - virt=options.virt) + rc = create_using_definesystem(default_dom, server, + virt=virt) if rc != 0: - raise Exception("DefineSystem() failed to create domain: %s" % + raise Exception("DefineSystem() failed to create domain: '%s'" % default_dom) - rc = call_request_state_change(default_dom, options.ip, - REQUESTED_STATE, TIME, options.virt) + rc = call_request_state_change(default_dom, server, + REQUESTED_STATE, TIME, virt) if rc != 0: - status = XFAIL_RC(bug) + status = FAIL raise Exception("RequestedStateChange() could not be used to start" " domain: '%s'" % default_dom) + status = poll_for_state_change(server, virt, default_dom, + REQUESTED_STATE, timeout=10) - rc = check_attributes(default_dom, options.ip, options.virt) - if rc != 0: - status = XFAIL_RC(bug_req_state) + rc = check_reqstate_value(default_dom, server, REQUESTED_STATE, virt) + if rc != PASS or status != PASS: + status = FAIL raise Exception("Attributes were not set as expected for " "domain: '%s'" % default_dom) else: @@ -98,8 +87,8 @@ except Exception, detail: logger.error("Exception: %s", detail) - undefine_test_domain(default_dom, options.ip, options.virt) - + destroy_netpool(server, virt, test_network) + destroy_and_undefine_domain(default_dom, server, virt) return status if __name__ == "__main__": diff -r f2f1c1899247 -r ec303feee0e3 suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Tue Jul 29 04:23:52 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Tue Jul 29 04:39:45 2008 -0700 @@ -203,11 +203,14 @@ pass class CIM_MemResourceAllocationSettingData(CIMClassMOF): - def __init__(self, megabytes, name): + def __init__(self, mvirtquantity, mallocunits, name): self.ResourceType = RASD_TYPE_MEM - if megabytes != None: - self.VirtualQuantity = megabytes + if mvirtquantity != None: + self.VirtualQuantity = mvirtquantity + + if mallocunits != None: + self.AllocationUnits = mallocunits if name != None: self.InstanceID = '%s/mem' % name @@ -231,7 +234,8 @@ net_type='ethernet', net_mac=const.Xen_default_mac, proc_vcpu=1, - mem_mb=512, + mem_val=1024, + mem_allocunit="KiloBytes", virt='Xen'): class_vssd = get_vssd_class(virt) vssd = class_vssd(name=dom_name, virt=virt) @@ -257,7 +261,8 @@ class_masd = get_masd_class(virt) m = class_masd( - megabytes=mem_mb, + mvirtquantity=mem_val, + mallocunits=mem_allocunit, name=dom_name) if virt == 'LXC': return vssd.mof(), [d.mof(), m.mof()]