<br><tt><font size=2>libvirt-cim-bounces@redhat.com wrote on 2008-09-23
08:46:00:<br>
<br>
> > @@ -43,27 +44,35 @@ def main():<br>
> >     <br>
> >      status = FAIL<br>
> >      keys = ['Name', 'CreationClassName']<br>
> > -    try:<br>
> > -        hs = enumclass.enumerate(options.ip,
'HostSystem', keys, <br>
> options.virt)<br>
> > -        name = get_typed_class(options.virt,
'HostSystem')<br>
> > +<br>
> > +    linux_cs = enumclass.enumerate(options.ip, 'ComputerSystem',
<br>
> keys, 'Linux')<br>
> <br>
> I think this would be a good chance to fix the behavior of the <br>
> enumerate() function.  Instead of passing in both the base name
and the <br>
> virtualization type, the test itself should call get_typed_class()
to <br>
> get the proper classname.  That way, this function only needs
to take a <br>
> classname param.</font></tt>
<br>
<br><tt><font size=2>  Good idea. But a lot of tests have to update
with the behavior of enumerate() function fix.</font></tt>
<br><tt><font size=2>  At now, I put fixing HostSystem-01_enum.py
with sblim cmpi base provider installed in high</font></tt>
<br><tt><font size=2>  priority, so I sill use current enumereate()
in my patch. Once it applied, I will start </font></tt>
<br><tt><font size=2>  to cook up new enumerate() function and update
all related tests.</font></tt>
<br>
<br><tt><font size=2>  Thanks!</font></tt>
<br><tt><font size=2>  <br>
> <br>
> You'll also need to set the namespace appropriately before calling
this <br>
> function.  Since you'll need to do this in several places, you
could <br>
> create a function that checks whether the system has the SBLIM providers
<br>
> or not. A function that returns a True if the enum of Linux_CS returns
<br>
> an instance or returns False if Linux_CS returns an error / 0 instances.<br>
> <br>
> > +    hs = enumclass.enumerate(options.ip, 'HostSystem',
keys, options.virt)<br>
> > +    if len(linux_cs) == 1 and len(hs) == 0:<br>
> > +        return PASS<br>
> > +    if len(linux_cs) == 0 and len(hs) == 0:<br>
> <br>
> A debug statement here would be good.<br>
> <br>
> > +        return XFAIL_RC(bug)<br>
> > +    elif len(linux_cs) == 0 and len(hs)== 1: <br>
> <br>
> What about the case where len(linux_cs) == 1 and len(hs) == 1?  This
<br>
> scenario should be an error.<br>
> <br>
> So fixing this if / else block would be good.  You could have
something <br>
> like:<br>
> <br>
> ret = using_sblim()<br>
> if ret:<br>
>      #verify HostSystem enum didn't return an instance
and return <br>
> accordingly<br>
> <br>
> try:<br>
>     #rest of the test here<br>
> <br>
> > +        try:<br>
> > +            hs = enumclass.enumerate(options.ip,
'HostSystem', <br>
> keys, options.virt)<br>
> <br>
> This is no longer needed - you already called enumerate() above.<br>
> <br>
> > <br>
> > diff -r 892ce3fce234 -r 83e6f32be2ae suites/libvirt-<br>
> cim/lib/XenKvmLib/classes.py<br>
> > --- a/suites/libvirt-cim/lib/XenKvmLib/classes.py   Fri
Sep 12 14:<br>
> 35:12 2008 -0700<br>
> > +++ b/suites/libvirt-cim/lib/XenKvmLib/classes.py   Sun
Sep 21 22:<br>
> 54:28 2008 -0700<br>
> > @@ -23,6 +23,8 @@ virt_types = ['Xen', 'KVM', 'XenFV', 'LX<br>
> > <br>
> >  def get_typed_class(virt, basename):<br>
> >      if virt not in virt_types:<br>
> <br>
> I'd remove this if statement.<br>
> <br>
> > +        if virt == "Linux" and
basename == "ComputerSystem":<br>
> > +            return 'Linux_ComputerSystem'
<br>
> <br>
> Which would make this part unnecessary.<br>
> <br>
> >          if virt != "Virt"
and basename != "MigrationJob":<br>
> >              raise ValueError('Invalid
class type')<br>
> <br>
> This is obsolete now - so we need a separate patch to remove this
piece.<br>
> </font></tt>
<br><tt><font size=2>  </font></tt>
<br><tt><font size=2>  Follow patch I will sent out later. </font></tt>
<br><tt><font size=2><br>
> > <br>
> > diff -r 892ce3fce234 -r 83e6f32be2ae suites/libvirt-<br>
> cim/lib/XenKvmLib/enumclass.py<br>
> > --- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py   Fri
Sep 12 <br>
> 14:35:12 2008 -0700<br>
> > +++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py   Sun
Sep 21 <br>
> 22:54:28 2008 -0700<br>
> > @@ -68,6 +68,9 @@ class CIM_ComputerSystem(CIM_MyClass):<br>
> >      pass<br>
> > <br>
> >  class CIM_System(CIM_MyClass):<br>
> > +    pass<br>
> > +<br>
> > +class Linux_ComputerSystem(CIM_MyClass):<br>
> >      pass<br>
> <br>
> The MyClass extension is very useful, but I concerned that the list
will <br>
> just continue to grow. I don't think it's very scalable at this point.
<br>
> and I'd like to keep the amount of SBLIM specific bits to a minimum.<br>
> <br>
> This test case doesn't make use of the CIM_MyClass pieces from what
I <br>
> can tell.  So I think it's safe to remove this.<br>
> <br>
> -- <br>
> Kaitlin Rupert<br>
> IBM Linux Technology Center<br>
> kaitlin@linux.vnet.ibm.com<br>
> <br>
> _______________________________________________<br>
> Libvirt-cim mailing list<br>
> Libvirt-cim@redhat.com<br>
> https://www.redhat.com/mailman/listinfo/libvirt-cim<br>
</font></tt>