[Libvirt-cim] [PATCH 1 of 2] [TEST] Created testcases for the forward HostedAccessPoint association (HostSystem -> KVMRedirectionSAP)

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Feb 11 18:32:49 UTC 2009


> +
> +def verify_kvmrsap(enum_list, list_kvmrsap):
> +    status = PASS

Set status = FAIL.  If you set it to PASS, and there are no items in 
enum_list, then you return a false positive.

> +
> +    for item in enum_list:
> +        found = FAIL
> +        for kvmrsap in list_kvmrsap:
> +            found = compare_all_prop(item, kvmrsap)

An easier way to do this would be to check the Name and SystemName keys 
to see if they are the same.  If they are the same, then do a compare. 
Otherwise, check the next element in the list.

> +            if found == PASS:
> +                break
> +
> +        if found == FAIL:
> +            logger.error("Instance found in kvmrsap list but not in " +
> +                         "association list")

> +            return FAIL
> +
> +    return status
> +

 > +    # This check is required for libvirt-cim providers which do not 
have
 > +    # HostedAccessPoint changes in it and the HostedAccessPoint
 > +    # association is available with revision >= 782.
 > +    curr_cim_rev, changeset = get_provider_version(virt, server)
 > +    if curr_cim_rev  < libvirtcim_hostedAccPnt_changes:
 > +        logger.info("'%s' provider not supported, hence skipping the 
tc ....",
 > +                    classname)
 > +        return SKIP

classname is not defined.


> +        if list_kvmrsap is None:
> +            raise Exception("No kvmrsap instance returned")

It's possible for len(list_kvmrsap) to equal 0.  You want to check to 
see if len(list_kvmrsap) is > than 0.

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




More information about the Libvirt-cim mailing list