[Libvirt-cim] [PATCH 3 of 3] [TEST] Fix VSMS 08_modifyresource.py on Xen and KVM

Deepti B Kalakeri deeptik at linux.vnet.ibm.com
Mon Jun 16 16:25:01 UTC 2008



Deepti B Kalakeri wrote:
>
>
> Kaitlin Rupert wrote:
>> # HG changeset patch
>> # User Kaitlin Rupert <karupert at us.ibm.com>
>> # Date 1213154736 25200
>> # Node ID 9f168dca6251330adcb158f6b64fea51ee72d45e
>> # Parent  c6fdcb5088bbe504097625265a0d8fc0c4ed73c9
>> [TEST] Fix VSMS 08_modifyresource.py on Xen and KVM.
>>
>> This still fails on XenFV because of a provider bug.  It looks like 
>> the ModifyResource call strips the <emulator> tag from a XenFV 
>> guest.  So the test is unable to start the guest.
>>   
> The tc failed on KVM and Xen machine with latest sources [ REV: 611 ] 
> with the following error:
> VirtualSystemManagementService - 08_modifyresource.py: FAIL
> ERROR   - Error invoking ModifyRS
> ERROR   - (1, u"CIM_ERR_FAILED: Device `0' not found")
> ERROR   - Failed to destroy Virtual Network 'default-net17'
> InvokeMethod(ModifyResourceSettings): CIM_ERR_FAILED: Device `0' not 
> found
>
> The debug o/p shows that the tc is failing with :
>
> device_parsing.c(257): Disk node: disk
> Virt_VirtualSystemManagementService.c(1192): Resource transform 
> function failed
Sorry, This error does not occur when the Patch " Fix proc InstanceID in 
vsms.py" is applied.
>
>> Updates to this test:
>>   -Call create_netpool_conf() to create a new network pool to use in 
>> modify calls.
>>   -Create network RASD instead of bridge
>>   -Replaced modify calls with functions from vsms_util
>>   -Added support for modifying a running guest (mem and vcpu only)
>>   -Remove XFAIL
>>
>> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
>>
>> diff -r c6fdcb5088bb -r 9f168dca6251 
>> suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py 
>>
>> --- 
>> a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py    
>> Tue Jun 10 18:26:16 2008 -0700
>> +++ 
>> b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py    
>> Tue Jun 10 20:25:36 2008 -0700
>> @@ -26,19 +26,25 @@
>>  import pywbem
>>  from pywbem.cim_obj import CIMInstanceName
>>  from VirtLib import utils
>> +from VirtLib.live import network_by_bridge
>>  from XenKvmLib import vsms
>>  from XenKvmLib import vxml
>>  from CimTest.Globals import logger
>>  from CimTest.Globals import do_main
>>  from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
>>   
> XFAIL_RC can also be removed.
>> +from XenKvmLib.common_util import create_netpool_conf, destroy_netpool
>> +from XenKvmLib import vsms_util
>>
>>  sup_types = ['Xen', 'KVM', 'XenFV']
>>  default_dom = 'rstest_domain'
>> -ntype = 'bridge'
>> +ntype = 'network'
>>  ncpu = 3
>>  nmem = 78
>>
>> -bug_cpu = '90079'
>> +def cleanup_env(ip, virt, cxml, net_name):
>> +    destroy_netpool(ip, virt, net_name)
>> +    cxml.destroy(ip)
>> +    cxml.undefine(ip)
>>
>>  @do_main(sup_types)
>>  def main():
>> @@ -50,54 +56,65 @@
>>      dasd = 
>> vsms.get_dasd_class(options.virt)(dev=cxml.xml_get_disk_dev(),
>>                                               source=ndpath, 
>>                                               name=default_dom)
>> +    +    status, net_name = create_netpool_conf(options.ip, 
>> options.virt, +                                           
>> use_existing=False)
>> +    if status != PASS:
>> +        logger.error('Unable to create network pool')
>>   
> logger.error('Unable to find a network pool') would be more appropriate ?
>> +        return FAIL +
>>      nasd = vsms.get_nasd_class(options.virt)(type=ntype, 
>>                                               
>> mac=cxml.xml_get_net_mac(),
>> -                                             name=default_dom)
>> +                                             name=default_dom,
>> +                                             virt_net=net_name)
>>      masd = vsms.get_masd_class(options.virt)(megabytes=nmem, 
>> name=default_dom)
>>      pasd = vsms.get_pasd_class(options.virt)(vcpu=ncpu, 
>> name=default_dom)
>>
>>      status = FAIL
>>      rc = 0
>>   
> We can remove rc since it is never used.    
>> -    try:
>> -        cxml.define(options.ip)
>> -        # Modify disk setting
>> -        service.ModifyResourceSettings(ResourceSettings = [str(dasd)])
>> -        cxml.dumpxml(options.ip)
>> -        dpath = cxml.xml_get_disk_source()
>> -        if dpath != ndpath:
>> -            raise Exception('Error changing rs for disk path')
>> -        logger.info('good status for disk path')
>> -        # Modify net setting
>> -        service.ModifyResourceSettings(ResourceSettings = [str(nasd)])
>> -        cxml.dumpxml(options.ip)
>> -        type = cxml.xml_get_net_type()
>> -        if type != ntype:
>> -            raise Exception('Error changing rs for net mac')
>> -        logger.info('good status for net mac')
>> -        # Modify memory resource setting
>> -        service.ModifyResourceSettings(ResourceSettings=[str(masd)])
>> -        cxml.dumpxml(options.ip)
>> -        mem = cxml.xml_get_mem()
>> -        if mem != '%i' % (nmem * 1024):
>> -            raise Exception('Error changing rs for mem')
>> -        logger.info('good status for mem')
>> -        # Modify cpu setting
>> -        service.ModifyResourceSettings(ResourceSettings = [str(pasd)])
>> -        cxml.dumpxml(options.ip)
>> -        cpu = cxml.xml_get_vcpu()
>> -        if cpu != '%i' % ncpu:
>> -            rc = -1
>> -            raise Exception('Error changing rs for vcpu')
>> -        logger.info('good status for vcpu')
>> -        status = PASS
>> -    except Exception, details:
>> -        logger.error('Error invoking ModifyRS')
>> -        logger.error(details)
>> -        return FAIL
>> +  +    if options.virt == "KVM":
>> +        test_cases = ["define"]
>> +    else:
>> +        test_cases = ["define", "start"]
>>
>> -    cxml.undefine(options.ip)
>> -    if rc == -1:
>> -        return XFAIL_RC(bug_cpu)
>> +    for case in test_cases:
>> +        cxml.undefine(options.ip)
>> +        ret = cxml.define(options.ip)
>> +        if not ret:
>> +            logger.error("Failed to define the dom: %s", default_dom)
>> +            cleanup_env(options.ip, options.virt, cxml, net_name)
>> +            return FAIL
>> +        if case == "start":
>> +            ret = cxml.start(options.ip)
>> +            if not ret:
>> +                logger.error("Failed to start the dom: %s", 
>> default_dom)
>> +                cleanup_env(options.ip, options.virt, cxml, net_name)
>> +                return FAIL
>>   
> Can we do like this ?
> if case == "start":
>    ret = cxml.start(options.ip)
> else:
>    ret = cxml.define(options.ip)   if not ret:
> logger.error("Failed to '%s' the dom: %s", case, default_dom)
> cleanup_env(options.ip, options.virt, cxml, net_name)
> return FAIL
>
>> +
>> +        status = vsms_util.mod_vcpu_res(options.ip, service, cxml, 
>> pasd, ncpu)
>> +        if status != PASS:
>> +            break
>> +
>> +        status = vsms_util.mod_mem_res(options.ip, service, cxml, 
>> masd, nmem)
>> +        if status != PASS:
>> +            break
>> +
>> +        #Unable to modify net and disk devices while guest is running
>> +        if case == "start":
>> +            break
>> +
>> +        status = vsms_util.mod_disk_res(options.ip, service, cxml, 
>> dasd, ndpath)
>> +        if status != PASS:
>> +            break
>> +
>> +        status = vsms_util.mod_net_res(options.ip, service, 
>> options.virt, cxml,
>> +                                       nasd, ntype, net_name)
>> +        if status != PASS:
>> +            break
>> +
>> +    cleanup_env(options.ip, options.virt, cxml, net_name)
>> +    destroy_netpool(options.ip, options.virt, net_name)
>>
>>      return status
>>
>>
>> _______________________________________________
>> Libvirt-cim mailing list
>> Libvirt-cim at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvirt-cim
>>   




More information about the Libvirt-cim mailing list