[PATCH 0 of 3] [TEST] #2 Add CPU scheduling test.

This test corresponds to the recent CPU scheduling enhancement.

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1212719877 25200 # Node ID 59fce67164a22315bb712f692dfd93314c4f30e0 # Parent 727d97c09d77d73f3542ba49a9dd19ba119a67eb Remove bootloader from vsms.py in the Xen case. This looks like an old bug that was masked by some tests that are XFAILing. Since the cimtest guest uses a ramdisk, we should not set a bootloader for paravirtualized guests. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 727d97c09d77 -r 59fce67164a2 suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Tue Jun 10 18:26:20 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Jun 05 19:37:57 2008 -0700 @@ -105,8 +105,6 @@ elif type == 'LXC': self.InitPath = const.LXC_init_path else: - self.Bootloader = live.bootloader(Globals.CIM_IP, 0) - self.BootloaderArgs = '' self.Kernel = const.Xen_kernel_path self.Ramdisk = const.Xen_init_path

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1214156795 25200 # Node ID a379b9abb12cffae8e19c5db0e312df0581b9541 # Parent 59fce67164a22315bb712f692dfd93314c4f30e0 [TEST] #2 Add generic poll function to poll for guest state. Updates from patch 1 to 2: -Added timeout as a parameter - still has defualt value of 30 -Added a check to verify the Name of the CS instance returned matches the name of the guest we're polling for. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 59fce67164a2 -r a379b9abb12c suites/libvirt-cim/lib/XenKvmLib/common_util.py --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Thu Jun 05 19:37:57 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Sun Jun 22 10:46:35 2008 -0700 @@ -23,6 +23,7 @@ import os import pywbem import random +from time import sleep from distutils.file_util import move_file from XenKvmLib.test_xml import * from XenKvmLib.test_doms import * @@ -135,6 +136,32 @@ return 1 return 0 + +def poll_for_state_change(server, virt, dom, exp_state, timeout=30): + cs = computersystem.get_cs_class(virt) + + try: + for i in range(1, (timeout + 1)): + sleep(1) + dom_cs = cs(server, name=dom) + if dom_cs is None or dom_cs.Name != dom: + logger.error("CS instance not returned for %s." % dom) + return FAIL + + if dom_cs.EnabledState == exp_state: + break + + except Exception, detail: + logger.error("Exception: %s" % detail) + return FAIL + + if dom_cs.EnabledState != exp_state: + logger.error("EnabledState is %i instead of %i." % (dom_cs.EnabledState, + exp_state)) + logger.error("Try to increase the timeout and run the test again") + return FAIL + + return PASS def get_host_info(server, virt="Xen"): status = PASS

