[Libvirt-cim] [PATCH] [TEST]#2 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message

Guo Lian Yun yunguol at cn.ibm.com
Mon Mar 9 02:43:15 UTC 2009


Libvirt-cim-bounces at redhat.com wrote on 2009-03-06 15:21:46:

> 
> 
> yunguol at cn.ibm.com wrote:
> > # HG changeset patch
> > # User Guolian Yun <yunguol at cn.ibm.com>
> > # Date 1236309447 28800
> > # Node ID 7e6e1318706b1b4e6b39d703b663c70a0972b778
> > # Parent  c6f7256013b97dc57a31312897e45eb3cd8604a7
> > [TEST]#2 Fix ElementCapabilities/03_forward_errs.py with 
> provider's updated err message
> >
> >
> > Updates form 1 to 2:
> > Use a variable to assign revision value to be calculated for 
comparison
> >
> > Also fix the line to meet 80 length
> >
> > Tested for KVM/LXC with current sources and rpm
> >
> > Signed-off-by: Guolian Yun<yunguol at cn.ibm.com>
> >
> > diff -r c6f7256013b9 -r 7e6e1318706b suites/libvirt-
> cim/cimtest/ElementCapabilities/03_forward_errs.py
> > --- a/suites/libvirt-
> cim/cimtest/ElementCapabilities/03_forward_errs.py   Tue Mar 03 08:
> 47:40 2009 -0800
> > +++ b/suites/libvirt-
> cim/cimtest/ElementCapabilities/03_forward_errs.py   Thu Mar 05 19:
> 17:27 2009 -0800
> > @@ -27,10 +27,11 @@
> >  from XenKvmLib import enumclass
> >  from XenKvmLib.classes import get_typed_class
> >  from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS 
> > -from XenKvmLib.const import do_main
> > +from XenKvmLib.const import do_main, get_provider_version
> >  from CimTest.ReturnCodes import PASS, FAIL
> >
> >  sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
> > +libvirt_ec_changes = 815
> >
> >  exp_rc = 6 #CIM_ERR_NOT_FOUND
> >  exp_desc = "No such instance"
> > @@ -42,23 +43,24 @@
> >      status = FAIL
> >      rc = -1
> >      names = []
> > -
> > +    ec = get_typed_class(options.virt, "ElementCapabilities")
> >      try:
> > -        names = conn.AssociatorNames(ref, AssocClass = 
> get_typed_class(options.virt, "ElementCapabilities"))
> > +        names = conn.AssociatorNames(ref, AssocClass = ec)
> >          rc = 0
> >      except pywbem.CIMError, (rc, desc):
> >          if rc == exp_rc and desc.find(exp_desc) >= 0:
> >              logger.info("Got expected rc code and error string")
> >              status = PASS
> >          else:
> > -            logger.error("Unexpected rc code %s and description %
> s\n", rc, desc)
> > +            logger.error("Unexpected rc code %s and description 
%s\n", rc, 
> > +                          desc)
> >      except Exception, details:
> >          logger.error("Unknown exception happened")
> >          logger.error(details)
> >
> >      if rc == 0:
> > -        logger.error("ElementCapabilities associator should NOT 
> return excepted \
> > -                      result with a wrong key name and value of %
> s input", ref_class)
> > +        logger.error("ElementCapabilities associator should NOT" + \
> > +                     " return records with a wrong key name and 
value")
> > 
> You don't need a + sign here. \ will do.
> >          status = FAIL
> > 
> >      return status
> > @@ -73,7 +75,8 @@
> >      cs = get_typed_class(options.virt, "ComputerSystem")
> >
> >      instanceref = CIMInstanceName(hs,
> > -                                  keybindings = {"Name" : 
> "wrong", "CreationClassName" : "wrong"})
> > +                                  keybindings = {"Name" : "wrong", 
> > +                                  "CreationClassName" : "wrong"})
> >      rc = try_assoc(instanceref, hs, exp_rc, exp_desc, options)
> > 
> >      if rc != PASS:
> > @@ -81,8 +84,16 @@
> >          return status
> >
> >      instance_cs = CIMInstanceName(cs,
> > -                                  keybindings = {"Name" : 
> "wrong", "CreationClassName" : "Xen_ComputerSystem"})
> > -    rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
> > +                                  keybindings = {"Name" : "wrong", 
> > +                                  "CreationClassName" : 
> "Xen_ComputerSystem"})
> > 
> We should not hardcode CreationClassName to Xen_ComputerSystem.
> > +
> > +    curr_cim_rev, changeset = get_provider_version(options.virt, 
> options.ip)
> > +    if curr_cim_rev >= libvirt_ec_changes:
> > +        cs_exp_desc = "Referenced domain `wrong' does not exist:" + \
> > +                      " Domain not found"
> > 
> you dont need a + sign here. \ will work.
> > +        try_assoc(instance_cs, cs, exp_rc, cs_exp_desc, options)
> > 
> Can you check if you can use common_util.try_assoc() instead of writing 
> the try_assoc() function freshly here in the tc ?

  I will try to use common_util.try_assoc() here, but I think it should be 
sent 
  in a new patch. I will cook up a new patch to fix this.

  Thanks!

> > +    else:
> > +        rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
> >      if rc != PASS:
> >          status = FAIL 
> >          return status
> >
> > _______________________________________________
> > Libvirt-cim mailing list
> > Libvirt-cim at redhat.com
> > https://www.redhat.com/mailman/listinfo/libvirt-cim
> > 
> 
> -- 
> Thanks and Regards,
> Deepti B. Kalakeri
> IBM Linux Technology Center
> deeptik 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/20090309/48553ced/attachment.htm>


More information about the Libvirt-cim mailing list