[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:22:09 UTC 2008


libvirt-cim-bounces at redhat.com wrote on 2008-10-07 19:49:24:

> +1 for the changes in this patch.
> Daisy, I have some more comments on the tc which is not part of the 
> changes you have made.
> At the end of the tc we have a for loop to verify the resourcepool 
details.
> With the existing changes we might get a false positive because before 
> entering the loop the status is already assigned to PASS by 
> get_host_info() call if it succeeds.
> After entering the for loop even when none of the if conditions match we 

> will still have the status set to PASS and there are possibilities of 
> the tc returning false positives because of the
> status already being set to PASS.
> Can you change the below in the tc :
> 
> 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
> To
> 
> 
> 
> 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 have anyother better ideas, you are welcome to do the changes 
> accordingly.

  Your idea sounds good to me. I cook up a patch for it.
  Thanks!
> 
> Thanks and Regards,
> Deepti.
> 
> yunguol at cn.ibm.com wrote:
> > # HG changeset patch
> > # User Guolian Yun <yunguol at cn.ibm.com>
> > # Date 1223359324 25200
> > # Node ID d81c2122fff796c7a08eb45cfe679f2e690e27bf
> > # Parent  311bf6eda3786eb8e47ede06c4da6dc1570aff61
> > [TEST] Fix HostedResourcePool/01_forward.py to work with sblim 
> base provider installed
> >
> > Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>
> >
> > diff -r 311bf6eda378 -r d81c2122fff7 suites/libvirt-
> cim/cimtest/HostedResourcePool/01_forward.py
> > --- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py 
> Sun Oct 05 23:56:40 2008 -0700
> > +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py 
> Mon Oct 06 23:02:04 2008 -0700
> > @@ -26,13 +26,15 @@ import sys
> >  import sys
> >  from XenKvmLib import assoc
> >  from XenKvmLib import enumclass
> > +from XenKvmLib.common_util import get_host_info
> >  from XenKvmLib.const import default_network_name
> >  from CimTest import Globals
> >  from CimTest.Globals import logger
> > -from CimTest.ReturnCodes import PASS, FAIL
> > +from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
> >  from XenKvmLib.const import do_main, default_pool_name
> >  from XenKvmLib.classes import get_typed_class
> >
> > +bug = '00007'
> >  sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
> >  @do_main(sup_types)
> >  def main():
> > @@ -40,19 +42,17 @@ def main():
> >      status = FAIL
> >
> >      keys = ['Name', 'CreationClassName']
> > -    try:
> > -        host_sys = enumclass.enumerate(options.ip, 'HostSystem', 
> keys, options.virt)[0]
> > -    except Exception:
> > -        host_cn = get_typed_class(options.virt, "HostSystem")
> > -        logger.error(Globals.CIM_ERROR_ENUMERATE % host_cn)
> > +    status, host_sys, host_cn = get_host_info(options.ip, 
options.virt)
> > +    if status != PASS:
> > +        logger.error("Error in calling get_host_info function")
> >          return FAIL
> >      try:
> >          assoc_cn = get_typed_class(options.virt, 
"HostedResourcePool")
> >          pool = assoc.AssociatorNames(options.ip,
> >                                       assoc_cn,
> > -                                     host_sys.CreationClassName,
> > -                                     Name = host_sys.Name,
> > -                                     CreationClassName = 
> host_sys.CreationClassName)
> > +                                     host_cn,
> > +                                     Name = host_sys,
> > +                                     CreationClassName = host_cn)
> >      except Exception, details:
> >          logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % assoc_cn)
> >          logger.error("Exception:",  details)
> > @@ -62,8 +62,11 @@ def main():
> >          logger.error("System association failed")
> >          return FAIL
> >      elif len(pool) == 0:
> > -        logger.error("No pool returned")
> > -        return FAIL
> > +        if host_cn == 'Linux_ComputerSystem':
> > +            return XFAIL_RC(bug)
> > +        else:
> > +            logger.error("No pool returned")
> > +            return FAIL
> > 
> >      for items in pool:
> >          cname = items.classname
> >
> > _______________________________________________
> > Libvirt-cim mailing list
> > Libvirt-cim at redhat.com
> > https://www.redhat.com/mailman/listinfo/libvirt-cim
> > 
> 
> _______________________________________________
> 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/2596db39/attachment.htm>


More information about the Libvirt-cim mailing list