[Libvirt-cim] [PATCH] [TEST] Fix HostedService-04_reverse_errs.py with sblim base provider installed

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Sep 26 21:57:48 UTC 2008


>      rc = -1
>      status = FAIL
> -    keys = ['Name', 'CreationClassName']
> -    try:
> -        host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
> -    except Exception:
> -        logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
> -        return FAIL
> +    ret, linux_cs = check_sblim(options.ip, options.virt)
> +    if ret == PASS:
> +        host_sys = linux_cs
> +    else:
> +        keys = ['Name', 'CreationClassName']
> +        try:
> +            host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
> +        except Exception:
> +            logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
> +            return FAIL

You can use get_host_info() instead.

> 
> 
>      servicelist = {get_typed_class(options.virt, "ResourcePoolConfigurationService") : "RPCS",
> @@ -65,7 +70,8 @@ def main():
>          names = []
> 
>          try:
> -            names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
> +            names = conn.AssociatorNames(instanceref, AssocClass = \
> +                    get_typed_class(options.virt, "HostedService"))

The alignment here is a little strange. Usually, you align like the 
following:

names = conn.AssociatorNames(instanceref, AssocClass=\
                              get_typed_class(options.virt, 
"HostedService"))


But instead, I'd suggest doing something like:

hostedserv_cn = get_typed_class(options.virt, "HostedService"))
names = conn.AssociatorNames(instanceref, AssocClass=hostedserv_cn)

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




More information about the Libvirt-cim mailing list