[Libvirt-cim] [PATCH] [TEST] #2 [TEST] Add new tc RASDIndications/02_guest_add_mod_rem_rasd_ind.py

Richard Maciel rmaciel at linux.vnet.ibm.com
Wed Sep 23 01:02:07 UTC 2009


I've got the following message when executing this test:

Testing KVM hypervisor
--------------------------------------------------------------------
RASDIndications - 02_guest_add_mod_rem_rasd_ind.py: FAIL
ERROR 	- Error invoking AddRS: add_disk_res
ERROR 	- (1, u'CIM_ERR_FAILED: Internal error (xml generation failed)')
ERROR 	- Exception: Unable to generate indication
InvokeMethod(AddResourceSettings): CIM_ERR_FAILED: Internal error (xml 
generation failed)
--------------------------------------------------------------------


I'm executing it on a Fedora 10 system with Pegasus.

The command line used is:

[root at F10 cimtest]# CIM_NS=root/virt CIM_USER=root CIM_PASS=1mud2ar3 
./runtests libvirt-cim -i localhost -c -d -v KVM -g RASDIndications -t 
02_guest_add_mod_rem_rasd_ind.py


---------------------------------------------------------
The log (after the system was created) is below. I marked some 
interesting messages with a <---

std_invokemethod.c(305): Method `DefineSystem' returned 0
misc_util.c(75): Connecting to libvirt with uri `qemu:///system'
misc_util.c(202): URI of connection is: qemu:///system
misc_util.c(202): URI of connection is: qemu:///system
device_parsing.c(273): Disk node: disk
infostore.c(88): Path is /etc/libvirt/cim/QEMU_VM_F10
instance_util.c(127): Number of keys: 2
instance_util.c(140): Comparing key 0: `CreationClassName'
instance_util.c(140): Comparing key 1: `Name'
std_indication.c(204): stdi_set_ind_filter_state
std_indication.c(48): Ind Filter name (param): 
KVM_ResourceAllocationSettingDataCreatedIndication
std_indication.c(50): Ind Filter name (list): 
Xen_ResourceAllocationSettingDataCreatedIndication
std_indication.c(50): Ind Filter name (list): 
Xen_ResourceAllocationSettingDataDeletedIndication
std_indication.c(50): Ind Filter name (list): 
Xen_ResourceAllocationSettingDataModifiedIndication
std_indication.c(50): Ind Filter name (list): 
KVM_ResourceAllocationSettingDataCreatedIndication
misc_util.c(75): Connecting to libvirt with uri `qemu:///system'
misc_util.c(202): URI of connection is: qemu:///system
device_parsing.c(273): Disk node: disk
device_parsing.c(273): Disk node: disk
Virt_VSSD.c(59): bootlist_ct = 1
Virt_VSSD.c(80): BootList[0]=hd
Virt_VSSD.c(246): Unknown domain type 3 for creating VSSD <-----
misc_util.c(202): URI of connection is: qemu:///system
device_parsing.c(273): Disk node: disk
Virt_VSSD.c(246): Unknown domain type -1 for creating VSSD
device_parsing.c(1037): Unknown domain type -1
misc_util.c(202): URI of connection is: qemu:///system
device_parsing.c(273): Disk node: disk
Virt_VSSD.c(59): bootlist_ct = 1
Virt_VSSD.c(80): BootList[0]=hd
Virt_VSSD.c(246): Unknown domain type 3 for creating VSSD
std_invokemethod.c(279): Method `AddResourceSettings' execution attempted
std_invokemethod.c(230): Method parameter `AffectedConfiguration' 
validated type 0x1100
eo_parser.c(100): Parsing MOF-style EI
  std_invokemethod.c(230): Method parameter `ResourceSettings' validated 
