[Libvirt-cim] [PATCH] [TEST] Enabling 02_reverse.py with XenFV, KVM, LXC and modified logicaldevices.py to work for all virt types

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Sun Jul 20 21:32:24 UTC 2008


> +def verify_eafp_values(server, virt, in_pllist, test_disk):
> +    # Looping through the in_pllist to get association for various pools.
> +    eafp_values = eafp_list(virt, test_disk)
> +    an = get_typed_class(virt, "ElementAllocatedFromPool")
> +    for cn, instid in sorted(in_pllist.iteritems()):
> +        try:
> +            assoc_info = Associators(server, an, cn, virt, InstanceID = instid)
> +            assoc_inst_list = get_inst_for_dom(assoc_info)
> +            if len(assoc_inst_list) < 1 :
> +                logger.error("'%s' with '%s' did not return any records for"
> +                             " domain: '%s'", an, cn, test_dom)

This should be;

logger.error("'%s' should have returned '%i' Processor" 

              " details, got '%i'" % (an, test_vcpus, 

              len(assoc_inst_list)))

If you use commas instead, the formatting of the string is off.

> +                return FAIL
> 
> -def  assoc_values(assoc_list, field , list, index, specific_fields_list=""):
> -    """
> -        Verifying the records retruned by the associations.
> -    """
> -    global status
> -    if field  == "CreationClassName":
> -        for i in range(len(assoc_list)):
> -            if assoc_list[i][field] != list[index]:
> -                print_error(field,  assoc_list[i][field], list[index])
> +            assoc_eafp_info = assoc_inst_list[0]
> +            CCName = assoc_eafp_info['CreationClassName']
> +            if  CCName == get_typed_class(virt, 'Processor'):
> +                if len(assoc_inst_list) != test_vcpus:
> +                    logger.error("'%s' should have returned '%i' Processor"
> +                                 " details, got '%i'", an, test_vcpus, 
> +                                 len(assoc_inst_list))

Same here - format the log message using % (an, test_vcpus, 
len(assoc_inst_list))

> +
> +    # Verify DiskPool on machine
> +    status, diskid = create_diskpool_conf(server, virt)
> +    if status != PASS:
> +        return status
> +
> +    ret = vsxml.create(server)
> +    if not ret:
> +        logger.error("Failed to Create the dom: '%s'", test_dom)

Will need to call cleanup_restore() in case of error.

>          return FAIL
> 

>      sys.exit(main())
> diff -r 3703b7be5a10 -r f8f6995ce089 suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py	Wed Jul 16 07:23:32 2008 -0700
> +++ b/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py	Fri Jul 18 05:29:39 2008 -0700
> @@ -23,6 +23,7 @@ import os

> 
> -def verify_proc_values(assoc_info, list_values):

Instead of having a verify_<>_values function for each device type, 
could these be condensed into one function?  All of them check the 
CreationClassName and the DeviceID, which isn't needed.  The function 
could take the classname, which would enable you to determine with 
values need to be checked.



-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list