[Libvirt-cim] [PATCH] [TEST] #4 Update RPCS/07_DeleteResourcePool.py validate that the Network pool can be deleted through the providers

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Apr 27 21:11:48 UTC 2009


>  import sys
>  import pywbem 
>  from XenKvmLib import rpcs_service

rpcs_service is no longer being used.


>  @do_main(platform_sup)
>  def main():
>      options = main.options
>      rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \
>                        "ResourcePoolConfigurationService"))(options.ip)

Put the get_typed_class() call on its own line.

> +    elif curr_cim_rev >= libvirt_cim_child_pool_rev: 
> +        nprasd = get_typed_class(options.virt, 
> +                                 'NetPoolResourceAllocationSettingData')
> +        addr = "192.168.0.30"
> +        n_list = net_list(options.ip, options.virt)
> +        for _net_name in n_list:
> +            cmd = "virsh net-dumpxml %s | awk '/ip address/ {print}' | \
> +                   cut -d ' ' -f 4 | sed 's/address=//'" % _net_name
> +            s, in_use_addr = run_remote(options.ip, cmd)
> +            in_use_addr = in_use_addr.strip("'")
> +            if in_use_addr == addr:
> +                logger.error("IP address is in use by a different network")
> +                return FAIL

I suspect this will be used by other tests at some point, so this should 
go in XenKvmLib.

> +def verify_pool(server, networkpool, poolname):
> +    status = FAIL
> +    pool_list = EnumInstances(server, networkpool)
> +    if len(pool_list) < 1:
> +        logger.error("Return %i instances, expected at least one instance",
> +                     len(pool_list))
> +        return FAIL
> +    
> +    for i in range(0, len(pool_list)):
> +        ret_pool = pool_list[i].InstanceID
> +        if ret_pool == poolname:
> +            status = PASS
> +            break
> +        elif ret_pool != poolname and i == len(pool_list)-1:
> +            logger.error("Can not find expected pool")
> +
> +    return status
> 

This isn't enough to verify the pool was created properly.  You verify 
the pool was created, but you don't verify its attributes.

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




More information about the Libvirt-cim mailing list