[Libvirt-cim] [PATCH] [TEST] Fixing 41_cs_to_settingdefinestate.py tc of CS to work with the latest libvirt-cim changes

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Thu Dec 18 12:23:31 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1229602962 28800
# Node ID ff966617a775d47376459a69aca191f5367874dd
# Parent  adfa38df8c3b9600ff08796631c0eae7d3249ffe
[TEST] Fixing 41_cs_to_settingdefinestate.py tc of CS to work with the latest libvirt-cim changes.

Libvirt-cim now supports GraphicsRASD for revision >=725 and InputRASD >= 746, hence
updating/fixing  the tc to accomodate these changes.

Tested with KVM on F9 , Xen/KVM with current sources.

Signed-off-by: Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>

diff -r adfa38df8c3b -r ff966617a775 suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py	Tue Dec 16 23:18:31 2008 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py	Thu Dec 18 04:22:42 2008 -0800
@@ -68,9 +68,12 @@ from CimTest.ReturnCodes import PASS, FA
 from CimTest.ReturnCodes import PASS, FAIL
 from XenKvmLib import rasd
 from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
-verify_diskrasd_values, verify_memrasd_values, rasd_init_list
+                           verify_diskrasd_values, verify_memrasd_values, \
+                           verify_displayrasd_values, verify_inputrasd_values,\
+                           rasd_init_list
 from XenKvmLib.common_util import poll_for_state_change
 from XenKvmLib.classes import get_typed_class
+from XenKvmLib.const import get_provider_version
 
 sup_types = ['Xen', 'XenFV', 'KVM']
 
@@ -78,6 +81,8 @@ test_vcpus  = 1
 test_vcpus  = 1
 test_mem    = 128
 test_mac    = "00:11:22:33:44:aa"
+libvirt_graphics_changes  = 725
+libvirt_input_dev_changes = 746
 
 def vssd_init_list(virt):
     """
@@ -201,6 +206,8 @@ def get_SDS_verify_RASD_build_vssdc_inpu
     mrasd = get_typed_class(virt, 'MemResourceAllocationSettingData')
     nrasd = get_typed_class(virt, 'NetResourceAllocationSettingData')
     drasd = get_typed_class(virt, 'DiskResourceAllocationSettingData') 
+    dcrasd = get_typed_class(virt,'GraphicsResourceAllocationSettingData')
+    irasd  = get_typed_class(virt,'InputResourceAllocationSettingData')
 
     try:
 
@@ -211,12 +218,26 @@ def get_SDS_verify_RASD_build_vssdc_inpu
                 deviceid =  sd_assoc_info[i]['DeviceID']
                 in_setting_define_state[classname_keyvalue] = deviceid
 
-        # Expect the SystemDevice to return 4 logical device records.
-        # one each for memory, network, disk and processor and hence 4.
-        # and hence expect the in_setting_define_state to contain just 4 entries.
+        # Expect the SystemDevice to return 
+        # 4 logical device records for libvirt-cim revision < 725.
+        # one each for memory, network, disk and processor
+        # 5 logical device records for libvirt-cim revision >= 725 < 746.
+        # one each for memory, network, disk and processor, graphics
+        # 6 logical device records for libvirt-cim revision >= 746.
+        # one each for memory, network, disk and processor, input, graphics
+        # and hence expect the in_setting_define_state to contain 4,5,6 
+        # enteries depending on the revision.
         an  = get_typed_class(virt, "SystemDevice")
         qcn = "Logical Devices"
-        exp_len = 4
+        curr_cim_rev, changeset = get_provider_version(virt, server)
+        if curr_cim_rev < libvirt_graphics_changes:
+            exp_len = 4
+        elif curr_cim_rev >= libvirt_graphics_changes and \
+             curr_cim_rev < libvirt_input_dev_changes:
+            exp_len = 5
+        elif curr_cim_rev >= libvirt_input_dev_changes:
+            exp_len = 6
+
         if check_len(an, in_setting_define_state, qcn, exp_len) != PASS:
             return FAIL, in_setting_define_state
 
@@ -256,8 +277,13 @@ def get_SDS_verify_RASD_build_vssdc_inpu
                 status = verify_diskrasd_values(assoc_info[index], rasd)
             elif CCName == mrasd:
                 status  = verify_memrasd_values(assoc_info[index], rasd)
+            elif CCName == dcrasd:
+                status = verify_displayrasd_values(assoc_info[index], rasd)
+            elif CCName == irasd:
+                status = verify_inputrasd_values(assoc_info[index], rasd)
             else:
                 status = FAIL
+
             if status != PASS:
                 logger.error("Mistmatching RASD values" )
                 break
@@ -354,15 +380,29 @@ def main():
         return status
 
     status, in_vssdc_list = get_SDS_verify_RASD_build_vssdc_input(server, virt,
-                                                                  vsxml, test_disk,
+                                                                  vsxml, 
+                                                                  test_disk,
                                                                   sd_assoc_info)
     if status != PASS or len(in_vssdc_list) == 0 :
         vsxml.destroy(server)
         return status
 
-    # Verifying that the in_vssdc_list contains 4 entries one each for mem rasd,
-    # network rasd, processor rasd and disk rasd.
-    exp_len = 4
+    # Verifying that the in_vssdc_list contains 
+    # 4 entries one each for mem rasd, network rasd, processor rasd and 
+    # disk rasd for libvirt-cim revision < 725 
+    # 5 entries one each for mem rasd, network rasd, processor rasd and 
+    # disk rasd, graphics rasd for libvirt-cim revision >= 725 and < 746 
+    # 6 entries one each for mem rasd, network rasd, processor rasd and 
+    # disk rasd, graphics rasd, input rasd for 
+    # libvirt-cim revision >= 746 
+    curr_cim_rev, changeset = get_provider_version(virt, server)
+    if curr_cim_rev < libvirt_graphics_changes:
+        exp_len = 4
+    elif curr_cim_rev >= libvirt_graphics_changes and \
+         curr_cim_rev < libvirt_input_dev_changes:
+        exp_len = 5
+    elif curr_cim_rev >= libvirt_input_dev_changes:
+        exp_len = 6
     if check_len(an, in_vssdc_list, qcn, exp_len) != PASS:
         vsxml.destroy(server)
         return FAIL 




More information about the Libvirt-cim mailing list