[PATCH] [TEST] Modifying 02_profile_to_elec.py tc to:
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207310123 -19800
# Node ID e9825a1d392c5b70d5d58675b240f3a1a70ce102
# Parent ee93a545e27b467ac3cf473ace7ffdfd1930d880
[TEST] Modifying 02_profile_to_elec.py tc to:
1) Use the cim_define() function
2) Fixed the tc.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r ee93a545e27b -r e9825a1d392c suites/libvirt-cim/cimtest/Profile/02_profile_to_elec.py
--- a/suites/libvirt-cim/cimtest/Profile/02_profile_to_elec.py Fri Apr 04 15:35:16 2008 +0530
+++ b/suites/libvirt-cim/cimtest/Profile/02_profile_to_elec.py Fri Apr 04 17:25:23 2008 +0530
@@ -38,11 +38,10 @@
# ComputerSystem instance of the guest.
import sys
-import pywbem
from XenKvmLib import enumclass
from XenKvmLib.assoc import Associators
-from XenKvmLib.common_util import create_using_definesystem
-from XenKvmLib.test_doms import undefine_test_domain, destroy_and_undefine_all
+from XenKvmLib.vxml import get_class
+from XenKvmLib.test_doms import destroy_and_undefine_all
from CimTest import Globals
from CimTest.Globals import log_param, logger, CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORNAMES
from CimTest.Globals import do_main
@@ -55,14 +54,15 @@ def setup_env(server):
def setup_env(server):
rc = -1
status = PASS
-
+ csxml_info = None
try:
destroy_and_undefine_all(server)
- rc = create_using_definesystem(test_dom, server)
+ virt_xml = get_class(virt)
+ csxml_info = virt_xml(test_dom)
+ rc = csxml_info.cim_define(server)
- if rc != 0:
- logger.error("Unable define domain %s using DefineSystem() %s" \
- % test_dom)
+ if not rc:
+ logger.error("Unable define domain %s using DefineSystem() " % test_dom)
status = FAIL
except Exception, detail:
@@ -70,31 +70,31 @@ def setup_env(server):
logger.error("Exception: %s", detail)
status = FAIL
- return status
+ return status, csxml_info
def print_err(err, detail, cn):
- logger.error(err % cn)
- logger.error("Exception: %s", detail)
+ logger.error(err % cn)
+ logger.error("Exception: %s", detail)
def get_inst_from_list(server, cn, qcn, list, filter, exp_val):
- status = PASS
- ret = -1
- inst = None
+ status = PASS
+ ret = -1
+ inst = None
- if len(list) < 1:
- logger.error("%s returned %i %s objects" % (qcn, len(list), cn))
- return FAIL, None
+ if len(list) < 1:
+ logger.error("%s returned %i %s objects" % (qcn, len(list), cn))
+ return FAIL, None
- for inst in list:
- if inst[filter['key']] == exp_val:
- ret = PASS
- break;
+ for inst in list:
+ if inst[filter['key']] == exp_val:
+ ret = PASS
+ break
- if ret != PASS:
- status = FAIL
- logger.error("%s with %s was not returned" % (cn, exp_val))
-
- return PASS, inst
+ if ret != PASS:
+ status = FAIL
+ logger.error("%s with %s was not returned" % (cn, exp_val))
+
+ return PASS, inst
def get_profile(server):
registeredname = 'Virtual System Profile'
@@ -178,32 +178,39 @@ def get_elec(server, cs):
@do_main(sup_types)
def main():
+ global virt
+ global csxml
options = main.options
+ virt = options.virt
+ server = options.ip
log_param()
status = PASS
- status = setup_env(options.ip)
+ status, csxml = setup_env(server)
if status != PASS:
return status
prev_namespace = Globals.CIM_NS
Globals.CIM_NS = 'root/interop'
- status, prof = get_profile(options.ip)
+ status, prof = get_profile(server)
if status != PASS or prof == None:
+ csxml.undefine(server)
return status
- status, cs = get_cs(options.ip, prof)
+ status, cs = get_cs(server, prof)
if status != PASS or cs == None:
+ csxml.undefine(server)
return status
Globals.CIM_NS = prev_namespace
- status, elec = get_elec(options.ip, cs)
+ status, elec = get_elec(server, cs)
if status != PASS or elec == None:
return status
+ csxml.undefine(server)
return status
16 years, 8 months
[PATCH] [TEST] Modifying vxml.py to include set_bridge_name()
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207303516 -19800
# Node ID ee93a545e27b467ac3cf473ace7ffdfd1930d880
# Parent 0142551c8d3cf5f2a3bbdfe835d69c3880be395a
[TEST] Modifying vxml.py to include set_bridge_name().
set_bridge_name() can be used to modify the bridge associated with a domain.
Needed by the 05_RAPF_err.py tc.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 0142551c8d3c -r ee93a545e27b suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Fri Apr 04 15:26:49 2008 +0530
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Fri Apr 04 15:35:16 2008 +0530
@@ -253,6 +253,9 @@ class VirtXML(Virsh, XMLClass):
def set_mac(self, mac):
self.set_attributes('/domain/devices/interface/mac', address=mac)
+ def set_bridge_name(self, bridgename):
+ self.set_attributes('/domain/devices/interface/source', bridge=bridgename)
+
def set_diskimg(self, diskimg):
self.set_attributes('/domain/devices/disk/source', file=diskimg)
16 years, 8 months
[PATCH] [TEST][Resubmitting]Add cross-provider test case 04_vssd_to_rasd.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207292102 -19800
# Node ID dce42f09c9c60c59e15db48882bc8fb68301238f
# Parent aac3efb5fe308b2c381ef3e7671411cb7337008f
[TEST][Resubmitting]Add cross-provider test case 04_vssd_to_rasd.py.
1) Removed the check_len() function and included the logic in the same file.
2) Used xml_get_disk_source() to get the disk image path
3) Used a variable to Store the class.
4) It traverses the following path:
{VSSD} --> [VirtualSystemSettingDataComponent](RASD)
Verify the Device RASD returned with the values expected - those given in the xml description.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r aac3efb5fe30 -r dce42f09c9c6 suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py Fri Apr 04 12:25:02 2008 +0530
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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
+#
+# This is a cross-provider testcase to
+# Get the setting data properties for the given guest.
+#
+#
+# It traverses the following path:
+# {VSSD} --> [VirtualSystemSettingDataComponent](RASD)
+# (Verify the Device RASD returned with the values expected - those given in test_xml)
+#
+# Steps:
+# ------
+# 1) Define a guest domain.
+# 1) Get the VSSD info using enumeration.
+# 2) From the VSSD output get the info related to the domain. We expect only one
+# VSSD info related to the domain to be returned.
+# 4) Get the various devices allocated to the domain by using the VirtualSystemSettingDataComponent
+# association and giving the VSSD output from the previous VSSD enumeration as inputs.
+# 5) Verify the Disk, Memory, Network, Processor RASD values.
+# 7) Undefine the guest domain.
+#
+# Date : 26-03-2008
+
+
+import sys
+import XenKvmLib
+from XenKvmLib import enumclass
+from CimTest.Globals import do_main, CIM_ERROR_ASSOCIATORS, CIM_ERROR_ENUMERATE
+from CimTest.Globals import log_param, logger
+from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib import assoc
+from XenKvmLib.vxml import get_class
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
+verify_diskrasd_values, verify_memrasd_values
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+test_dom = "VSSDC_dom"
+test_vcpus = 1
+test_mem = 128
+test_mac = "00:11:22:33:44:aa"
+
+def setup_env():
+ vsxml_info = None
+ virt_xml = get_class(virt)
+ vsxml_info = virt_xml(test_dom, mem=test_mem, vcpus = test_vcpus,
+ mac = test_mac, disk = test_disk)
+ try:
+ bridge = vsxml_info.set_vbridge(server)
+ ret = vsxml_info.define(server)
+ if not ret:
+ logger.error("Failed to Define the domain: %s", test_dom)
+ return FAIL, vsxml_info
+ except Exception, details:
+ logger.error("Exception : %s", details)
+ return FAIL, vsxml_info
+ return PASS, vsxml_info
+
+def init_list(virt):
+ """
+ Creating the lists that will be used for comparisons.
+ """
+ procrasd = {
+ "InstanceID" : '%s/%s' %(test_dom,0),
+ "ResourceType" : 3,
+ "CreationClassName": get_typed_class(virt, 'ProcResourceAllocationSettingData')
+ }
+
+ netrasd = {
+ "InstanceID" : '%s/%s' %(test_dom,test_mac),
+ "ResourceType" : 10 ,
+ "ntype1": "bridge",
+ "ntype2": "ethernet",
+ "CreationClassName": get_typed_class(virt, 'NetResourceAllocationSettingData')
+ }
+
+ address = vsxml.xml_get_disk_source()
+ diskrasd = {
+ "InstanceID" : '%s/%s' %(test_dom, test_disk),
+ "ResourceType" : 17,
+ "Address" : address,
+ "CreationClassName": get_typed_class(virt, 'DiskResourceAllocationSettingData')
+ }
+ memrasd = {
+ "InstanceID" : '%s/%s' %(test_dom, "mem"),
+ "ResourceType" : 4,
+ "AllocationUnits" : "MegaBytes",
+ "VirtualQuantity" : (test_mem * 1024),
+ "CreationClassName": get_typed_class(virt, 'MemResourceAllocationSettingData')
+ }
+ return procrasd, netrasd, diskrasd, memrasd
+
+def get_inst_from_list(classname, vssd_list, filter_name, exp_val):
+ status = PASS
+ ret = -1
+ inst = []
+ for rec in vssd_list:
+ record = rec[filter_name['key']]
+ if record.find(exp_val) >=0 :
+ inst.append(rec)
+ ret = PASS
+
+ # When no records are found.
+ if ret != PASS:
+ logger.error("%s with %s was not returned" % (classname, exp_val))
+ status = FAIL
+
+ # We expect only one record to be returned.
+ if len(inst) != 1:
+ logger.error("%s returned %i %s objects, expected only 1" % (classname, len(inst), 'VSSD'))
+ status = FAIL
+
+ if status != PASS:
+ vsxml.undefine(server)
+
+ return status, inst
+
+def get_vssd_info():
+ vssd = []
+ status = PASS
+ try:
+ classname = get_typed_class(virt, 'VirtualSystemSettingData')
+ vssd = enumclass.enumerate_inst(server, eval('enumclass.' + classname), virt)
+ if len(vssd) < 1 :
+ logger.error("%s returned %i %s objects, expected atleast 1" % (classname, len(vssd), 'VSSD'))
+ status = FAIL
+
+ except Exception, detail:
+ logger.error(CIM_ERROR_ENUMERATE, classname)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+
+ if status != PASS:
+ return status, vssd
+
+ filter_name = {"key" : "InstanceID"}
+ # Get the info ONLY related to the domain.
+ status, vssd_values = get_inst_from_list(classname, vssd, filter_name, test_dom)
+
+ return status, vssd_values
+
+def get_rasd_values_from_vssdc_assoc(vssd_values):
+ status = PASS
+ vssdc_assoc_info = []
+ # We should have only one VSSD record, the check for this is already done in
+ # get_inst_from_list() function, hence can safely use index 0.
+ instIdval = vssd_values[0]['InstanceID']
+ qcn = vssd_values[0].classname
+ assoc_cname = get_typed_class(virt, 'VirtualSystemSettingDataComponent')
+ try:
+ vssdc_assoc_info = assoc.Associators(server, assoc_cname, qcn, virt, InstanceID = instIdval)
+ if len(vssdc_assoc_info) < 4:
+ logger.error("%s returned %i %s objects, expected 4" % (assoc_cname, len(vssdc_assoc_info), qcn))
+ status = FAIL
+
+ except Exception, details:
+ logger.error(CIM_ERROR_ASSOCIATORS, assoc_cname)
+ logger.error("Exception : %s" % details)
+ status = FAIL
+ return status, vssdc_assoc_info
+
+def verify_rasd_values(rasd_values_info):
+ procrasd, netrasd, diskrasd, memrasd = init_list(virt)
+ try:
+ for rasd_instance in rasd_values_info:
+ CCName = rasd_instance.classname
+ if 'ProcResourceAllocationSettingData' in CCName:
+ status = verify_procrasd_values(rasd_instance, procrasd)
+ elif 'NetResourceAllocationSettingData' in CCName :
+ status = verify_netrasd_values(rasd_instance, netrasd)
+ elif 'DiskResourceAllocationSettingData' in CCName:
+ status = verify_diskrasd_values(rasd_instance, diskrasd)
+ elif 'MemResourceAllocationSettingData' in CCName :
+ status = verify_memrasd_values(rasd_instance, memrasd)
+ else:
+ status = FAIL
+ if status != PASS:
+ logger.error("Mistmatching %s values", CCName )
+ break
+ except Exception, detail :
+ logger.error("Exception in verify_rasd_values function: %s" % detail)
+ status = FAIL
+ return status
+
+@do_main(sup_types)
+def main():
+ options = main.options
+ log_param()
+ destroy_and_undefine_all(options.ip)
+ global test_disk, vsxml
+ global virt, server
+ server = options.ip
+ virt = options.virt
+ if virt == "Xen":
+ test_disk = "xvda"
+ else:
+ test_disk = "hda"
+
+ status, vsxml = setup_env()
+ if status != PASS:
+ return status
+
+ status, vssd_values = get_vssd_info()
+ if status != PASS or len(vssd_values) == 0:
+ return status
+
+ status, rasd_values = get_rasd_values_from_vssdc_assoc(vssd_values)
+ if status != PASS or len(rasd_values) == 0:
+ vsxml.undefine(server)
+ return status
+
+ status = verify_rasd_values(rasd_values)
+ try:
+ vsxml.undefine(server)
+ except Exception, detail:
+ logger.error("Failed to undefine domain %s", test_dom)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months
[PATCH] [TEST][Resubmitting] Add cross-provider test case 04_vssd_to_rasd.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207204016 -19800
# Node ID 104b65ee0d5f0bb2af8e140b6b1e194d75bab44f
# Parent bf376e97b3ea01ee72ce429ca5ecacb709aa6dae
[TEST][Resubmitting] Add cross-provider test case 04_vssd_to_rasd.py.
1) Removed the check_len() function and included the logic in the same file.
2) Used xml_get_disk_source() to get the disk image path
3) It traverses the following path:
{VSSD} --> [VirtualSystemSettingDataComponent](RASD)
Verify the Device RASD returned with the values expected - those given in the xml description.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r bf376e97b3ea -r 104b65ee0d5f suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py Thu Apr 03 11:56:56 2008 +0530
@@ -0,0 +1,242 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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
+#
+# This is a cross-provider testcase to
+# Get the setting data properties for the given guest.
+#
+#
+# It traverses the following path:
+# {VSSD} --> [VirtualSystemSettingDataComponent](RASD)
+# (Verify the Device RASD returned with the values expected - those given in test_xml)
+#
+# Steps:
+# ------
+# 1) Define a guest domain.
+# 1) Get the VSSD info using enumeration.
+# 2) From the VSSD output get the info related to the domain. We expect only one
+# VSSD info related to the domain to be returned.
+# 4) Get the various devices allocated to the domain by using the VirtualSystemSettingDataComponent
+# association and giving the VSSD output from the previous VSSD enumeration as inputs.
+# 5) Verify the Disk, Memory, Network, Processor RASD values.
+# 7) Undefine the guest domain.
+#
+# Date : 26-03-2008
+
+
+import sys
+import XenKvmLib
+from XenKvmLib import enumclass
+from CimTest.Globals import do_main, CIM_ERROR_ASSOCIATORS, CIM_ERROR_ENUMERATE
+from CimTest.Globals import log_param, logger
+from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib import assoc
+from XenKvmLib.vxml import get_class
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
+verify_diskrasd_values, verify_memrasd_values
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+test_dom = "VSSDC_dom"
+test_vcpus = 1
+test_mem = 128
+test_mac = "00:11:22:33:44:aa"
+
+def setup_env():
+ vsxml_info = None
+ vsxml_info = get_class(virt)(test_dom, mem=test_mem, vcpus = test_vcpus,
+ mac = test_mac, disk = test_disk)
+ try:
+ bridge = vsxml_info.set_vbridge(server)
+ ret = vsxml_info.define(server)
+ if not ret:
+ logger.error("Failed to Define the domain: %s", test_dom)
+ return FAIL, vsxml_info
+ except Exception, details:
+ logger.error("Exception : %s", details)
+ return FAIL, vsxml_info
+ return PASS, vsxml_info
+
+def init_list(virt):
+ """
+ Creating the lists that will be used for comparisons.
+ """
+ procrasd = {
+ "InstanceID" : '%s/%s' %(test_dom,0),\
+ "ResourceType" : 3,\
+ "CreationClassName": get_typed_class(virt, 'ProcResourceAllocationSettingData')
+ }
+
+ netrasd = {
+ "InstanceID" : '%s/%s' %(test_dom,test_mac), \
+ "ResourceType" : 10 , \
+ "ntype1": "bridge", \
+ "ntype2": "ethernet", \
+ "CreationClassName": get_typed_class(virt, 'NetResourceAllocationSettingData')
+ }
+
+ address = vsxml.xml_get_disk_source()
+ diskrasd = {
+ "InstanceID" : '%s/%s' %(test_dom, test_disk), \
+ "ResourceType" : 17, \
+ "Address" : address, \
+ "CreationClassName": get_typed_class(virt, 'DiskResourceAllocationSettingData')
+ }
+ memrasd = {
+ "InstanceID" : '%s/%s' %(test_dom, "mem"), \
+ "ResourceType" : 4, \
+ "AllocationUnits" : "MegaBytes",\
+ "VirtualQuantity" : (test_mem * 1024), \
+ "CreationClassName": get_typed_class(virt, 'MemResourceAllocationSettingData')
+ }
+ return procrasd, netrasd, diskrasd, memrasd
+
+def get_inst_from_list(classname, vssd_list, filter_name, exp_val):
+ status = PASS
+ ret = -1
+ inst = []
+ for rec in vssd_list:
+ record = rec[filter_name['key']]
+ if record.find(exp_val) >=0 :
+ inst.append(rec)
+ ret = PASS
+
+ # When no records are found.
+ if ret != PASS:
+ logger.error("%s with %s was not returned" % (classname, exp_val))
+ status = FAIL
+
+ # We expect only one record to be returned.
+ if len(inst) != 1:
+ logger.error("%s returned %i %s objects, expected only 1" % (classname, len(inst), 'VSSD'))
+ status = FAIL
+
+ if status != PASS:
+ vsxml.undefine(server)
+
+ return status, inst
+
+def get_vssd_info():
+ vssd = []
+ status = PASS
+ try:
+ classname = get_typed_class(virt, 'VirtualSystemSettingData')
+ vssd = enumclass.enumerate_inst(server, eval('enumclass.' + classname), virt)
+ if len(vssd) < 1 :
+ logger.error("%s returned %i %s objects, expected atleast 1" % (classname, len(vssd), 'VSSD'))
+ status = FAIL
+
+ except Exception, detail:
+ logger.error(CIM_ERROR_ENUMERATE, classname)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+
+ if status != PASS:
+ return status, vssd
+
+ filter_name = {"key" : "InstanceID"}
+ # Get the info ONLY related to the domain.
+ status, vssd_values = get_inst_from_list(classname, vssd, filter_name, test_dom)
+
+ return status, vssd_values
+
+def get_rasd_values_from_vssdc_assoc(vssd_values):
+ status = PASS
+ vssdc_assoc_info = []
+ # We should have only one VSSD record, the check for this is already done in
+ # get_inst_from_list() function, hence can safely use index 0.
+ instIdval = vssd_values[0]['InstanceID']
+ qcn = vssd_values[0].classname
+ assoc_cname = get_typed_class(virt, 'VirtualSystemSettingDataComponent')
+ try:
+ vssdc_assoc_info = assoc.Associators(server, assoc_cname, qcn, virt, InstanceID = instIdval)
+ if len(vssdc_assoc_info) < 4:
+ logger.error("%s returned %i %s objects, expected 4" % (assoc_cname, len(vssdc_assoc_info), qcn))
+ status = FAIL
+
+ except Exception, details:
+ logger.error(CIM_ERROR_ASSOCIATORS, assoc_cname)
+ logger.error("Exception : %s" % details)
+ status = FAIL
+ return status, vssdc_assoc_info
+
+def verify_rasd_values(rasd_values_info):
+ procrasd, netrasd, diskrasd, memrasd = init_list(virt)
+ try:
+ for rasd_instance in rasd_values_info:
+ CCName = rasd_instance.classname
+ if 'ProcResourceAllocationSettingData' in CCName:
+ status = verify_procrasd_values(rasd_instance, procrasd,)
+ elif 'NetResourceAllocationSettingData' in CCName :
+ status = verify_netrasd_values(rasd_instance, netrasd)
+ elif 'DiskResourceAllocationSettingData' in CCName:
+ status = verify_diskrasd_values(rasd_instance, diskrasd)
+ elif 'MemResourceAllocationSettingData' in CCName :
+ status = verify_memrasd_values(rasd_instance, memrasd)
+ else:
+ status = FAIL
+ if status != PASS:
+ logger.error("Mistmatching %s values", CCName )
+ break
+ except Exception, detail :
+ logger.error("Exception in verify_rasd_values function: %s" % detail)
+ status = FAIL
+ return status
+
+@do_main(sup_types)
+def main():
+ options = main.options
+ log_param()
+ destroy_and_undefine_all(options.ip)
+ global test_disk, vsxml
+ global virt, server
+ server = options.ip
+ virt = options.virt
+ if virt == "Xen":
+ test_disk = "xvda"
+ else:
+ test_disk = "hda"
+
+ status, vsxml = setup_env()
+ if status != PASS:
+ return status
+
+ status, vssd_values = get_vssd_info()
+ if status != PASS or len(vssd_values) == 0:
+ return status
+
+ status, rasd_values = get_rasd_values_from_vssdc_assoc(vssd_values)
+ if status != PASS or len(rasd_values) == 0:
+ vsxml.undefine(server)
+ return status
+
+ status = verify_rasd_values(rasd_values)
+ try:
+ vsxml.undefine(server)
+ except Exception, detail:
+ logger.error("Failed to undefine domain %s", test_dom)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months
[PATCH] Toks noticed we have some consistency issues in terms of MB versus KB for memory. This should sort that out
by Jay Gagnon
# HG changeset patch
# User Jay Gagnon <grendel(a)linux.vnet.ibm.com>
# Date 1207253245 14400
# Node ID dcf2ac998f1d1451ebbcd68c41ba317b345b01a8
# Parent c8c0e264c75cccccb40ff0de1cfdfc7a14c3d65a
Toks noticed we have some consistency issues in terms of MB versus KB for memory. This should sort that out.
Signed-off-by: Jay Gagnon <grendel(a)linux.vnet.ibm.com>
diff -r c8c0e264c75c -r dcf2ac998f1d configure.ac
--- a/configure.ac Thu Mar 20 10:47:48 2008 -0700
+++ b/configure.ac Thu Apr 03 16:07:25 2008 -0400
@@ -61,9 +61,9 @@ AC_ARG_WITH([diskconfig],
[DEFINE_DISK_CONFIG(/tmp/diskpool.conf)]
)
AC_ARG_WITH([maxmem],
- [ --with-maxmem=FOO Set max memory (MB) for a guest.],
+ [ --with-maxmem=FOO Set max memory (KB) for a guest.],
[DEFINE_MAXMEM($with_maxmem)],
- [DEFINE_MAXMEM(4096)]
+ [DEFINE_MAXMEM(4194304)]
)
AC_ARG_WITH(html-dir,
diff -r c8c0e264c75c -r dcf2ac998f1d src/Virt_RASD.c
--- a/src/Virt_RASD.c Thu Mar 20 10:47:48 2008 -0700
+++ b/src/Virt_RASD.c Thu Apr 03 16:07:25 2008 -0400
@@ -344,7 +344,7 @@ static CMPIInstance *rasd_from_vdev(cons
(CMPIValue *)dev->dev.disk.type,
CMPI_chars);
} else if (dev->type == CIM_RES_TYPE_MEM) {
- const char *units = "MegaBytes";
+ const char *units = "KiloBytes";
CMSetProperty(inst, "AllocationUnits",
(CMPIValue *)units, CMPI_chars);
diff -r c8c0e264c75c -r dcf2ac998f1d src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Thu Mar 20 10:47:48 2008 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c Thu Apr 03 16:07:25 2008 -0400
@@ -116,7 +116,7 @@ static struct sdc_rasd_prop *mem_max(con
struct sdc_rasd_prop tmp[] = {
{"InstanceID", (CMPIValue *)"Maximum", CMPI_chars},
- {"AllocationUnits", (CMPIValue *)"MegaBytes", CMPI_chars},
+ {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
{"VirtualQuantity", (CMPIValue *)&max_vq, CMPI_uint64},
PROP_END
};
@@ -136,11 +136,11 @@ static struct sdc_rasd_prop *mem_min(con
{
bool ret;
struct sdc_rasd_prop *rasd = NULL;
- uint64_t min_vq = 64;
+ uint64_t min_vq = 64 << 10;
struct sdc_rasd_prop tmp[] = {
{"InstanceID", (CMPIValue *)"Minimum", CMPI_chars},
- {"AllocationUnits", (CMPIValue *)"MegaBytes", CMPI_chars},
+ {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
{"VirtualQuantity", (CMPIValue *)&min_vq, CMPI_uint64},
PROP_END
};
@@ -160,11 +160,11 @@ static struct sdc_rasd_prop *mem_def(con
{
bool ret;
struct sdc_rasd_prop *rasd = NULL;
- uint64_t def_vq = 256;
+ uint64_t def_vq = 256 << 10;
struct sdc_rasd_prop tmp[] = {
{"InstanceID", (CMPIValue *)"Default", CMPI_chars},
- {"AllocationUnits", (CMPIValue *)"MegaBytes", CMPI_chars},
+ {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
{"VirtualQuantity", (CMPIValue *)&def_vq, CMPI_uint64},
PROP_END
};
@@ -184,11 +184,11 @@ static struct sdc_rasd_prop *mem_inc(con
{
bool ret;
struct sdc_rasd_prop *rasd = NULL;
- uint64_t inc_vq = 1;
+ uint64_t inc_vq = 1 << 10;
struct sdc_rasd_prop tmp[] = {
{"InstanceID", (CMPIValue *)"Increment", CMPI_chars},
- {"AllocationUnits", (CMPIValue *)"MegaBytes", CMPI_chars},
+ {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
{"VirtualQuantity", (CMPIValue *)&inc_vq, CMPI_uint64},
PROP_END
};
16 years, 8 months
[PATCH] [TEST] Adding profile_init_list() in common_util.py to create a default profile list
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207225887 -19800
# Node ID 4ae171df56c92ff442bbd098102779140f3c7ff1
# Parent cbadbbee26c59304d6ef6a46e94eeb9b5dbed26b
[TEST] Adding profile_init_list() in common_util.py to create a default profile list.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r cbadbbee26c5 -r 4ae171df56c9 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Thu Apr 03 13:17:42 2008 +0530
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Thu Apr 03 18:01:27 2008 +0530
@@ -187,3 +187,46 @@ def try_getinstance(conn, classname, key
'%s' passed.", classname, field_name)
return XFAIL_RC(bug_no)
+def profile_init_list():
+ sys_prof_info = {
+ "InstanceID" : "CIM:DSP1042-SystemVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "System Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ vs_prof = {
+ "InstanceID" : "CIM:DSP1057-VirtualSystem-1.0.0a",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Virtual System Profile",
+ "RegisteredVersion" : "1.0.0a"
+ }
+ gen_dev_prof = {
+ "InstanceID" :
+ "CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Generic Device Resource Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ mem_res_prof = {
+ "InstanceID" : "CIM:DSP1045-MemoryResourceVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Memory Resource Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ vs_mig_prof = {
+ "InstanceID" : "CIM:DSP1081-VirtualSystemMigration-1.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Virtual System Migration",
+ "RegisteredVersion" : "1.0"
+ }
+
+ profiles = {
+
+ 'DSP1042' : sys_prof_info,
+ 'DSP1045' : mem_res_prof,
+ 'DSP1057' : vs_prof,
+ 'DSP1059' : gen_dev_prof,
+ 'DSP1081' : vs_mig_prof
+ }
+
+ return profiles
16 years, 8 months
[PATCH] [TEST][Resubmitting: Addition] : Adding 01_forward.py tc to verify ReferencedProfile
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207117030 -19800
# Node ID 57b84aa20438fe7f8b7f2fa5e0098e30e2198745
# Parent e2cd9e869996152255adcf54e4c4e38331fcf760
[TEST][Resubmitting: Addition] : Adding 01_forward.py tc to verify ReferencedProfile.
Removed the check_len() function and included the logic to check the len of assoc, list in the same file.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r e2cd9e869996 -r 57b84aa20438 suites/libvirt-cim/cimtest/ReferencedProfile/01_forward.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/01_forward.py Wed Apr 02 11:47:10 2008 +0530
@@ -0,0 +1,172 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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
+#
+# The following test case is used to verify the ReferencedProfile provider.
+#
+#Ex Command:
+#-----------
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1057-VirtualSystem-1.0.0a"'
+#
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0"'
+#
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1045-MemoryResourceVirtualization-1.0.0"'
+#
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1081-VirtualSystemMigration-1.0"'
+#
+# Output:
+# -------
+# All the above examples have the following as result.
+#
+# localhost:5988/root/interop:Xen_RegisteredProfile.
+# InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0"
+# ......
+# InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0"
+# RegisteredOrganization=2
+# RegisteredName="System Virtualization"
+# RegisteredVersion="1.0.0"
+# ....
+#
+# Date : 31-03-2008
+import sys
+from XenKvmLib import enumclass
+from XenKvmLib.assoc import Associators
+from CimTest import Globals
+from CimTest.Globals import log_param, logger, CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORS
+from CimTest.Globals import do_main
+from XenKvmLib.classes import get_typed_class
+from CimTest.ReturnCodes import FAIL, PASS
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+
+def init_list():
+ sys_prof_info = {
+ "InstanceID" : "CIM:DSP1042-SystemVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "System Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ return sys_prof_info
+
+def print_field_error(fieldname, ret_value, exp_value):
+ logger.error("%s Mismatch", fieldname)
+ logger.error("Returned %s instead of %s", ret_value, exp_value)
+
+def get_proflist():
+ proflist = []
+ status = PASS
+ try:
+ key_list = ["InstanceID"]
+ proflist = enumclass.enumerate(server, eval('enumclass.' + reg_classname), key_list, virt)
+ if len(proflist) < 5 :
+ logger.error("%s returned %i %s objects, expected atleast 5",
+ reg_classname, len(proflist), 'Profile')
+ status = FAIL
+
+ except Exception, detail:
+ logger.error(CIM_ERROR_ENUMERATE, reg_classname)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+
+ if status != PASS:
+ return status, proflist
+
+ profiles_instid_list = []
+ for profile in proflist:
+ if not ("DSP1042" in profile.InstanceID):
+ profiles_instid_list.append(profile.InstanceID)
+
+ return status, profiles_instid_list
+
+def verify_ref_assoc_info(assoc_info, sys_prof_info):
+ if assoc_info['InstanceID'] != sys_prof_info['InstanceID']:
+ print_field_error('InstanceID', assoc_info['InstanceID'], sys_prof_info['InstanceID'])
+ return FAIL
+ if assoc_info['RegisteredOrganization'] != sys_prof_info['RegisteredOrganization']:
+ print_field_error('RegisteredOrganization', assoc_info['RegisteredOrganization'],
+ sys_prof_info['RegisteredOrganization'])
+ return FAIL
+ if assoc_info['RegisteredName'] != sys_prof_info['RegisteredName']:
+ print_field_error('RegisteredName', assoc_info['RegisteredName'],
+ sys_prof_info['RegisteredName'])
+ return FAIL
+ if assoc_info['RegisteredVersion'] != sys_prof_info['RegisteredVersion']:
+ print_field_error('RegisteredVersion', assoc_info['RegisteredVersion'],
+ sys_prof_info['RegisteredVersion'])
+ return FAIL
+ return PASS
+
+
+
+def get_refprof_verify_info(proflist):
+ assoc_info = []
+ status = PASS
+ assoc_name = get_typed_class(virt, 'ReferencedProfile')
+ sys_prof_info = init_list()
+ for instid in proflist:
+ try:
+ assoc_info = Associators(server, assoc_name, reg_classname, virt, InstanceID = instid,
+ CreationClassName = reg_classname)
+ if len(assoc_info) != 1:
+ logger.error("%s returned %i %s objects, expected only 1",
+ assoc_name, len(assoc_info), 'SystemVirtualization')
+ status = FAIL
+ if status != PASS:
+ break
+
+ status = verify_ref_assoc_info(assoc_info[0], sys_prof_info)
+ if status != PASS:
+ break
+
+ except Exception, detail:
+ logger.error(CIM_ERROR_ASSOCIATORS, assoc_name)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+
+ return status
+
+@do_main(sup_types)
+def main():
+ log_param()
+ options = main.options
+ global virt, server, reg_classname
+ virt = options.virt
+ server = options.ip
+ status = PASS
+ prev_namespace = Globals.CIM_NS
+ Globals.CIM_NS = 'root/interop'
+ reg_classname = get_typed_class(virt, 'RegisteredProfile')
+
+ status, proflist = get_proflist()
+ if status != PASS :
+ Globals.CIM_NS = prev_namespace
+ return status
+
+ status = get_refprof_verify_info(proflist)
+ Globals.CIM_NS = prev_namespace
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months
[PATCH] [TEST][Resubmitting: Addition] : Adding 02_reverse.py tc to verify ReferencedProfile
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207117559 -19800
# Node ID f3e2ef4edbb4ec299aaba8a9a6307e5b777a8712
# Parent 57b84aa20438fe7f8b7f2fa5e0098e30e2198745
[TEST][Resubmitting: Addition] : Adding 02_reverse.py tc to verify ReferencedProfile.
Removed the check_len() function and included the logic to check the len of assoc, list in the same file.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 57b84aa20438 -r f3e2ef4edbb4 suites/libvirt-cim/cimtest/ReferencedProfile/02_reverse.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/02_reverse.py Wed Apr 02 11:55:59 2008 +0530
@@ -0,0 +1,172 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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
+#
+# The following test case is used to verify the ReferencedProfile supported
+# by the VSM providers.
+#
+# Command:
+# -------
+#
+# wbemcli ai -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0"'
+#
+# Output:
+# -------
+# localhost:5988/root/interop:Xen_RegisteredProfile.InstanceID="CIM:DSP1057-VirtualSystem-1.0.0a"
+# -InstanceID="CIM:DSP1057-VirtualSystem-1.0.0a"
+# -RegisteredOrganization=2
+# -RegisteredName="Virtual System Profile"
+# -RegisteredVersion="1.0.0a"
+#
+# localhost:5988/root/interop:Xen_RegisteredProfile.
+# InstanceID="CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0"
+# .....
+# localhost:5988/root/interop:Xen_RegisteredProfile.
+# InstanceID="CIM:DSP1045-MemoryResourceVirtualization-1.0.0"
+# ......
+# localhost:5988/root/interop:Xen_RegisteredProfile.
+# InstanceID="CIM:DSP1081-VirtualSystemMigration-1.0"
+# ......
+# Date : 31-03-2008
+import sys
+from XenKvmLib.assoc import Associators
+from CimTest import Globals
+from CimTest.Globals import log_param, logger, CIM_ERROR_ASSOCIATORS
+from CimTest.Globals import do_main
+from XenKvmLib.classes import get_typed_class
+from CimTest.ReturnCodes import FAIL, PASS
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+
+def init_list():
+ vs_prof = {
+ "InstanceID" : "CIM:DSP1057-VirtualSystem-1.0.0a",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Virtual System Profile",
+ "RegisteredVersion" : "1.0.0a"
+ }
+ gen_dev_prof = {
+ "InstanceID" :
+ "CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Generic Device Resource Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ mem_res_prof = {
+ "InstanceID" : "CIM:DSP1045-MemoryResourceVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Memory Resource Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ vs_mig_prof = {
+ "InstanceID" : "CIM:DSP1081-VirtualSystemMigration-1.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Virtual System Migration",
+ "RegisteredVersion" : "1.0"
+ }
+
+ return vs_prof, gen_dev_prof, mem_res_prof, vs_mig_prof
+
+def print_field_error(fieldname, ret_value, exp_value):
+ logger.error("%s Mismatch", fieldname)
+ logger.error("Returned '%s' instead of '%s'", ret_value, exp_value)
+
+
+def verify_fields(assoc_info, prof_info):
+ if assoc_info['InstanceID'] != prof_info['InstanceID']:
+ print_field_error('InstanceID', assoc_info['InstanceID'], prof_info['InstanceID'])
+ return FAIL
+ if assoc_info['RegisteredOrganization'] != prof_info['RegisteredOrganization']:
+ print_field_error('RegisteredOrganization', assoc_info['RegisteredOrganization'], \
+ prof_info['RegisteredOrganization'])
+ return FAIL
+ if assoc_info['RegisteredName'] != prof_info['RegisteredName']:
+ print_field_error('RegisteredName', assoc_info['RegisteredName'], \
+ prof_info['RegisteredName'])
+ return FAIL
+ if assoc_info['RegisteredVersion'] != prof_info['RegisteredVersion']:
+ print_field_error('RegisteredVersion', assoc_info['RegisteredVersion'], \
+ prof_info['RegisteredVersion'])
+ return FAIL
+ return PASS
+
+
+def verify_ref_assoc_info(assoc_info):
+ status = PASS
+ vs_prof, gen_dev_prof, mem_res_prof, vs_mig_prof = init_list()
+ for i in range(len(assoc_info)):
+ instid = assoc_info[i]['InstanceID']
+ if instid.find("DSP1045") >=0 :
+ status = verify_fields(assoc_info[i], mem_res_prof)
+ elif instid.find("DSP1057") >=0 :
+ status = verify_fields(assoc_info[i], vs_prof)
+ elif instid.find("DSP1059") >=0 :
+ status = verify_fields(assoc_info[i], gen_dev_prof)
+ elif instid.find("DSP1081") >=0 :
+ status = verify_fields(assoc_info[i], vs_mig_prof)
+ else:
+ status = FAIL
+ if status != PASS:
+ break
+ return status
+
+def get_refprof_verify_info():
+ assoc_info = []
+ status = PASS
+ assoc_name = get_typed_class(virt, 'ReferencedProfile')
+ instid = "CIM:DSP1042-SystemVirtualization-1.0.0"
+ try:
+ assoc_info = Associators(server, assoc_name, reg_classname, virt, InstanceID = instid,
+ CreationClassName = reg_classname)
+ if len(assoc_info) < 4:
+ logger.error("%s returned %i %s objects, expected atleast 4",
+ assoc_name, len(assoc_info), 'Profile')
+ status = FAIL
+
+ if status != PASS:
+ return status
+ status = verify_ref_assoc_info(assoc_info)
+ except Exception, detail:
+ logger.error(CIM_ERROR_ASSOCIATORS, assoc_name)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+ return status
+
+@do_main(sup_types)
+def main():
+ log_param()
+ options = main.options
+ global virt, server, reg_classname
+ virt = options.virt
+ server = options.ip
+ status = PASS
+ prev_namespace = Globals.CIM_NS
+ Globals.CIM_NS = 'root/interop'
+
+ reg_classname = get_typed_class(virt, 'RegisteredProfile')
+ status = get_refprof_verify_info()
+
+ Globals.CIM_NS = prev_namespace
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months
[PATCH] [TEST] Add cross-provider test case 06_hs_to_vsms.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207227092 -19800
# Node ID dbb701ed977395d064da465a17f69b8d86bf17c7
# Parent 3129aaf0add9f197c05d19064668d02f5aea5d07
[TEST] Add cross-provider test case 06_hs_to_vsms.py.
1) Removed the check_len() function and included the logic to check the len of assoc, list in the same file.
2) It traverses the following path:
{Hostsystem} --> [HostedService] {VirtualSystemMigrationService} -->
[ElementCapabilities] {VirtualSystemMigrationCapabilities} --> [SettingsDefineCapabilities] {VirtualSystemMigrationSettingData}
Verify the VirtualSystemMigrationSettingData.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 3129aaf0add9 -r dbb701ed9773 suites/libvirt-cim/cimtest/HostSystem/06_hs_to_vsms.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/HostSystem/06_hs_to_vsms.py Thu Apr 03 18:21:32 2008 +0530
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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
+#
+#
+# This is a cross-provider testcase to
+# Get the MigrationSettingData properties starting from the host
+#
+# It traverses the following path:
+# {Hostsystem} --> [HostedService] {VirtualSystemMigrationService} -->
+# [ElementCapabilities] {VirtualSystemMigrationCapabilities} -->
+# [SettingsDefineCapabilities] {VirtualSystemMigrationSettingData}
+# Verify the VirtualSystemMigrationSettingData.
+#
+# Steps:
+# ------
+# 1) Get the hostname by enumerating the hostsystem.
+# 2) Get the various service on the host by using the HostedService association by supplying
+# the inputs obtained from querying the hostsystem.
+# 4) Select the VirtualSystemMigrationService from the association returned. We should get only
+# one record.
+# 5) Use the VirtualSystemMigrationService information to query ElementCapabilities association
+# Verify that we should get only one MigrationCapabilities record from the VSMS association.
+# 6) Obtain the VSMigrationSettingData values by using the MigrationCapabilities output from the
+# previous query and supplying it to the SettingsDefineCapabilities association.
+# 7) Check, that we obtain only one VSMigrationSettingData data.
+# Verify the VSMigrationSettingData values.
+# Date : 28.03.2008
+
+import sys
+from CimTest.Globals import do_main
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.assoc import Associators, AssociatorNames
+from XenKvmLib.common_util import get_host_info
+from CimTest.Globals import log_param, logger, CIM_ERROR_ASSOCIATORNAMES, \
+CIM_ERROR_ASSOCIATORS
+from CimTest.ReturnCodes import PASS, FAIL
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+def print_err(err, detail, cn):
+ logger.error(err % cn)
+ logger.error("Exception: %s", detail)
+
+def print_field_error(fieldname, ret_value, exp_value):
+ logger.error("%s Mismatch", fieldname)
+ logger.error("Returned %s instead of %s", ret_value, exp_value)
+
+
+def get_inst_from_list(server, cn, assoc_info, filter_name, exp_val):
+ status = PASS
+ ret = -1
+ inst = []
+ for rec in assoc_info:
+ record = rec[filter_name]
+ if record == exp_val:
+ inst.append(rec)
+ ret = PASS
+
+ # When no records are found.
+ if ret != PASS:
+ logger.error("%s with %s was not returned" % (cn, exp_val))
+ status = FAIL
+
+ return status, inst
+
+def get_assocnames_info(server, cn, an, qcn, name):
+ status = PASS
+ assoc_info = []
+ try:
+ assoc_info = AssociatorNames(server, an, cn, virt, Name = name, CreationClassName = cn)
+ if len(assoc_info) < 0 :
+ logger.error("%s returned %i %s objects, expected atleast 3", an, len(assoc_info), qcn)
+ status = FAIL
+ except Exception, detail:
+ print_err(CIM_ERROR_ASSOCIATORNAMES, detail, an)
+ status = FAIL
+
+ return status, assoc_info
+
+
+def get_vsms_info():
+ status, host_name, classname = get_host_info(server, virt)
+ if status != PASS:
+ return status, []
+ status, service_assoc_info = get_assocnames_info(server, classname,
+ assoc_name, req_cn, host_name)
+ if status != PASS or len(service_assoc_info) == 0:
+ return status, service_assoc_info
+ filter_name = "Name"
+ filter_value = 'MigrationService'
+ cn = 'VirtualSystemMigrationService'
+ status, vsms_list = get_inst_from_list(server, cn, service_assoc_info, filter_name,
+ filter_value)
+ return status, vsms_list
+
+def get_vsmcap_from_ec(vsms_list):
+ status = PASS
+ vsms_info = vsms_list[0]
+ cn = vsms_info['CreationClassName']
+ sn = vsms_info['SystemName']
+ name = vsms_info['Name']
+ sccn = vsms_info['SystemCreationClassName']
+ assoc_info = []
+ try:
+ assoc_info = AssociatorNames(server, assoc_name, cn, virt, CreationClassName = cn,
+ SystemName = sn, Name = name, SystemCreationClassName = sccn)
+ if len(assoc_info) != 1:
+ logger.error("%s returned %i %s objects, expected only 1", assoc_name, len(assoc_info), req_cn)
+ status = FAIL
+
+ except Exception, detail:
+ print_err(CIM_ERROR_ASSOCIATORNAMES, detail, assoc_name)
+ status = FAIL
+
+ return status, assoc_info
+
+def get_vsmsd_from_sdc(vsmsd_list):
+ status = PASS
+ vsmsd_info = vsmsd_list[0]
+ cn = vsmsd_info.classname
+ instid = vsmsd_info['InstanceID']
+ assoc_info = []
+ try:
+ assoc_info = Associators(server, assoc_name, cn, virt, CreationClassName = cn,
+ InstanceID = instid)
+ if len(assoc_info) != 1:
+ logger.error("%s returned %i %s objects, expected only 1", assoc_name, len(assoc_info), req_cn)
+ status = FAIL
+
+ except Exception, detail:
+ print_err(CIM_ERROR_ASSOCIATORS, detail, assoc_name)
+ status = FAIL
+
+ return status, assoc_info
+
+def verify_vsmsd_values(vsmsd_list):
+
+ # Values to be used for comparison
+ cn = get_typed_class(virt, "VirtualSystemMigrationSettingData")
+ instid = 'MigrationSettingData'
+ MType = 2 #[CIM_MIGRATE_LIVE]
+ priority = 0
+
+ verify_vsmsd = vsmsd_list[0]
+ if verify_vsmsd.classname != cn:
+ print_field_error('ClassName', verify_vsmsd.classname, cn)
+ return FAIL
+ if verify_vsmsd['InstanceID'] != instid:
+ print_field_error('InstanceID', verify_vsmsd['InstanceID'], instid)
+ return FAIL
+ if verify_vsmsd['MigrationType'] != MType:
+ print_field_error('MigrationType', verify_vsmsd['MigrationType'], MType)
+ return FAIL
+ if verify_vsmsd['Priority'] != priority:
+ print_field_error('Priority', verify_vsmsd['Priority'], priority)
+ return FAIL
+ return PASS
+
+
+@do_main(sup_types)
+def main():
+ global virt, server
+ global assoc_name, class_name, req_cn
+ options = main.options
+ log_param()
+ server = options.ip
+ status = PASS
+ virt = options.virt
+
+ assoc_name = get_typed_class(virt, 'HostedService')
+ req_cn = 'Service'
+ status, vsms_list = get_vsms_info()
+ if status != PASS or len(vsms_list) == 0:
+ logger.error("Did not get the expected MigrationService record")
+ return status
+ if len(vsms_list) != 1:
+ logger.error("%s returned %i %s objects, expected only 1", assoc_name, len(vsms_list), req_cn)
+ return FAIL
+
+ assoc_name = get_typed_class(virt, 'ElementCapabilities')
+ req_cn = 'MigrationCapabilities'
+ status, vsmscap = get_vsmcap_from_ec(vsms_list)
+ if status != PASS or len(vsmscap) == 0:
+ logger.error("Did not get the expected MigrationCapabilities record")
+ return status
+
+ assoc_name = get_typed_class(virt, 'SettingsDefineCapabilities')
+ req_cn = 'MigrationSettingData'
+ status, vsmsd = get_vsmsd_from_sdc(vsmscap)
+ if status != PASS or len(vsmsd) == 0:
+ logger.error("Did not get the expected MigrationSettingData record")
+ return status
+
+ status = verify_vsmsd_values(vsmsd)
+
+ return status
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months