[Libvirt-cim] [PATCH 2 of 3] [TEST] Fix VSSD mof generation

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Oct 17 19:38:32 UTC 2008


>> diff -r bbd83da2f0f6 -r 31fca7629bd7 
>> suites/libvirt-cim/lib/XenKvmLib/vsms.py
>> --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py    Wed Oct 08 18:18:48 
>> 2008 -0700
>> +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py    Wed Oct 15 19:13:10 
>> 2008 -0700
>> @@ -108,7 +108,6 @@
>>              self.Kernel = const.Xen_kernel_path
>>              self.Ramdisk = const.Xen_init_path
>>   -
>>  class Xen_VirtualSystemSettingData(CIM_VirtualSystemSettingData):
>>      pass
>>
>> @@ -118,9 +117,10 @@
>>  class LXC_VirtualSystemSettingData(CIM_VirtualSystemSettingData):
>>      pass
>>
>> - at eval_cls('VirtualSystemSettingData')
>> -def get_vssd_class(virt):
>> -    pass
>> +def get_vssd_mof(virt, dom_name):
>> +    vssd_cn = eval(get_typed_class(virt, "VirtualSystemSettingData"))
>> +    vssd = vssd_cn(dom_name, virt)
>>   
> I did not get the difference between vssd_cn and vssd assignments, both 
> of them evaluate to classobj XenKvmLib.vsms.Xen_VirtualSystemSettingData.
>> +    return vssd.mof()
>>

If you print vssd_cn, you'll get:

XenKvmLib.vsms.KVM_VirtualSystemSettingData

If you print vssd, you'll get mof syntax.

================================

To see why this change is needed, you can apply the following patch. 
Run it once with:

    return vssd
    #return vssd.mof()

Then run it again with

    #return vssd
    return vssd.mof()

In the first case, the VSSD object is: 
<XenKvmLib.vsms.KVM_VirtualSystemSettingData instance at 0x217a320>

In the second, it's a properly formatted MOF, which is what the CIMOM is 
expecting.


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1224271624 25200
# Node ID 93edf76620526b54e527de006ad3c2d587c725a3
# Parent  16ed883b2d333bfe73059c319b011e5fe6153ae8
Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 16ed883b2d33 -r 93edf7662052 lib/CimTest/CimExt.py
--- a/lib/CimTest/CimExt.py     Wed Oct 15 19:13:10 2008 -0700
+++ b/lib/CimTest/CimExt.py     Fri Oct 17 12:27:04 2008 -0700
@@ -29,6 +29,8 @@
          return _Method(self.__invoker, "%s.%s" % (self.__name, name))

      def __call__(self, **args):
+        print "\n"
+        print args
          return self.__invoker(self.__name, args)


diff -r 16ed883b2d33 -r 93edf7662052 
suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
--- 
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py 
   Wed Oct 15 19:13:10 2008 -0700
+++ 
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py 
   Fri Oct 17 12:27:04 2008 -0700
@@ -92,6 +92,7 @@

      destroy_and_undefine_domain(test_dom, options.ip, options.virt)

+    return FAIL
      return status

  if __name__ == "__main__":
diff -r 16ed883b2d33 -r 93edf7662052 
suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py  Wed Oct 15 19:13:10 2008 
-0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py  Fri Oct 17 12:27:04 2008 
-0700
@@ -119,8 +119,14 @@

  def get_vssd_mof(virt, dom_name):
      vssd_cn = eval(get_typed_class(virt, "VirtualSystemSettingData"))
+    print vssd_cn
+    print "\n"
      vssd = vssd_cn(dom_name, virt)
-    return vssd.mof()
+    print vssd
+    print "\n"
+    print vssd.mof()
+    return vssd
+    #return vssd.mof()

  # classes to define RASD parameters
  class CIM_DiskResourceAllocationSettingData(CIMClassMOF):



-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list