[Libvirt-cim] [PATCH] [TEST]#2 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message

yunguol at cn.ibm.com yunguol at cn.ibm.com
Fri Mar 6 03:17:36 UTC 2009


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1236309447 28800
# Node ID 7e6e1318706b1b4e6b39d703b663c70a0972b778
# Parent  c6f7256013b97dc57a31312897e45eb3cd8604a7
[TEST]#2 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message


Updates form 1 to 2:
Use a variable to assign revision value to be calculated for comparison

Also fix the line to meet 80 length

Tested for KVM/LXC with current sources and rpm

Signed-off-by: Guolian Yun<yunguol at cn.ibm.com>

diff -r c6f7256013b9 -r 7e6e1318706b suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py	Tue Mar 03 08:47:40 2009 -0800
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py	Thu Mar 05 19:17:27 2009 -0800
@@ -27,10 +27,11 @@
 from XenKvmLib import enumclass
 from XenKvmLib.classes import get_typed_class
 from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS 
-from XenKvmLib.const import do_main
+from XenKvmLib.const import do_main, get_provider_version
 from CimTest.ReturnCodes import PASS, FAIL
 
 sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+libvirt_ec_changes = 815
 
 exp_rc = 6 #CIM_ERR_NOT_FOUND
 exp_desc = "No such instance"
@@ -42,23 +43,24 @@
     status = FAIL
     rc = -1
     names = []
-
+    ec = get_typed_class(options.virt, "ElementCapabilities")
     try:
-        names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities"))
+        names = conn.AssociatorNames(ref, AssocClass = ec)
         rc = 0
     except pywbem.CIMError, (rc, desc):
         if rc == exp_rc and desc.find(exp_desc) >= 0:
             logger.info("Got expected rc code and error string")
             status = PASS
         else:
-            logger.error("Unexpected rc code %s and description %s\n", rc, desc)
+            logger.error("Unexpected rc code %s and description %s\n", rc, 
+                          desc)
     except Exception, details:
         logger.error("Unknown exception happened")
         logger.error(details)
 
     if rc == 0:
-        logger.error("ElementCapabilities associator should NOT return excepted \
-                      result with a wrong key name and value of %s input", ref_class)
+        logger.error("ElementCapabilities associator should NOT" + \
+                     " return records with a wrong key name and value")
         status = FAIL
      
     return status
@@ -73,7 +75,8 @@
     cs = get_typed_class(options.virt, "ComputerSystem")
 
     instanceref = CIMInstanceName(hs,
-                                  keybindings = {"Name" : "wrong", "CreationClassName" : "wrong"})
+                                  keybindings = {"Name" : "wrong", 
+                                  "CreationClassName" : "wrong"})
     rc = try_assoc(instanceref, hs, exp_rc, exp_desc, options)
     
     if rc != PASS:
@@ -81,8 +84,16 @@
         return status
 
     instance_cs = CIMInstanceName(cs,
-                                  keybindings = {"Name" : "wrong", "CreationClassName" : "Xen_ComputerSystem"})
-    rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
+                                  keybindings = {"Name" : "wrong", 
+                                  "CreationClassName" : "Xen_ComputerSystem"})
+
+    curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+    if curr_cim_rev >= libvirt_ec_changes:
+        cs_exp_desc = "Referenced domain `wrong' does not exist:" + \
+                      " Domain not found"
+        try_assoc(instance_cs, cs, exp_rc, cs_exp_desc, options)
+    else:
+        rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
     if rc != PASS:
         status = FAIL         
         return status




More information about the Libvirt-cim mailing list