[Libvirt-cim] [PATCH] [TEST] Fixing false positive and modifying the tc to use ProcRASD to verify the guest info

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Tue Oct 21 10:51:35 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1224586274 25200
# Node ID 8bcff8eaa5a2fc302d81df5791547bf510a9afb9
# Parent  c1ab00fe5a8fbc2483d4baa2eb436d9842f311be
[TEST] Fixing false positive and modifying the tc to use ProcRASD to verify the guest info.

1) The tc was returning a false positive for KVM since it was verifying the CPU values only for Xen and XenFV.
2) Used GetInstance on ProcRASD instead of virsh schedinfo to verify the weight and Limit values of the domain.

Tested with Xen, XenFV, KVM with current sources, without sblim-base-provider.

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

diff -r c1ab00fe5a8f -r 8bcff8eaa5a2 suites/libvirt-cim/cimtest/VirtualSystemManagementService/09_procrasd_persist.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/09_procrasd_persist.py	Tue Oct 21 01:31:11 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/09_procrasd_persist.py	Tue Oct 21 03:51:14 2008 -0700
@@ -25,6 +25,8 @@ from XenKvmLib.common_util import call_r
 from XenKvmLib.common_util import call_request_state_change, \
                                   poll_for_state_change 
 from XenKvmLib import vsms
+from XenKvmLib.enumclass import GetInstance
+from XenKvmLib.common_util import get_typed_class
 from VirtLib import utils 
 from CimTest.Globals import logger
 from XenKvmLib.const import do_main
@@ -55,38 +57,23 @@ def setup_rasd_mof(ip, vtype):
 
     return FAIL, vssd, rasd
 
-def check_sched_info(str, exp_val, server, virt):
-    if str == "limit":
-        virsh_val = "cap"
-    else:
-        virsh_val = str
+def check_proc_sched(server, virt):
+    try:
+        key_list = {"InstanceID" : '%s/proc' %default_dom}
+        cn_name  = get_typed_class(virt, 'ProcResourceAllocationSettingData')
+        proc = GetInstance(server, cn_name, key_list)
+   
+        if proc.Limit != limit:
+            logger.error("Limit is %i, expected %i", proc.Limit, limit)
+            return FAIL
 
-    cmd = "virsh -c %s schedinfo %s | awk '/%s/ { print \$3 }'" % \
-          (utils.virt2uri(virt), default_dom, virsh_val)
-    ret, out = utils.run_remote(server, cmd)
-    if not out.isdigit():
+        if proc.Weight != weight:
+            logger.error("Weight is %i, expected %i", proc.Weight, weight)
+            return FAIL
+
+    except Exception, details:
+        logger.error("Exception: details %s", details)
         return FAIL
-
-    try:
-        val = int(out)
-    except ValueError:
-        val = -1
-
-    if val != exp_val: 
-        logger.error("%s is %i, expected %i" % (str, val, exp_val))
-        return FAIL
-
-    return PASS
-
-def check_proc_sched(server, virt):
-    attr_list = { "weight" : weight,
-                  "limit"  : limit
-                }
-   
-    for k, v in attr_list.iteritems():
-        status = check_sched_info(k, v, server, virt)
-        if status != PASS:
-            return FAIL
 
     return PASS
 
@@ -100,7 +87,6 @@ def main():
 
     try:
         service = vsms.get_vsms_class(options.virt)(options.ip)
-
         service.DefineSystem(SystemSettings=vssd,
                              ResourceSettings=rasd,
                              ReferenceConfiguration=' ')
@@ -116,16 +102,14 @@ def main():
         if status != PASS:
             raise Exception("%s didn't change state as expected" % default_dom)
 
-        if options.virt == "Xen" or options.virt == "XenFV":
-            status = check_proc_sched(options.ip, options.virt)
-            if status != PASS:
-                raise Exception("%s CPU scheduling not set properly" % 
-                                default_dom)
+        status = check_proc_sched(options.ip, options.virt)
+        if status != PASS:
+            raise Exception("%s CPU scheduling not set properly", default_dom)
 
         status = PASS
       
     except Exception, details:
-        logger.error(details)
+        logger.error("Exception: details %s", details)
         status = FAIL
 
     destroy_and_undefine_domain(default_dom, options.ip, options.virt)




More information about the Libvirt-cim mailing list