[Libvirt-cim] [PATCH] [TEST] Updated test to only verify disk RASD

Sharad Mishra snmishra at us.ibm.com
Fri Jan 14 15:52:06 UTC 2011


# HG changeset patch
# User Sharad Mishra <snmishra at us.ibm.com>
# Date 1295018716 28800
# Node ID 8866ff769a7637cbee7c793827152649856815f2
# Parent  2c9689c31d42c2320ecca7a4283bd564c5a27737
[TEST] Updated test to only verify disk RASD.

This test was written to look for disk and cdrom.
But default VM created by this test case only uses
disk and no cdrom. This test has been updated to
test for disk only.

Signed-off-by: Sharad Mishra <snmishra at us.ibm.com>

diff -r 2c9689c31d42 -r 8866ff769a76 suites/libvirt-cim/cimtest/RASD/05_disk_rasd_emu_type.py
--- a/suites/libvirt-cim/cimtest/RASD/05_disk_rasd_emu_type.py	Fri Jan 14 07:06:49 2011 -0800
+++ b/suites/libvirt-cim/cimtest/RASD/05_disk_rasd_emu_type.py	Fri Jan 14 07:25:16 2011 -0800
@@ -42,47 +42,43 @@
     if curr_cim_rev < libvirt_em_type_changeset:
         return SKIP
 
-    if options.virt == 'Xen':
-        emu_types = [0]
-    else:
-        emu_types = [0, 1]
+    exp_emu_type = 0
     try:
-        for exp_emu_type in emu_types:
-            virt_xml = get_class(options.virt)
-            cxml = virt_xml(default_dom, emu_type=exp_emu_type)
-            ret = cxml.cim_define(options.ip)
-            if not ret:
-                logger.error("Failed to call DefineSystem()")
-                return FAIL
+        virt_xml = get_class(options.virt)
+        cxml = virt_xml(default_dom, emu_type=exp_emu_type)
+        ret = cxml.cim_define(options.ip)
+        if not ret:
+            logger.error("Failed to call DefineSystem()")
+            return FAIL
     
-            drasd= get_typed_class(options.virt,
-                                   'DiskResourceAllocationSettingData')
+        drasd= get_typed_class(options.virt,
+                               'DiskResourceAllocationSettingData')
         
-            drasd_list = EnumInstances(options.ip, drasd, ret_cim_inst=True)
-            if len(drasd_list) < 1:
-                raise Exception("%s returned %i instances, expected at least 1"\
-                                %(drasd, len(drasd_list)))
+        drasd_list = EnumInstances(options.ip, drasd, ret_cim_inst=True)
+        if len(drasd_list) < 1:
+            raise Exception("%s returned %i instances, expected at least 1"\
+                            %(drasd, len(drasd_list)))
 
-            found_rasd = None
-            for rasd in drasd_list:
-                guest, dev, status = parse_instance_id(rasd['InstanceID'])
-                if status != PASS:
-                    raise Exception("Unable to parse InstanceID: %s" \
-                                    % rasd['InstanceID'])
-                if guest == default_dom:
-                    if rasd['EmulatedType'] == exp_emu_type:
-                        found_rasd = rasd
-                        status = PASS
-                        break
-                    else:
-                        raise Exception("EmulatedType Mismatch: got %d,"
-                                        "expected %d" %(rasd['EmulatedType'], 
-                                         exp_emu_type))
+        found_rasd = None
+        for rasd in drasd_list:
+            guest, dev, status = parse_instance_id(rasd['InstanceID'])
+            if status != PASS:
+                raise Exception("Unable to parse InstanceID: %s" \
+                                % rasd['InstanceID'])
+            if guest == default_dom:
+                if rasd['EmulatedType'] == exp_emu_type:
+                    found_rasd = rasd
+                    status = PASS
+                    break
+                else:
+                    raise Exception("EmulatedType Mismatch: got %d,"
+                                    "expected %d" %(rasd['EmulatedType'], 
+                                     exp_emu_type))
 
-            if found_rasd is None:
-                raise Exception("DiskRASD for defined dom was not found")
+        if found_rasd is None:
+            raise Exception("DiskRASD for defined dom was not found")
 
-            cxml.undefine(options.ip)
+        cxml.undefine(options.ip)
 
     except Exception, detail:
         logger.error("Exception: %s", detail)           




More information about the Libvirt-cim mailing list