+1 for me. Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1214156795 25200 # Node ID a379b9abb12cffae8e19c5db0e312df0581b9541 # Parent 59fce67164a22315bb712f692dfd93314c4f30e0 [TEST] #2 Add generic poll function to poll for guest state.
Updates from patch 1 to 2: -Added timeout as a parameter - still has defualt value of 30 -Added a check to verify the Name of the CS instance returned matches the name of the guest we're polling for.
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r 59fce67164a2 -r a379b9abb12c suites/libvirt-cim/lib/XenKvmLib/common_util.py --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Thu Jun 05 19:37:57 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Sun Jun 22 10:46:35 2008 -0700 @@ -23,6 +23,7 @@ import os import pywbem import random +from time import sleep from distutils.file_util import move_file from XenKvmLib.test_xml import * from XenKvmLib.test_doms import * @@ -135,6 +136,32 @@ return 1
return 0 + +def poll_for_state_change(server, virt, dom, exp_state, timeout=30): + cs = computersystem.get_cs_class(virt) + + try: + for i in range(1, (timeout + 1)): + sleep(1) + dom_cs = cs(server, name=dom) + if dom_cs is None or dom_cs.Name != dom: + logger.error("CS instance not returned for %s." % dom) + return FAIL + + if dom_cs.EnabledState == exp_state: + break + + except Exception, detail: + logger.error("Exception: %s" % detail) + return FAIL + + if dom_cs.EnabledState != exp_state: + logger.error("EnabledState is %i instead of %i." % (dom_cs.EnabledState, + exp_state)) + logger.error("Try to increase the timeout and run the test again") + return FAIL + + return PASS
def get_host_info(server, virt="Xen"): status = PASS
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1213896959 25200 # Node ID 1f1365baac0e8cc5790533d9bb79d9c06eb68402 # Parent a379b9abb12cffae8e19c5db0e312df0581b9541 [TEST] #2 Define and create guest with CPU scheduling values set. Verify these values after the guest starts. KVM doesn't support CPU scheduling. For KVM guests, this test just verfies that the guest can be created and defined when CPU scheduling values are defined in the ProcRASD that's passed in to the DefineSystem() call. Updates from patch 1 to 2: -Change check_proc_pinning() to check_proc_sched() since this test is verifying vcpu scheduling. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r a379b9abb12c -r 1f1365baac0e suites/libvirt-cim/cimtest/VirtualSystemManagementService/09_procrasd_persist.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/09_procrasd_persist.py Thu Jun 19 10:35:59 2008 -0700 @@ -0,0 +1,137 @@ +#!/usr/bin/python +# +# Copyright 2008 IBM Corp. +# +# Authors: +# Kaitlin Rupert <karupert@us.ibm.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +import sys +import pywbem +from XenKvmLib.common_util import call_request_state_change, \ + poll_for_state_change +from XenKvmLib import vsms +from VirtLib import utils +from CimTest.Globals import logger +from CimTest.Globals import do_main +from CimTest.ReturnCodes import FAIL, PASS +from XenKvmLib.test_doms import destroy_and_undefine_domain + +sup_types = ['Xen', 'XenFV', 'KVM'] +default_dom = 'rstest_domain' + +nvcpu = 2 +weight = 124 +limit = 256 + +REQUESTED_STATE = 2 +TIME = "00000000000000.000000:000" + +def setup_rasd_mof(ip, vtype): + vssd, rasd = vsms.default_vssd_rasd_str(default_dom, virt=vtype) + + class_pasd = vsms.get_pasd_class(vtype) + proc_inst = class_pasd(nvcpu, default_dom, weight, limit) + proc_mof = proc_inst.mof() + + for i in range(len(rasd)): + if "ProcResourceAllocationSettingData" in rasd[i]: + rasd[i] = proc_mof + return PASS, vssd, rasd + + return FAIL, vssd, rasd + +def check_sched_info(str, exp_val, server, virt): + if str == "limit": + virsh_val = "cap" + else: + virsh_val = str + + 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(): + 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 + +@do_main(sup_types) +def main(): + options = main.options + + status, vssd, rasd = setup_rasd_mof(options.ip, options.virt) + if status != PASS: + return status + + try: + service = vsms.get_vsms_class(options.virt)(options.ip) + + service.DefineSystem(SystemSettings=vssd, + ResourceSettings=rasd, + ReferenceConfiguration=' ') + + rc = call_request_state_change(default_dom, options.ip, + REQUESTED_STATE, TIME, options.virt) + if rc != 0: + raise Exception("Unable to start %s using RequestedStateChange()" % + default_dom) + + status = poll_for_state_change(options.ip, options.virt, default_dom, + REQUESTED_STATE) + 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 = PASS + + except Exception, details: + logger.error(details) + status = FAIL + + destroy_and_undefine_domain(default_dom, options.ip, options.virt) + + return status + +if __name__ == "__main__": + sys.exit(main()) + diff -r a379b9abb12c -r 1f1365baac0e suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Sun Jun 22 10:46:35 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Jun 19 10:35:59 2008 -0700 @@ -174,7 +174,7 @@ pass class CIM_ProcResourceAllocationSettingData(CIMClassMOF): - def __init__(self, vcpu, name): + def __init__(self, vcpu, name, weight=None, limit=None): self.ResourceType = RASD_TYPE_PROC if vcpu != None: @@ -182,6 +182,12 @@ if name != None: self.InstanceID = '%s/proc' % name + + if weight != None: + self.Weight = weight + + if limit != None: + self.Limit = limit class Xen_ProcResourceAllocationSettingData(CIM_ProcResourceAllocationSettingData): pass
participants (2)
-
Deepti B Kalakeri
-
Kaitlin Rupert