[Libvirt-cim] [PATCH] [TEST] #3 Add tc to verify VSMS.RemoveResourceSettings() with correct resource

Guo Lian Yun yunguol at cn.ibm.com
Wed Mar 18 02:25:14 UTC 2009


This tc fails because that it can not get InputRASD through 
SettingsDefineState association with PointingDevice.
Firstly, this tc gets following PointingDevice instance by SystemDevice:
//localhost/root/virt:KVM_PointingDevice.CreationClassName="KVM_PointingDevice",SystemName="domain",DeviceID="domain/mouse:ps2",SystemCreationClassName="KVM_ComputerSystem"

Then, it expects to get InputRASD through SettingsDefineState from 
KVM_PointingDevice, but it reports error as follows:
Tue, 17 Mar 2009 18:58:22:TEST LOG:INFO     -  dev id is domain/mouse:ps2
Tue, 17 Mar 2009 18:58:22:TEST LOG:ERROR    -  'CIMInstanceName' object 
has no attribute 'DeviceID'

Since other devices work fine for me, I looked into its provider, the 
relationship is set up between them.
Kaitlin, can you help me? 

Thanks!

Best,
Regards

Daisy (运国莲)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol at cn.ibm.com
TEL: (86)-21-60922403
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203


libvirt-cim-bounces at redhat.com wrote on 2009-03-18 10:23:24:

> # HG changeset patch
> # User Guolian Yun <yunguol at cn.ibm.com>
> # Date 1237342979 25200
> # Node ID fc062835ef35568b7379edb2e99f173f7833d3a6
> # Parent  daccd46e12ccf2afce3295a41510d7e94ff48d7b
> [TEST] #3 Add tc to verify VSMS.RemoveResourceSettings() with correct 
resource
> 
> 
> 
> Updates from 2 to 3:
> 1) Capture the return of RemoveResourceSettings() and check for an 
error.
> 2) Verify InputRASD
> 
> Updates from 1 to 2:
> Get RASD instances by SystemDevice and SettingsDefineState associaton
> 
> Tested for KVM with current sources and rpm
> Signed-off-by: Guolian Yun<yunguol at cn.ibm.com>
> 
> diff -r daccd46e12cc -r fc062835ef35 suites/libvirt-
> cim/cimtest/VirtualSystemManagementService/16_removeresource.py
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/suites/libvirt-
> cim/cimtest/VirtualSystemManagementService/16_removeresource.py 
> Tue Mar 17 19:22:59 2009 -0700
> @@ -0,0 +1,112 @@
> +#!/usr/bin/python
> +#
> +# Copyright 2009 IBM Corp.
> +#
> +# Authors:
> +#    Guolian Yun <yunguol at cn.ibm.com>
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public
> +# License as published by the Free Software Foundation; either
> +# version 2.1 of the License, or (at your option) any later version.
> +#
> +# This library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public
> +# License along with this library; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 
USA
> +#
> +
> +import sys
> +from XenKvmLib.vsms import get_vsms_class
> +from XenKvmLib.vxml import get_class
> +from XenKvmLib.classes import get_typed_class
> +from XenKvmLib.assoc import AssociatorNames
> +from CimTest.Globals import logger
> +from XenKvmLib.const import do_main, get_provider_version
> +from CimTest.ReturnCodes import FAIL, PASS
> +
> +sup_types = ['Xen', 'KVM', 'XenFV']
> +default_dom = 'domain'
> +rem_res_err_rev_start = 779
> +rem_res_err_rev_end = 828
> +ntype = 'network'
> +nmac = '00:11:22:33:44:55'
> +
> + at do_main(sup_types)
> +def main():
> +    options = main.options
> +
> +    if options.virt == 'KVM':
> +        nddev = 'hdb'
> +    else:
> +        nddev = 'xvdb'
> +
> +    cxml = get_class(options.virt)(default_dom, disk=nddev, mac=nmac)
> +    ret = cxml.cim_define(options.ip)
> +    if not ret:
> +        logger.error("Failed to define the dom: %s", default_dom)
> +        return FAIL
> + 
> +    try:
> +        # Get system devices through SystemDevice assocation
> +        sd_classname = get_typed_class(options.virt, 'SystemDevice')
> +        cs_classname = get_typed_class(options.virt, 'ComputerSystem')
> +
> +        devs = AssociatorNames(options.ip, sd_classname, cs_classname,
> +                               Name=default_dom, 
> CreationClassName=cs_classname)
> + 
> +        if len(devs) == 0:
> +            raise Exception("No devices returned")
> +
> +        # Get RASD instances through SettingsDefineState
> +        sds_classname = get_typed_class(options.virt, 
'SettingsDefineState')
> +        mem = get_typed_class(options.virt, 'Memory')
> +        proc = get_typed_class(options.virt, 'Processor')
> +        dev_not_rem = [mem, proc] 
> + 
> +        service = get_vsms_class(options.virt)(options.ip)
> +        for dev in devs:
> +            if dev['CreationClassName'] in dev_not_rem:
> +                continue
> +            else:
> +                ccn = dev['CreationClassName']
> +                sccn = dev['SystemCreationClassName']
> +                rasd = AssociatorNames(options.ip, sds_classname, ccn,
> +                                       DeviceID = dev['DeviceID'],
> +                                       CreationClassName = ccn,
> +                                       SystemName = dev['SystemName'],
> +                                       SystemCreationClassName = sccn)
> +                if len(rasd) != 1:
> +                    raise Exception("%i RASD insts for %s", 
> len(rasd), dev.DeviceID)
> +                # Invoke RemoveResourceSettings() to remove resource
> +                ret = service.
> RemoveResourceSettings(ResourceSettings=[rasd[0]])
> +                if ret[0] != 0:
> +                    raise Exception("Remove %s error, please check", 
rasd[0])
> +    except Exception, details: 
> +        logger.error(details)
> +        cxml.undefine(options.ip)
> +        return FAIL
> +
> +    cxml.dumpxml(options.ip) 
> +    device = cxml.get_value_xpath('/domain/@devices')
> +    curr_cim_rev, changeset = get_provider_version(options.virt, 
options.ip)
> +
> +    if device == None:
> +        return PASS
> +    elif device != None and curr_cim_rev >= rem_res_err_rev_start and\
> +        curr_cim_rev < rem_res_err_rev_end:
> +        return SKIP
> +    else:
> +        logger.error('The devices are not removed successfully')
> +        cxml.undefine(options.ip)
> +        return FAIL
> +
> +    cxml.undefine(options.ip)
> +    return PASS
> +
> +if __name__ == "__main__":
> +    sys.exit(main())
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20090318/800e51e5/attachment.htm>


More information about the Libvirt-cim mailing list