<br><tt><font size=2>libvirt-cim-bounces@redhat.com wrote on 2009-04-17
07:04:05:<br>
<br>
> yunguol@cn.ibm.com wrote:<br>
> > # HG changeset patch<br>
> > # User Guolian Yun <yunguol@cn.ibm.com><br>
> > # Date 1239868524 25200<br>
> > # Node ID 860c994006a12104618e29bf051730993568bcc1<br>
> > # Parent  4ec367c94c356de7fac5a19ffe215c316d0cdcd1<br>
> > [TEST]Update RPCS/04 to validate that the Network child pool
can <br>
> be created through the providers<br>
> ><br>
> ><br>
> > Follow up patch will valide Disk child pool creation and <br>
> verification in the same tc<br>
> >   <br>
> libvirt supports several different disk pool types. Not all of these
are <br>
> supported in libvirt-cim yet, but they will be in the future. I would
<br>
> put the disk pool verification in a different test, otherwise, this
test <br>
> might become to cluttered / confusing.<br>
> > Tested for KVM with current sources<br>
> > Signed-off-by: Guolian Yun<yunguol@cn.ibm.com><br>
> ><br>
> > diff -r 4ec367c94c35 -r 860c994006a1 suites/libvirt-<br>
> cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py<br>
> > --- a/suites/libvirt-<br>
> cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.<br>
> py   Wed Apr 08 02:22:53 2009 -0700<br>
> > +++ b/suites/libvirt-<br>
> cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.<br>
> py   Thu Apr 16 00:55:24 2009 -0700<br>
> > @@ -52,32 +52,84 @@<br>
> >   <br>
> Can you update the comment block at the top of the test?<br>
> <br>
> > +<br>
> > +def verify_pool(pool_list, poolname):<br>
> > +    status = PASS<br>
> > +    if len(pool_list) < 1:<br>
> > +        logger.error("Returen %i instances,
expected at least oneinstance",<br>
> >   <br>
> Typo here.. this should be "Return"<br>
> > +                  
  len(pool_list))<br>
> > +        return FAIL<br>
> > +    <br>
> > +    for i in range(0, len(pool_list)):<br>
> > +        ret_pool = pool_list[i].InstanceID<br>
> > +        if ret_pool == poolname:<br>
> > +            break<br>
> > +        elif ret_pool != poolname and i
== len(pool_list)-1:<br>
> > +            logger.error("Can
not find expected pool")<br>
> > +            status = FAIL<br>
> >   <br>
> This for loop is a little odd. Why not set status to FAIL at the top
of <br>
> the function. If you find the pool you are looking for, set status
to <br>
> PASS and break from the loop. If you don't find the pool, then status
<br>
> will be FAIL at the end of the loop.<br>
> > +    elif curr_cim_rev >= libvirt_cim_child_pool_rev:
<br>
> > +        nprasd = get_typed_class(options.virt,
<br>
> > +                  
              'NetPoolResourceAllocationSettingData')<br>
> > +        np_id = 'NetworkPool/%s' % testpool<br>
> > +        iname = CIMInstanceName(nprasd,<br>
> > +                  
             namespace = 'root/virt',<br>
> > +                  
             keybindings = {'InstanceID':np_id})<br>
> > +        logger.info('iname is %s', iname)<br>
> > +        nrasd = CIMInstance(nprasd, path
= iname,<br>
> > +                  
         properties ={<br>
> > +                  
                     
"Address" : "192.168.0.30",<br>
> > +                  
                     
"Netmask" : "255.255.255.0",<br>
> > +                  
                     
"IPRangeStart" : "192.168.0.31",<br>
> > +                  
                     
"IPRangeEnd" : "192.168.0.57",<br>
> > +                  
                     
"ForwardMode":"route eth1"})<br>
> >   <br>
> Since this test will be network pool specific, can you also test the
<br>
> other types of network pools <br>
> (http://libvirt.org/formatnetwork.html#examples)</font></tt>
<br>
<br><tt><font size=2>  The NAT based network has to set ForwaredMode
by "nat", I'm not sure how to test </font></tt>
<br><tt><font size=2>  isolated network? Which properties has to set
for this type?</font></tt>
<br>
<br><tt><font size=2>  Thanks!</font></tt>
<br><tt><font size=2><br>
> > +        try:<br>
> > +            rpcs_conn.CreateChildResourcePool(ElementName=testpool,
<br>
> > +                  
                     
     Settings=[nrasd.tomof()])<br>
> > +        except pywbem.CIMError, details:<br>
> > +            logger.error("Invoke
CreateChildResourcePool() error")<br>
> > +            logger.error(details)<br>
> >              return FAIL<br>
> > -     <br>
> > -    logger.error("The execution should not have
reached here!!")<br>
> > -    return FAIL<br>
> > +         <br>
> > +        np = get_typed_class(options.virt,
'NetworkPool')<br>
> > +        netpool = EnumInstances(options.ip,
np)<br>
> > +        status = verify_pool(netpool, np_id)<br>
> > +<br>
> > +        destroy_netpool(options.ip, options.virt,
testpool)<br>
> >   <br>
> Also be sure to undefine the pool as well.<br>
> <br>
> _______________________________________________<br>
> Libvirt-cim mailing list<br>
> Libvirt-cim@redhat.com<br>
> https://www.redhat.com/mailman/listinfo/libvirt-cim<br>
</font></tt>