[Libvirt-cim] [PATCH] [TEST] Fixed the RASD/07_parent_disk_pool.py

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Fri Jul 17 11:47:05 UTC 2009


# HG changeset patch
# User Deepti B.Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1247831194 25200
# Node ID d78ebff2b762c75fec14de6bb4a012146ec4b86b
# Parent  14b666e2a803048c1ce4e71b550a49c62915b3a3
[TEST] Fixed the RASD/07_parent_disk_pool.py

Verified with KVM  and current sources on F10 and SLES11.
Signed-off-by: Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>

diff -r 14b666e2a803 -r d78ebff2b762 suites/libvirt-cim/cimtest/RASD/07_parent_disk_pool.py
--- a/suites/libvirt-cim/cimtest/RASD/07_parent_disk_pool.py	Thu Jul 16 07:28:51 2009 -0700
+++ b/suites/libvirt-cim/cimtest/RASD/07_parent_disk_pool.py	Fri Jul 17 04:46:34 2009 -0700
@@ -51,7 +51,7 @@
 from XenKvmLib.pool import get_pool_rasds
 
 sup_types = ['KVM', 'Xen', 'XenFV']
-DISKPOOL_REC_LEN = 3
+DISKPOOL_REC_LEN = 7
 
 def get_rec(diskpool_rasd, inst_id='Default'):
     recs = []
@@ -72,14 +72,21 @@
     inst_list = [ 'Default', 'Minimum', 'Maximum', 'Increment' ]
     n_rec_val = { 'ResourceType' : 17,
                   'PoolID'       : "DiskPool/0",
-                  'Path'         : "/dev/null",
                 }
-    exp_type_path_host_dir = [('1', 'None', 'None', 'None'),
-                              ('2', '/dev/sda100', 'None', 'None'), 
-                              ('3', 'None', 'host_sys.domain.com', 
-                               '/var/lib/images')]
-                    
-                  
+
+    pval = "/dev/null"
+    exp_t_dp_h_sdir_path =  sorted([(1L, None, None, None, pval),
+                                    (2L, [u'/dev/sda100'], None, None, pval), 
+                                    (3L, None, u'host_sys.domain.com', 
+                                    u'/var/lib/images', pval), 
+                                    (4L, [u'/dev/VolGroup00/LogVol100'], 
+                                    None, None, pval), 
+                                    (5L, [u'iscsi-target'], 
+                                    u'host_sys.domain.com', None, pval), 
+                                    (6L, None, None, None, pval), 
+                                    (7L, None, None, None, 
+                                    "/dev/disk/by-id")])
+
     for inst_type in inst_list:
         logger.info("Verifying '%s' records", inst_type)
 
@@ -89,17 +96,30 @@
                 raise Exception("Got %s recs instead of %s" %(len(n_rec), 
                                  DISKPOOL_REC_LEN))
 
-            res_type_path_host_dir = []
+            res_t_dp_h_sdir_path = []
             for rec in n_rec:
-                l = (str(rec['Type']), str(rec['DevicePath']), 
-                         str(rec['Host']), str(rec['SourceDirectory']))
-                res_type_path_host_dir.append(l)
+                l = ((rec['Type']), (rec['DevicePaths']), 
+                     (rec['Host']), (rec['SourceDirectory']),
+                     (rec['Path']))
+                res_t_dp_h_sdir_path.append(l)
+            res_t_dp_h_sdir_path = sorted(res_t_dp_h_sdir_path) 
 
-            if len(Set(exp_type_path_host_dir) & Set(res_type_path_host_dir)) \
-               != DISKPOOL_REC_LEN :
-                raise Exception("Mismatching values, \nGot %s,\nExpected %s"\
-                                 %(exp_type_path_host_dir, 
-                                   res_type_path_host_dir))
+            for exp_item in exp_t_dp_h_sdir_path:
+                i = 0
+                for j in range(0, len(exp_item)):
+                    exp_val = exp_t_dp_h_sdir_path[i][j]
+                    res_val = res_t_dp_h_sdir_path[i][j]
+                    if type(list).__name__ == 'list':
+                        cmp_exp = (len(Set(res_val) - Set(exp_val)) != 0)
+                    elif type(list).__name__ != 'NoneType':
+                        cmp_exp = (exp_val != res_val)
+                    elif type(list).__name__ == 'NoneType':
+                        continue
+
+                    if cmp_exp:
+                        raise Exception("Mismatching values, \nGot %s,\nExpected %s"\
+                                         %(exp_val, res_val))
+                i += 1
 
             for key in n_rec_val.keys():
                 for rec in n_rec:




More information about the Libvirt-cim mailing list