[Libvirt-cim] [PATCH] [TEST]Update RPCS/04 to validate that the Network child pool can be created through the providers

Guo Lian Yun yunguol at cn.ibm.com
Fri Apr 17 07:21:45 UTC 2009


libvirt-cim-bounces at redhat.com wrote on 2009-04-17 07:04:05:

> yunguol at cn.ibm.com wrote:
> > # HG changeset patch
> > # User Guolian Yun <yunguol at cn.ibm.com>
> > # Date 1239868524 25200
> > # Node ID 860c994006a12104618e29bf051730993568bcc1
> > # Parent  4ec367c94c356de7fac5a19ffe215c316d0cdcd1
> > [TEST]Update RPCS/04 to validate that the Network child pool can 
> be created through the providers
> >
> >
> > Follow up patch will valide Disk child pool creation and 
> verification in the same tc
> > 
> libvirt supports several different disk pool types. Not all of these are 

> supported in libvirt-cim yet, but they will be in the future. I would 
> put the disk pool verification in a different test, otherwise, this test 

> might become to cluttered / confusing.
> > Tested for KVM with current sources
> > Signed-off-by: Guolian Yun<yunguol at cn.ibm.com>
> >
> > diff -r 4ec367c94c35 -r 860c994006a1 suites/libvirt-
> 
cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py
> > --- a/suites/libvirt-
> cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.
> py   Wed Apr 08 02:22:53 2009 -0700
> > +++ b/suites/libvirt-
> cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.
> py   Thu Apr 16 00:55:24 2009 -0700
> > @@ -52,32 +52,84 @@
> > 
> Can you update the comment block at the top of the test?
> 
> > +
> > +def verify_pool(pool_list, poolname):
> > +    status = PASS
> > +    if len(pool_list) < 1:
> > +        logger.error("Returen %i instances, expected at least 
oneinstance",
> > 
> Typo here.. this should be "Return"
> > +                     len(pool_list))
> > +        return FAIL
> > + 
> > +    for i in range(0, len(pool_list)):
> > +        ret_pool = pool_list[i].InstanceID
> > +        if ret_pool == poolname:
> > +            break
> > +        elif ret_pool != poolname and i == len(pool_list)-1:
> > +            logger.error("Can not find expected pool")
> > +            status = FAIL
> > 
> This for loop is a little odd. Why not set status to FAIL at the top of 
> the function. If you find the pool you are looking for, set status to 
> PASS and break from the loop. If you don't find the pool, then status 
> will be FAIL at the end of the loop.
> > +    elif curr_cim_rev >= libvirt_cim_child_pool_rev: 
> > +        nprasd = get_typed_class(options.virt, 
> > + 'NetPoolResourceAllocationSettingData')
> > +        np_id = 'NetworkPool/%s' % testpool
> > +        iname = CIMInstanceName(nprasd,
> > +                                namespace = 'root/virt',
> > +                                keybindings = {'InstanceID':np_id})
> > +        logger.info('iname is %s', iname)
> > +        nrasd = CIMInstance(nprasd, path = iname,
> > +                            properties ={
> > +                                         "Address" : "192.168.0.30",
> > +                                         "Netmask" : "255.255.255.0",
> > +                                         "IPRangeStart" : 
"192.168.0.31",
> > +                                         "IPRangeEnd" : 
"192.168.0.57",
> > +                                         "ForwardMode":"route eth1"})
> > 
> Since this test will be network pool specific, can you also test the 
> other types of network pools 
> (http://libvirt.org/formatnetwork.html#examples)

  The NAT based network has to set ForwaredMode by "nat", I'm not sure how 
to test 
  isolated network? Which properties has to set for this type?

  Thanks!

> > +        try:
> > +            rpcs_conn.CreateChildResourcePool(ElementName=testpool, 
> > + Settings=[nrasd.tomof()])
> > +        except pywbem.CIMError, details:
> > +            logger.error("Invoke CreateChildResourcePool() error")
> > +            logger.error(details)
> >              return FAIL
> > - 
> > -    logger.error("The execution should not have reached here!!")
> > -    return FAIL
> > + 
> > +        np = get_typed_class(options.virt, 'NetworkPool')
> > +        netpool = EnumInstances(options.ip, np)
> > +        status = verify_pool(netpool, np_id)
> > +
> > +        destroy_netpool(options.ip, options.virt, testpool)
> > 
> Also be sure to undefine the pool as well.
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20090417/e6717394/attachment.htm>


More information about the Libvirt-cim mailing list