[Libvirt-cim] [PATCH 3 of 4] [TEST] Add KVM support for HostedDependency.03

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Apr 16 17:13:21 UTC 2008


> -        hs = assoc.Associators(options.ip, "Xen_HostedDependency", host_ccn, \
> +        hs = assoc.Associators(options.ip, "HostedDependency", 
> +                               get_class_basename(host_ccn), options.virt,
>                                 CreationClassName=host_ccn, Name=host_name)
>          if len(hs) == 0:
> -            logger.error("HostedDependency didn't return any instances.")
> -            return FAIL
> +            status = FAIL

Instead of setting status = FAIL here, can you set this where you catch 
the exception?  That way you only have to set it once and we can be sure 
we're setting the right return code.

> +            raise HsError("HostedDependency didn't return any instances.")
> 
>          hs_field_list = []
> -        for i in range(len(hs)):
> -            if hs[i]['Name'] == test_dom:
> -                hs_field_list = create_list(CIM_Instance(hs[i]))
> +        for hsi in hs:
> +            if hsi['Name'] == test_dom:
> +                hs_field_list = create_list(CIM_Instance(hsi))
> 
>          if len(hs_field_list) == 0:
> -            logger.error("Association did not return expected guest instance.")
> -            return FAIL
> +            status = FAIL

Same here - this can be removed.

> +            raise HsError("Association did not return expected guest instance.")
> 
>          if dom_field_list['CreationClassName'] != hs_field_list['CreationClassName']:
>              print_error('CreationClassName', hs_field_list['CreationClassName'], \
> @@ -165,12 +175,15 @@ def main():
>              print_error('EnabledState', hs_field_list['EnabledState'], \
>                                           dom_field_list['EnabledState']) 
>              status = FAIL
> +    except HsError, detail:
> +        logger.error(detail)

I've applied the other 3 in this set since they don't depend on one 
another (and the cimtest queue is a bit largish today).


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




More information about the Libvirt-cim mailing list