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