type 0x3000
std_invokemethod.c(303): Executing handler for method `AddResourceSettings'
misc_util.c(75): Connecting to libvirt with uri `qemu:///system'
device_parsing.c(273): Disk node: disk
misc_util.c(75): Connecting to libvirt with uri `qemu:///system'
misc_util.c(75): Connecting to libvirt with uri `qemu:///system'
infostore.c(88): Path is /etc/libvirt/cim/QEMU_VM_F10
misc_util.c(409): Type is KVM
Virt_VirtualSystemManagementService.c(1943): VS `VM_F10' not online; 
skipping dynamic update <-------
xmlgen.c(728): Using existing UUID: 9041cf48-21f4-4d4e-a4cd-4387f27fe669
xmlgen.c(146): Disk: 2 /tmp/default-kvm-dimage hda
xmlgen.c(146): Disk: 0 /tmp/default-kvm-dimage.2ND hdb
xmlgen.c(791): Failed to create XML: Unknown disk type  <----------
std_invokemethod.c(305): Method `AddResourceSettings' returned 1
misc_util.c(75): Connecting to libvirt with uri `qemu:///system'
misc_util.c(202): URI of connection is: qemu:///system
Virt_HostSystem.c(203): SBLIM: Returned instance


On 09/22/2009 06:33 PM, Deepti B. Kalakeri wrote:
> # HG changeset patch
> # User Deepti B. Kalakeri<deeptik at linux.vnet.ibm.com>
> # Date 1253655145 25200
> # Node ID 215cbc24f8f95f95543a24ecc7e3b1d80594ecdd
> # Parent  faf86189f60a2b7e5321996540c390c0598929c9
> [TEST] #2 [TEST] Add new tc RASDIndications/02_guest_add_mod_rem_rasd_ind.py
>
> Patch 2:
> --------
> 1) Checked for RASDIndication support in libvirt-cim
> 2) Included support for XenFV
> 3) Removed cim_start() fromt the testcase
> 4) Undefined the guest at the end of the test.
>
> To verify the Add|Modify|Deleted RASDIndication for the guest.
>
> Tested with Xen and current sources on RHEL5.3 and with KVM on F10.
> Signed-off-by: Deepti B. Kalakeri<deeptik at linux.vnet.ibm.com>
>
> diff -r faf86189f60a -r 215cbc24f8f9 suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py	Tue Sep 22 14:32:25 2009 -0700
> @@ -0,0 +1,225 @@
> +#!/usr/bin/python
> +#
> +# Copyright 2009 IBM Corp.
> +#
> +# Authors:
> +#   Deepti B. Kalakeri<deeptik at linux.vnet.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
> +#
> +#
> +# This testcase is used to verify the Created|Modified|Deleted
> +# RASD Indications for a guest.
> +#
> +#                                                      Date : 21-09-2009
> +#
> +
> +import sys
> +from signal import SIGKILL
> +from XenKvmLib import vsms
> +from XenKvmLib import vsms_util
> +from XenKvmLib.classes import get_typed_class
> +from XenKvmLib.enumclass import EnumNames
> +from socket import gethostname
> +from os import kill, fork, _exit
> +from XenKvmLib.vxml import get_class
> +from CimTest.Globals import logger
> +from XenKvmLib.const import do_main, CIM_DISABLE, get_provider_version
> +from CimTest.ReturnCodes import PASS, FAIL, SKIP
> +from XenKvmLib.common_util import poll_for_state_change
> +from XenKvmLib.indications import sub_ind, handle_request, poll_for_ind
> +
> +sup_types = ['KVM', 'Xen', 'XenFV']
> +libvirt_guest_rasd_indication_rev = 980
> +
> +nmem = 256
> +nmac = '00:11:22:33:44:55'
> +
> +def create_guest(test_dom, ip, virt, cxml):
> +    try:
> +        ret = cxml.cim_define(ip)
> +        if not ret:
> +            raise Exception("Failed to define domain %s" % test_dom)
> +
> +        status, dom_cs = poll_for_state_change(ip, virt, test_dom,
> +                                               CIM_DISABLE)
> +        if status != PASS:
> +            raise Exception("Dom '%s' not in expected state '%s'" \
> +                            % (test_dom, CIM_DISABLE))
> +
> +    except Exception, details:
> +        logger.error("Exception details: %s", details)
> +        return FAIL, cxml
> +
> +    return PASS, cxml
> +
> +
> +def get_rasd_rec(virt, cn, s_sysname, inst_id):
> +    classname = get_typed_class(virt, cn)
> +    recs = EnumNames(s_sysname, classname)
> +    rasd = None
> +    for rasd_rec in recs:
> +        ret_pool = rasd_rec['InstanceID']
> +        if ret_pool == inst_id:
> +            rasd = rasd_rec
> +            break
> +
> +    return rasd
> +
> +def gen_indication(test_dom, s_sysname, virt, cxml, service, ind_name,
> +                   rasd=None, nmem_disk=None):
> +    status = FAIL
> +    try:
> +
> +        if ind_name == "add":
> +            cn = 'VirtualSystemSettingData'
> +            inst_id = '%s:%s' % (virt, test_dom)
> +            classname = get_typed_class(virt, cn)
> +            vssd_ref = get_rasd_rec(virt, cn, s_sysname, inst_id)
> +
> +            if vssd_ref == None:
> +                raise Exception("Failed to get vssd_ref for '%s'" % test_dom)
> +
> +            status = vsms_util.add_disk_res(s_sysname, service, cxml,
> +                                            vssd_ref, rasd, nmem_disk)
> +
> +        elif ind_name == "modify":
> +            status = vsms_util.mod_mem_res(s_sysname, service, cxml,
> +                                           rasd, nmem_disk)
> +
> +        elif ind_name == 'delete':
> +            cn = 'GraphicsResourceAllocationSettingData'
> +            inst_id = '%s/%s' % (test_dom, "graphics")
> +            classname = get_typed_class(virt, cn)
> +            nrasd = get_rasd_rec(virt, cn, s_sysname, inst_id)
> +
> +            if nrasd == None:
> +                raise Exception("Failed to get nrasd for '%s'" % test_dom)
> +
> +            res = service.RemoveResourceSettings(ResourceSettings=[nrasd])
> +            status = res[0]
> +
> +    except Exception, details:
> +        logger.error("Exception details :%s", details)
> +        return FAIL
> +
> +    return status
> +
> + at do_main(sup_types)
> +def main():
> +    options = main.options
> +    virt = options.virt
> +    s_sysname = options.ip
> +
> +    cim_rev, changeset = get_provider_version(virt, s_sysname)
> +    if cim_rev<  libvirt_guest_rasd_indication_rev:
> +        logger.info("Support for Guest Resource Indications is available in "
> +                    "Libvirt-CIM rev '%s'", libvirt_guest_rasd_indication_rev)
> +        return SKIP
> +
> +    status = FAIL
> +    test_dom = 'VM_' + gethostname()
> +    ind_names = {
> +                 'add'    : 'ResourceAllocationSettingDataCreatedIndication',
> +                 'modify' : 'ResourceAllocationSettingDataModifiedIndication',
> +                 'delete' : 'ResourceAllocationSettingDataDeletedIndication'
> +                }
> +
> +    sub_list, ind_names, dict = sub_ind(s_sysname, virt, ind_names)
> +    virt_xml = get_class(virt)
> +    cxml = virt_xml(test_dom, mac=nmac)
> +    service = vsms.get_vsms_class(options.virt)(options.ip)
> +    ndpath = cxml.secondary_disk_path
> +
> +    if virt == 'KVM':
> +        nddev = 'hdb'
> +    else:
> +        nddev = 'xvdb'
> +
> +    disk_attr = { 'nddev' : nddev,
> +                  'src_path' : ndpath
> +                }
> +    dasd = vsms.get_dasd_class(options.virt)(dev=nddev,
> +                                             source=cxml.secondary_disk_path,
> +                                             name=test_dom)
> +    masd = vsms.get_masd_class(options.virt)(megabytes=nmem, name=test_dom)
> +    rasd_info = { 'add' : [dasd, disk_attr],
> +                  'modify' : [masd, nmem]
> +                }
> +
> +    status, cxml = create_guest(test_dom, s_sysname, virt, cxml)
> +    if status != PASS:
> +        logger.error("Error setting up the guest '%s'" % test_dom)
> +        return FAIL
> +
> +    for ind in ind_names.keys():
> +        sub = sub_list[ind]
> +        ind_name = ind_names[ind]
> +        logger.info("\n Verifying '%s' indications ....", ind_name)
> +
> +        try:
> +            pid = fork()
> +            if pid == 0:
> +                status = handle_request(sub, ind_name, dict,
> +                                        len(ind_names.keys()))
> +                if status != PASS:
> +                    _exit(1)
> +
> +                _exit(0)
> +            else:
> +                try:
> +                    if ind != 'delete':
> +                        rasd = rasd_info[ind][0]
> +                        val  = rasd_info[ind][1]
> +                        status = gen_indication(test_dom, s_sysname,
> +                                                      virt, cxml, service,
> +                                                      ind, rasd, val)
> +                    else:
> +                        status = gen_indication(test_dom, s_sysname,
> +                                                      virt, cxml, service,
> +                                                      ind)
> +                    if status != PASS:
> +                        raise Exception("Unable to generate indication")
> +
> +                    status = poll_for_ind(pid, ind_name)
> +                    if status != PASS:
> +                        raise Exception("Poll for indication Failed")
> +
> +                except Exception, details:
> +                    kill(pid, SIGKILL)
> +                    raise Exception(details)
> +
> +        except Exception, details:
> +            logger.error("Exception: %s", details)
> +            status = FAIL
> +
> +        if status != PASS:
> +            break
> +
> +	    #Make sure all subscriptions are really unsubscribed
> +    for ind, sub in sub_list.iteritems():
> +        sub.unsubscribe(dict['default_auth'])
> +        logger.info("Cancelling subscription for %s", ind_names[ind])
> +
> +    ret = cxml.undefine(s_sysname)
> +    if not ret:
> +        logger.error("Failed to undefine the domain '%s'", test_dom)
> +        return FAIL
> +
> +    return status
> +if __name__ == "__main__":
> +    sys.exit(main())
> +
>


-- 
Richard Maciel, MSc
IBM Linux Technology Center
rmaciel at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list