[Libvirt-cim] [PATCH] [TEST] Fix HostedResourcePool/01_forward.py to work with sblim base provider installed

Guo Lian Yun yunguol at cn.ibm.com
Thu Oct 9 01:41:11 UTC 2008


libvirt-cim-bounces at redhat.com wrote on 2008-10-08 01:24:54:

> > status = FAIL
> > for items in pool:
> > cname = items.classname
> > if cname.find("MemoryPool") >=0 and items['InstanceID'] == 
"MemoryPool/0":
> > status = PASS
> > if cname.find("ProcessorPool") >=0 and items['InstanceID'] == 
> > "ProcessorPool/0":
> > status = PASS
> > if cname.find("NetworkPool") >=0 and \
> > items['InstanceID'] == "NetworkPool/%s" %default_network_name:
> > status = PASS
> > if cname.find("DiskPool") >=0 and \
> > items['InstanceID'] == "DiskPool/%s" % default_pool_name:
> > status = PASS
> > if status != PASS:
> > logger.error("HostedResourcePool information error")
> > return status
> > 
> 
> If you hit an error condition, the test should return - no point in 
> checking the other conditions when we already know we've failed.  Plus, 
> the error log message is really vague.
> 
> Instead, you could do something like:
> 
> try:
>    for items in pool:
>        cname = items.classname
>        if cname.find("MemoryPool") >=0 and items['InstanceID'] !=
>          "MemoryPool/0":
>            raise Exception("%s does not match MemoryPool/0", 
> items['InstanceID'])
> 
>        elif cname.find("ProcessorPool") >=0 and items['InstanceID'] !=
>          "ProcessorPool/0":
>            raise Exception("%s does not match ProcessorPool/0", 
> items['InstanceID'])
> 
>        elif cname.find("NetworkPool") >= 0 and \
>          items['InstanceID'] != "NetworkPool/%s" %default_network_name:
>            raise Exception("%s does not match NetworkPool/%s", 
> items['InstanceID'], default_network_name)
> 
>       elif cname.find("DiskPool") >= 0 and \
>          items['InstanceID'] != "DiskPool/%s" % default_pool_name:
>           raise Exception("%s does not match DiskPool/%s", 
> items['InstanceID'], default_pool_name)
> 
> except Exception, details:
>          logger.error(details)
>          return FAIL
> 
> return PASS
> 
> Kaitlin - That sounds good to me.
  Thanks!
> 
> 
> -- 
> Kaitlin Rupert
> IBM Linux Technology Center
> kaitlin at linux.vnet.ibm.com
> 
> _______________________________________________
> 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/20081009/df20502c/attachment.htm>


More information about the Libvirt-cim mailing list