[PATCH] Add EmulatedType to DiskRASDs
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1230156310 28800
# Node ID a7f77c32ddddb804e556fa19ceed0ebf625c9c2a
# Parent 3557859610b4eaf8a2bdcb28d7002121e3e776b1
Add EmulatedType to DiskRASDs.
This sets EmulatedType to 0. Should an additional template RASD be returned
for EmulatedType 1?
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 3557859610b4 -r a7f77c32dddd src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Wed Dec 10 12:42:02 2008 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c Wed Dec 24 14:05:10 2008 -0800
@@ -617,6 +617,7 @@
const char *dev;
CMPIInstance *inst;
CMPIStatus s = {CMPI_RC_OK, NULL};
+ uint16_t emu_type = 0;
if (type == DOMAIN_LXC) {
addr = "/tmp";
@@ -652,6 +653,8 @@
CMSetProperty(inst, "VirtualDevice",
(CMPIValue *)dev, CMPI_chars);
+ CMSetProperty(inst, "EmulatedType",
+ (CMPIValue *)&emu_type, CMPI_uint16);
}
inst_list_add(list, inst);
15 years, 12 months
[PATCH] Added 2 end points for the ServiceAffectsElement association, both related to the LogicalDevice class
by Richard Maciel
# HG changeset patch
# User Richard Maciel <richardm(a)br.ibm.com>
# Date 1229729923 7200
# Node ID 0a617ecc1b6f49a1391afa5566f3f7ca710ec5cb
# Parent 27c75ec951e790bfec72273828154eec647e4caf
Added 2 end points for the ServiceAffectsElement association, both related to the LogicalDevice class.
- ConsoleRedirectionService <-> DisplayController
- ConsoleRedirectionService <-> PointingDevice
Signed-off-by: Richard Maciel <richardm(a)br.ibm.com>
diff -r 27c75ec951e7 -r 0a617ecc1b6f src/Makefile.am
--- a/src/Makefile.am Fri Dec 19 21:10:32 2008 -0200
+++ b/src/Makefile.am Fri Dec 19 21:38:43 2008 -0200
@@ -213,9 +213,9 @@
libVirt_ConsoleRedirectionServiceCapabilities_la_SOURCES = Virt_ConsoleRedirectionServiceCapabilities.c
-libVirt_ServiceAffectsElement_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_ConsoleRedirectionService.la
+libVirt_ServiceAffectsElement_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_Device.la libVirt_ConsoleRedirectionService.la
libVirt_ServiceAffectsElement_la_SOURCES = Virt_ServiceAffectsElement.c
-libVirt_ServiceAffectsElement_la_LIBADD = -lVirt_ComputerSystem -lVirt_ConsoleRedirectionService
+libVirt_ServiceAffectsElement_la_LIBADD = -lVirt_ComputerSystem -lVirt_Device -lVirt_ConsoleRedirectionService
libVirt_KVMRedirectionSAP_la_SOURCES = Virt_KVMRedirectionSAP.c
diff -r 27c75ec951e7 -r 0a617ecc1b6f src/Virt_ServiceAffectsElement.c
--- a/src/Virt_ServiceAffectsElement.c Fri Dec 19 21:10:32 2008 -0200
+++ b/src/Virt_ServiceAffectsElement.c Fri Dec 19 21:38:43 2008 -0200
@@ -29,11 +29,29 @@
#include <libcmpiutil/libcmpiutil.h>
#include <libcmpiutil/std_association.h>
#include "misc_util.h"
+#include "svpc_types.h"
#include "Virt_ComputerSystem.h"
#include "Virt_ConsoleRedirectionService.h"
+#include "Virt_Device.h"
const static CMPIBroker *_BROKER;
+
+static CMPIStatus add_devices_to_list(const CMPIObjectPath *ref,
+ const char *host,
+ int type,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+
+ s = enum_devices(_BROKER, ref, host, type, list);
+
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ out:
+ return s;
+}
static CMPIStatus service_to_cs(const CMPIObjectPath *ref,
struct std_assoc_info *info,
@@ -41,15 +59,60 @@
{
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *instance = NULL;
-
+ const char *host = NULL;
+ int i;
+ int num_of_domains;
+
if (!match_hypervisor_prefix(ref, info))
- return s;
+ goto out;
s = get_console_rs(ref, &instance, _BROKER, info->context, true);
if (s.rc != CMPI_RC_OK)
- return s;
+ goto out;
s = enum_domains(_BROKER, ref, list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ num_of_domains = list->cur;
+
+ // For each domain, insert its video and pointer devices into
+ // the list
+ for (i = 0; i < num_of_domains; i++) {
+ s.rc = cu_get_str_prop(list->list[i], "Name", &host);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ s = add_devices_to_list(ref, host, CIM_RES_TYPE_INPUT, list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ s = add_devices_to_list(ref, host, CIM_RES_TYPE_GRAPHICS, list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+ }
+
+ out:
+ return s;
+}
+
+static CMPIStatus validate_cs_or_dev_ref(const CMPIContext *context,
+ const CMPIObjectPath *ref)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char* classname;
+
+ classname = class_base_name(CLASSNAME(ref));
+
+ if (STREQC(classname, "ComputerSystem")) {
+ s = get_domain_by_ref(_BROKER, ref, &inst);
+ } else if ((STREQC(classname, "PointingDevice")) ||
+ (STREQC(classname, "DisplayController"))) {
+ s = get_device_by_ref(_BROKER, ref, &inst);
+ }
+
+ free(classname);
return s;
}
@@ -63,8 +126,8 @@
if (!match_hypervisor_prefix(ref, info))
return s;
-
- s = get_domain_by_ref(_BROKER, ref, &inst);
+
+ s = validate_cs_or_dev_ref(info->context, ref);
if (s.rc != CMPI_RC_OK)
return s;
@@ -83,6 +146,12 @@
"Xen_ComputerSystem",
"KVM_ComputerSystem",
"LXC_ComputerSystem",
+ "Xen_PointingDevice",
+ "KVM_PointingDevice",
+ "LXC_PointingDevice",
+ "Xen_DisplayController",
+ "KVM_DisplayController",
+ "LXC_DisplayController",
NULL
};
15 years, 12 months
[PATCH] [TEST]#6 Add new test to verify enum of DiskRASD to have EmulatedType=0 for Disk and EmulatedType=1 for CDROM
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1230607499 28800
# Node ID ed69cafdfc5d43fa8864edb62e774d8c53bf4d55
# Parent 5849e413cc6e3d3330d11fbda9e9b954af774ac0
[TEST]#6 Add new test to verify enum of DiskRASD to have EmulatedType=0 for Disk and EmulatedType=1 for CDROM
I cann't connect to the machine for Xen test, so this patch only supports KVM now
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 5849e413cc6e -r ed69cafdfc5d suites/libvirt-cim/cimtest/RASD/05_disk_rasd_emu_type.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/RASD/05_disk_rasd_emu_type.py Mon Dec 29 19:24:59 2008 -0800
@@ -0,0 +1,88 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Guolian Yun <yunguol(a)cn.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
+from XenKvmLib.enumclass import EnumInstances
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import parse_instance_id
+from XenKvmLib.const import do_main
+from XenKvmLib.vxml import get_class
+from CimTest.ReturnCodes import PASS, FAIL
+from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
+from XenKvmLib.const import get_provider_version
+
+SUPPORTED_TYPES = ['KVM']
+default_dom = 'test_domain'
+libvirt_em_type_changeset = 737
+
+@do_main(SUPPORTED_TYPES)
+def main():
+ status = FAIL
+ options = main.options
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev < libvirt_em_type_changeset:
+ return SKIP
+
+ emu_types = [0, 1]
+ try:
+ for exp_emu_type in emu_types:
+ cxml = get_class(options.virt)(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_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))
+
+ if found_rasd is None:
+ raise Exception("DiskRASD for define dom was not found")
+ except Exception, detail:
+ logger.error("Exception: %s", detail)
+ status = FAIL
+
+ cxml.undefine(options.ip)
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
diff -r 5849e413cc6e -r ed69cafdfc5d suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Tue Dec 23 13:51:22 2008 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Mon Dec 29 19:24:59 2008 -0800
@@ -126,8 +126,10 @@
# classes to define RASD parameters
class CIM_DiskResourceAllocationSettingData(CIMClassMOF):
- def __init__(self, dev, source, name):
+ def __init__(self, dev, source, name, emu_type=None):
self.ResourceType = RASD_TYPE_DISK
+ if emu_type != None:
+ self.EmulatedType = emu_type
if dev != None:
self.VirtualDevice = dev
self.InstanceID = '%s/%s' % (name, dev)
@@ -239,6 +241,7 @@
proc_vcpu=1,
mem_mb=512,
malloc_units="MegaBytes",
+ emu_type=None,
virt='Xen'):
vssd = get_vssd_mof(virt, dom_name)
@@ -252,7 +255,7 @@
elif virt == 'LXC':
disk_dev = const.LXC_default_mp
disk_source = const.LXC_default_source
- d = class_dasd(disk_dev, disk_source, dom_name)
+ d = class_dasd(disk_dev, disk_source, dom_name, emu_type)
class_masd = get_masd_class(virt)
m = class_masd(
diff -r 5849e413cc6e -r ed69cafdfc5d suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Dec 23 13:51:22 2008 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Dec 29 19:24:59 2008 -0800
@@ -466,11 +466,13 @@
class VirtCIM:
def __init__(self, virt, dom_name, disk_dev, disk_source,
- net_type, net_name, net_mac, vcpus, mem, mem_allocunits):
+ net_type, net_name, net_mac, vcpus, mem,
+ mem_allocunits, emu_type):
self.virt = virt
self.domain_name = dom_name
self.vssd = vsms.get_vssd_mof(virt, dom_name)
- self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source, dom_name)
+ self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source,
+ dom_name, emu_type)
self.nasd = vsms.get_nasd_class(virt)(type=net_type,
mac=net_mac,
name=dom_name,
@@ -687,13 +689,15 @@
disk_file_path=const.KVM_disk_path,
disk=const.KVM_default_disk_dev,
ntype=const.default_net_type,
- net_name=const.default_network_name):
+ net_name=const.default_network_name,
+ emu_type=None):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image does not exist')
sys.exit(1)
VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus)
VirtCIM.__init__(self, 'KVM', test_dom, disk, disk_file_path,
- ntype, net_name, mac, vcpus, mem, mem_allocunits)
+ ntype, net_name, mac, vcpus, mem,
+ mem_allocunits, emu_type)
self._os()
self._devices(const.KVM_default_emulator, ntype,
disk_file_path, disk, mac, net_name)
15 years, 12 months
[PATCH] [TEST] Fixing 41_cs_to_settingdefinestate.py CS tc
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1230733277 28800
# Node ID 7e5820001e1f1dbcc8b58b22f7c0506f5a56e288
# Parent 5849e413cc6e3d3330d11fbda9e9b954af774ac0
[TEST] Fixing 41_cs_to_settingdefinestate.py CS tc.
This test has been almost re-written to accomdate latest library changes.
1) cim_define and cim_start usage.
2) Use the library fn enum_rasd().
3) Removed unnecessary import statements.
4) Algined the tc to 80 columns.
Tested with KVM on current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 5849e413cc6e -r 7e5820001e1f suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Tue Dec 23 13:51:22 2008 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Wed Dec 31 06:21:17 2008 -0800
@@ -60,17 +60,13 @@
from VirtLib import utils
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
-from XenKvmLib.test_doms import destroy_and_undefine_all
-from XenKvmLib.assoc import Associators, AssociatorNames
-from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES, \
-CIM_ERROR_ASSOCIATORS
+from XenKvmLib.assoc import Associators, AssociatorNames, compare_all_prop
+from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORS
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL
-from XenKvmLib import rasd
-from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
-verify_diskrasd_values, verify_memrasd_values, rasd_init_list
-from XenKvmLib.common_util import poll_for_state_change
-from XenKvmLib.classes import get_typed_class
+from XenKvmLib.rasd import enum_rasds
+from XenKvmLib.enumclass import GetInstance
+from XenKvmLib.common_util import parse_instance_id
sup_types = ['Xen', 'XenFV', 'KVM']
@@ -79,91 +75,39 @@
test_mem = 128
test_mac = "00:11:22:33:44:aa"
-def vssd_init_list(virt):
- """
- Creating the lists that will be used for comparisons.
- """
- if virt == 'XenFV':
- virt = 'Xen'
-
- vssd_values = {
- 'Caption' : "Virtual System",
- 'InstanceID' : '%s:%s' % (virt, test_dom),
- 'ElementName' : test_dom,
- 'VirtualSystemIdentifier' : test_dom,
- 'VirtualSystemType' : virt,
- 'Classname' : get_typed_class(virt,
- "VirtualSystemSettingData")
- }
-
- return vssd_values
-
-def cs_init_list(cs_dom):
- """
- Creating the lists that will be used for comparisons.
- """
- cs_values = {
- 'Caption' : cs_dom.Caption,
- 'EnabledState' : cs_dom.EnabledState,
- 'RequestedState' : cs_dom.RequestedState,
- 'CreationClassName' : cs_dom.CreationClassName,
- 'Name' : cs_dom.Name
- }
- return cs_values
-
-def setup_env(server, virt, test_disk):
+def setup_env(server, virt):
vsxml_info = None
- status = PASS
- destroy_and_undefine_all(server)
virt_xml = get_class(virt)
vsxml_info = virt_xml(test_dom, mem = test_mem,
vcpus=test_vcpus,
- mac = test_mac,
- disk = test_disk)
+ mac = test_mac)
- ret = vsxml_info.create(server)
+ ret = vsxml_info.cim_define(server)
if not ret:
- logger.error("Failed to create the dom: %s", test_dom)
- status = FAIL
+ logger.error("Failed to define the dom: %s", test_dom)
+ return FAIL, vsxml_info
- return status, vsxml_info
+ status = vsxml_info.cim_start(server)
+ if not ret:
+ logger.error("Failed to start the dom: %s", test_dom)
+ vsxml_info.undefine(server)
+ return FAIL, vsxml_info
+ return PASS, vsxml_info
def print_err(err, detail, cn):
logger.error(err % cn)
logger.error("Exception: %s", detail)
-def vssd_sds_err( an, fieldname, ret_val, exp_val):
- error = "Mismatching %s Values in %s association"
- details = "Returned %s instead of %s"
- err = error % (fieldname, an)
- detail = details % (ret_val, exp_val)
- logger.error(err)
- logger.error(detail)
+def check_len(an, assoc_list_info, qcn, exp_len):
+ if len(assoc_list_info) != exp_len:
+ logger.error("%s returned %i %s objects", an,
+ len(assoc_list_info), qcn)
+ return FAIL
+ return PASS
-def get_associatornames_info(server, virt, vsxml, cn, an, qcn, name):
- status = PASS
- assoc_info = []
- try:
- assoc_info = AssociatorNames(server,
- an,
- cn,
- CreationClassName=cn,
- Name = name)
- if len(assoc_info) < 1:
- logger.error("%s returned %i %s objects" % (an, len(assoc_info), qcn))
- status = FAIL
- except Exception, detail:
- print_err(CIM_ERROR_ASSOCIATORNAMES, detail, cn)
- status = FAIL
-
- if status != PASS:
- vsxml.destroy(server)
-
- return status, assoc_info
-
-def get_associators_info(server, virt, vsxml, cn, an, qcn, instid):
+def get_associators_info(server, virt, cn, an, qcn, instid):
status = PASS
assoc_info = []
try:
@@ -180,228 +124,168 @@
print_err(CIM_ERROR_ASSOCIATORS, detail, cn)
status = FAIL
- if status != PASS:
- vsxml.destroy(server)
-
return status, assoc_info
-def check_len(an, assoc_list_info, qcn, exp_len):
- if len(assoc_list_info) != exp_len:
- logger.error("%s returned %i %s objects", an,
- len(assoc_list_info), qcn)
- return FAIL
- return PASS
+def init_rasd_list(virt, ip):
+ rasd_insts = {}
+ rasds, status = enum_rasds(virt, ip)
+ if status != PASS:
+ logger.error("Enum RASDs failed")
+ return rasd_insts, status
-def get_SDS_verify_RASD_build_vssdc_input(server, virt, vsxml,
- test_disk, sd_assoc_info):
- status = PASS
+ for rasd_cn, rasd_list in rasds.iteritems():
+ for rasd in rasd_list:
+ guest, dev, status = parse_instance_id(rasd.InstanceID)
+ if status != PASS:
+ logger.error("Unable to parse InstanceID: %s" % rasd.InstanceID)
+ return rasd_insts, FAIL
+
+ if guest == test_dom:
+ rasd_insts[rasd.Classname] = rasd
+
+ return rasd_insts, PASS
+
+
+def get_SDS_verify_RASD_build_vssdc_input(server, virt, an, cs_cn,
+ rasd_values, sd_assoc_info):
in_setting_define_state = {}
in_vssdc = {}
- prasd = get_typed_class(virt, 'ProcResourceAllocationSettingData')
- mrasd = get_typed_class(virt, 'MemResourceAllocationSettingData')
- nrasd = get_typed_class(virt, 'NetResourceAllocationSettingData')
- drasd = get_typed_class(virt, 'DiskResourceAllocationSettingData')
-
try:
-
# Building the input for SettingsDefineState association.
- for i in range(len(sd_assoc_info)):
- if sd_assoc_info[i]['SystemName'] == test_dom:
- classname_keyvalue = sd_assoc_info[i]['CreationClassName']
- deviceid = sd_assoc_info[i]['DeviceID']
+ for sd_val in sd_assoc_info:
+ if sd_val['SystemName'] == test_dom:
+ classname_keyvalue = sd_val['CreationClassName']
+ deviceid = sd_val['DeviceID']
in_setting_define_state[classname_keyvalue] = deviceid
- # Expect the SystemDevice to return 4 logical device records.
- # one each for memory, network, disk and processor and hence 4.
- # and hence expect the in_setting_define_state to contain just 4 entries.
- an = get_typed_class(virt, "SystemDevice")
+ # Expect the SystemDevice records == len(rasd_values) entries.
qcn = "Logical Devices"
- exp_len = 4
+ exp_len = len(rasd_values)
if check_len(an, in_setting_define_state, qcn, exp_len) != PASS:
return FAIL, in_setting_define_state
-
- # Get the rasd values that will be used to compare with the SettingsDefineState
- # output.
- status, rasd_values, in_list = rasd_init_list(vsxml, virt, test_disk,
- test_dom, test_mac,
- test_mem)
- if status != PASS:
- return status, rasd_values
- sccn = get_typed_class(virt,"ComputerSystem")
an = get_typed_class(virt,"SettingsDefineState")
for cn, devid in sorted(in_setting_define_state.items()):
- assoc_info = Associators(server,
- an,
- cn,
- DeviceID = devid,
+ assoc_info = Associators(server, an, cn, DeviceID = devid,
CreationClassName = cn,
SystemName = test_dom,
- SystemCreationClassName = sccn)
+ SystemCreationClassName = cs_cn)
- # we expect only one RASD record to be returned for each device that is used to
- # query with the SettingsDefineState association.
+ # we expect only one RASD record to be returned for each device
+ # type when queried with SDS association.
if len(assoc_info) != 1:
- logger.error("%s returned %i %s objects" % (an, len(assoc_info), cn))
- status = FAIL
- break
- index = (len(assoc_info) - 1)
- rasd = rasd_values[cn]
- CCName = assoc_info[index].classname
- if CCName == prasd:
- status = verify_procrasd_values(assoc_info[index], rasd)
- elif CCName == nrasd:
- status = verify_netrasd_values(assoc_info[index], rasd)
- elif CCName == drasd:
- status = verify_diskrasd_values(assoc_info[index], rasd)
- elif CCName == mrasd:
- status = verify_memrasd_values(assoc_info[index], rasd)
- else:
- status = FAIL
- if status != PASS:
- logger.error("Mistmatching RASD values" )
- break
- vs_name = assoc_info[index]['InstanceID']
+ logger.error("%s returned %d %s objects",
+ an, len(assoc_info), cn)
+ return FAIL, in_vssdc
+
+ assoc_val = assoc_info[0]
+ CCName = assoc_val.classname
+ exp_rasd = rasd_values[CCName]
+ if assoc_val['InstanceID'] != exp_rasd.InstanceID:
+ logger.error("Got %s instead of %s"
+ % (assoc_val['InstanceID'], exp_rasd.InstanceID))
+ return FAIL, in_vssdc
+
+ # Build the input required for VSSDC association query.
+ vs_name = assoc_val['InstanceID']
if vs_name.find(test_dom) >= 0:
- instid = assoc_info[index]['InstanceID']
+ instid = assoc_val['InstanceID']
in_vssdc[CCName] = instid
+
except Exception, detail:
print_err(CIM_ERROR_ASSOCIATORS, detail, an)
- status = FAIL
- return status, in_vssdc
+ return FAIL, in_vssdc
+ return PASS, in_vssdc
-def verify_fields(an, field_name, vssd_cs_assoc_info, vssd_cs_values):
- if vssd_cs_assoc_info[field_name] != vssd_cs_values[field_name]:
- vssd_sds_err(an, field_name, vssd_cs_assoc_info[field_name], \
- vssd_cs_values[field_name])
- return FAIL
- return PASS
-
-
-def verify_VSSD_values(assoc_info, vssd_values, an, qcn):
- # We expect that VirtualSystemSettingDataComponent returns only one
- # VirtualSystemSettingData object when queried with disk, processor,
- # network and memory rasd's and all of them return the same output.
+def verify_values(assoc_info, vssd_cs_values, an, qcn):
exp_len = 1
-
if check_len(an, assoc_info, qcn, exp_len) != PASS:
return FAIL
- vssd_assoc = assoc_info[0]
- if verify_fields(an, 'Caption', vssd_assoc, vssd_values) != PASS:
- return FAIL
- if verify_fields(an, 'InstanceID', vssd_assoc, vssd_values) != PASS:
- return FAIL
- if verify_fields(an, 'ElementName', vssd_assoc, vssd_values) != PASS:
- return FAIL
- if verify_fields(an, 'VirtualSystemIdentifier', vssd_assoc, vssd_values) != PASS:
- return FAIL
- if verify_fields(an, 'VirtualSystemType', vssd_assoc, vssd_values) != PASS:
- return FAIL
- if vssd_assoc.classname != vssd_values['Classname']:
- vssd_sds_err(an, 'Classname', vssd_assoc.classname,
- vssd_values['Classname'])
- return FAIL
- return PASS
-def verify_CS_values(assoc_info, cs_values, an, qcn):
- exp_len = 1
-
- if check_len(an, assoc_info, qcn, exp_len) != PASS:
- return FAIL
- cs_assoc = assoc_info[0]
- if verify_fields(an, 'Caption', cs_assoc, cs_values) != PASS:
- return FAIL
- if verify_fields(an, 'EnabledState', cs_assoc, cs_values) != PASS:
- return FAIL
- if verify_fields(an, 'RequestedState', cs_assoc, cs_values) != PASS:
- return FAIL
- if verify_fields(an, 'CreationClassName', cs_assoc, cs_values) != PASS:
- return FAIL
- if verify_fields(an, 'Name', cs_assoc, cs_values) != PASS:
- return FAIL
- return PASS
+ vssd_cs_assoc = assoc_info[0]
+ return compare_all_prop(vssd_cs_assoc, vssd_cs_values)
@do_main(sup_types)
def main():
server = main.options.ip
virt = main.options.virt
- if virt == 'Xen':
- test_disk = "xvda"
- else:
- test_disk = "hda"
- status, vsxml = setup_env(server, virt, test_disk)
+ status, vsxml = setup_env(server, virt)
if status != PASS:
return status
+ try:
+ cs_class = get_typed_class(virt, 'ComputerSystem')
+ keys = { 'Name' : test_dom, 'CreationClassName' : cs_class }
+ dom_cs = GetInstance(server, cs_class, keys)
+ if dom_cs.Name != test_dom and dom_cs.RequestedState != 0:
+ raise Exception("Instance matching %s was not returned" % test_dom)
- status, cs_dom = poll_for_state_change(server, virt, test_dom, 2,
- timeout=10)
- if status != PASS and cs_dom.RequestedState != 0:
- vsxml.destroy(server)
- return FAIL
+ an = get_typed_class(virt, 'SystemDevice')
+ qcn = 'Logical Devices'
+ sd_assoc = AssociatorNames(server, an, cs_class,
+ CreationClassName=cs_class,
+ Name = test_dom)
+ if len(sd_assoc) < 1:
+ raise Exception ("%s returned %d %s objects" \
+ % (an, len(sd_assoc), qcn))
- # Creating the cs info list which will be used later for comparison.
- cs_values = cs_init_list(cs_dom)
-
- cn = cs_dom.CreationClassName
- an = get_typed_class(virt, 'SystemDevice')
- qcn = 'Logical Devices'
- name = test_dom
- status, sd_assoc_info = get_associatornames_info(server, virt, vsxml,
- cn, an, qcn, name)
- if status != PASS or len(sd_assoc_info) == 0:
- return status
+ rasd_val, status = init_rasd_list(virt, server)
+ status, in_vssdc_list = get_SDS_verify_RASD_build_vssdc_input(server,
+ virt, an,
+ cs_class,
+ rasd_val,
+ sd_assoc)
+ exp_len = len(rasd_val)
+ if status !=PASS or check_len(an, in_vssdc_list, qcn, exp_len) != PASS:
+ raise Exception ("Failed to get VSSDC info")
- status, in_vssdc_list = get_SDS_verify_RASD_build_vssdc_input(server, virt,
- vsxml, test_disk,
- sd_assoc_info)
- if status != PASS or len(in_vssdc_list) == 0 :
- vsxml.destroy(server)
- return status
+ # Get the vssd values which will be used for verifying the
+ # VSSD output from the VSSDC results.
+ vssd_class = get_typed_class(virt, 'VirtualSystemSettingData')
+ if virt == "XenFV":
+ instIdval = "Xen:%s" % test_dom
+ else:
+ instIdval = "%s:%s" % (virt, test_dom)
+ keys = { 'InstanceID' : instIdval }
+ vssd_values = GetInstance(server, vssd_class, keys)
+ if vssd_values.ElementName != test_dom:
+ raise Exception ("Instance matching %s was not returned" \
+ % test_dom)
- # Verifying that the in_vssdc_list contains 4 entries one each for mem rasd,
- # network rasd, processor rasd and disk rasd.
- exp_len = 4
- if check_len(an, in_vssdc_list, qcn, exp_len) != PASS:
- vsxml.destroy(server)
- return FAIL
+ an = get_typed_class(virt, 'VirtualSystemSettingDataComponent')
+ for cn, instid in sorted((in_vssdc_list.items())):
+ status, vssd_assoc_info = get_associators_info(server, virt, cn, an,
+ vssd_class, instid)
+ if status != PASS or len(vssd_assoc_info) == 0:
+ raise Exception ("Failed to get VSSD info")
- # Get the vssd values which will be used for verifying the
- # VirtualSystemSettingData output from the
- # VirtualSystemSettingDataComponent results.
- vssd_values = vssd_init_list(virt)
- an = get_typed_class(virt, 'VirtualSystemSettingDataComponent')
- qcn = get_typed_class(virt, 'VirtualSystemSettingData')
- for cn, instid in sorted((in_vssdc_list.items())):
- status, vssd_assoc_info = get_associators_info(server, virt, vsxml, cn,
- an, qcn, instid)
- if status != PASS or len(vssd_assoc_info) == 0:
- break
- status = verify_VSSD_values(vssd_assoc_info, vssd_values, an, qcn)
- if status != PASS:
- break
- if status != PASS:
- vsxml.destroy(server)
- return status
+ status = verify_values(vssd_assoc_info, vssd_values, an, qcn)
+ if status != PASS:
+ raise Exception ("VSSD values verification error")
- # Since the VirtualSystemSettingDataComponent returns similar
- # output when queried with every RASD, we are taking the output of
- # the last associtaion query as inputs for
- # querying SettingsDefineState.
- cn = vssd_assoc_info[0].classname
- an = get_typed_class(virt, 'SettingsDefineState')
- qcn = get_typed_class(virt, 'ComputerSystem')
- instid = vssd_assoc_info[0]['InstanceID']
- status, cs_assoc_info = get_associators_info(server, virt, vsxml, cn,
- an, qcn, instid)
- if status != PASS or len(cs_assoc_info) == 0:
- return status
+ # Since the VirtualSystemSettingDataComponent returns similar
+ # output when queried with every RASD, we are taking the output of
+ # the last associtaion query as inputs for
+ # querying SettingsDefineState.
+ cn = vssd_assoc_info[0].classname
+ an = get_typed_class(virt, 'SettingsDefineState')
+ instid = vssd_assoc_info[0]['InstanceID']
+ status, cs_assoc_info = get_associators_info(server, virt, cn, an,
+ cs_class, instid)
+ if status != PASS or len(cs_assoc_info) == 0:
+ raise Exception ("Failed to get assoc info for dom: %s", test_dom)
- # verify the results of SettingsDefineState with the cs_values list that was
- # built using the output of the enumeration on ComputerSystem.
- status = verify_CS_values(cs_assoc_info, cs_values, an, qcn)
+ # verify the results of SettingsDefineState with the cs_values list that was
+ # built using the output of the GetInstance on ComputerSystem.
+ status = verify_values(cs_assoc_info, dom_cs, an, cs_class)
+
+ except Exception, details:
+ logger.error("Exception details is %s", details)
+ status = FAIL
+
vsxml.destroy(server)
+ vsxml.undefine(server)
return status
if __name__ == "__main__":
sys.exit(main())
15 years, 12 months
[PATCH] [TEST] Update CS 06_paused_active_suspend.py to use cim_() functions
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1230073744 28800
# Node ID f95c0c4d4ef6d807262ba06f5087caa80156d917
# Parent a9826c20a65bc16c2c205b183e4fa8eafde08d30
[TEST] Update CS 06_paused_active_suspend.py to use cim_() functions.
This test has been re-written so it is now easier to read and flows better.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r a9826c20a65b -r f95c0c4d4ef6 suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py Tue Dec 23 15:03:40 2008 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py Tue Dec 23 15:09:04 2008 -0800
@@ -26,7 +26,7 @@
# information related to this is captured in the RequestedState Property
# of the VS.
# The test is considered to be successful if RequestedState Property
-# has a value of "9" when the VS is moved from active to suspend state.
+# has a value of "9" when the VS is moved from active to paused state.
#
# List of Valid state values (Refer to VSP spec doc Table 2 for more)
# ---------------------------------
@@ -35,27 +35,22 @@
# Defined | 3
# Active | 2
# Paused | 9
-# Suspended | 6
#
#
# Date :18-10-2007
import sys
-from XenKvmLib import vxml
-from VirtLib import utils
-from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib.vxml import get_class
from CimTest.Globals import logger
from XenKvmLib.const import do_main
-from XenKvmLib.common_util import call_request_state_change, \
-poll_for_state_change
from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.enumclass import GetInstance
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "DomST1"
-mem = 128 # MB
START_STATE = 2
FINAL_STATE = 9
-TIME = "00000000000000.000000:000"
bug_libvirt = "00011"
@do_main(sup_types)
@@ -65,69 +60,57 @@
server = options.ip
virt = options.virt
- destroy_and_undefine_all(server)
-
- cxml = vxml.get_class(virt)(test_dom, mem)
+ cxml = get_class(virt)(test_dom)
#Create VS
+ pause_failed = False
try:
- ret = cxml.create(server)
+ ret = cxml.cim_define(server)
if not ret:
- logger.error("VS '%s' was not created" % test_dom)
- return status
+ raise Exception("VS '%s' was not defined" % test_dom)
+
+ status = cxml.cim_start(server)
+ if status != PASS:
+ raise Exception("Unable start dom '%s'" % test_dom)
+
+ cs_class = get_typed_class(virt, 'ComputerSystem')
+ keys = { 'Name' : test_dom, 'CreationClassName' : cs_class }
+
+ dom_cs = GetInstance(server, cs_class, keys)
+ if dom_cs.Name != test_dom:
+ raise Exception("Instance matching %s was not returned" % test_dom)
+
+ if int(dom_cs.EnabledState) != int(START_STATE):
+ raise Exception("%s start state is %s, exp %s" % (test_dom,
+ dom_cs.EnabledState, START_STATE))
+
+ #Pause the VS
+ status = cxml.cim_pause(server)
+ if status != PASS:
+ pause_failed = True
+ raise Exception("Unable pause dom '%s'" % test_dom)
+
+ cs = GetInstance(server, cs_class, keys)
+ if cs.Name != test_dom:
+ raise Exception("Instance matching %s was not returned" % test_dom)
+
+ if int(cs.EnabledState) != int(FINAL_STATE):
+ raise Exception("%s final state is %s, exp %s" % (test_dom,
+ cs.RequestedState, FINAL_STATE))
+
+ if int(cs.EnabledState) != int(cs.RequestedState):
+ raise Exception("%s enabled state %s != requested state %s" % \
+ (test_dom, cs.EnabledState, cs.RequestedState))
+
except Exception, detail:
logger.error("Exception variable: %s" % detail)
- return status
-
- status, dom_cs = poll_for_state_change(server, virt, test_dom,
- START_STATE)
-
- if status != PASS:
- cxml.destroy(server)
- return status
-
- from_State = dom_cs.EnabledState
-
- #Suspend the VS
- status = call_request_state_change(test_dom, server, FINAL_STATE,
- TIME, virt)
- if status != PASS:
- logger.error("Unable to suspend dom '%s' using RequestedStateChange()",
- test_dom)
- cxml.destroy(server)
- if virt == 'LXC':
- return XFAIL_RC(bug_libvirt)
- return status
-
- #Polling for the value of EnabledState to be set to 9.
- #We need to wait for the EnabledState to be set appropriately since
- #it does not get set immediatley to value of 9 when suspended.
- status, dom_cs = poll_for_state_change(server, virt, test_dom,
- FINAL_STATE, timeout=40)
-
- if status != PASS:
- cxml.destroy(server)
- return status
-
- enabledState = dom_cs.EnabledState
- to_RequestedState = dom_cs.RequestedState
-
- # Success:
- # if
- # From state == 2
- # To state == 9
- # Enabled_state == RequestedState
-
- if from_State == START_STATE and \
- to_RequestedState == FINAL_STATE and \
- to_RequestedState == enabledState:
- status = PASS
- else:
- logger.error("VS '%s' transition from Activate State to Suspend State"
- " was not Successful" % test_dom)
status = FAIL
cxml.destroy(server)
+ cxml.undefine(options.ip)
+
+ if pause_failed and virt == 'LXC':
+ return XFAIL_RC(bug_libvirt)
return status
if __name__ == "__main__":
15 years, 12 months
[PATCH] [TEST] Update CS 23_suspend_suspend.py to use cim_() functions
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1230074874 28800
# Node ID 1d9bc3da6af086608bd305982e2f2e95a445ed0f
# Parent f95c0c4d4ef6d807262ba06f5087caa80156d917
[TEST] Update CS 23_suspend_suspend.py to use cim_() functions.
This test has been renamed to 23_pause_pause.py. Using the CIM requested state
names is clearer.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r f95c0c4d4ef6 -r 1d9bc3da6af0 suites/libvirt-cim/cimtest/ComputerSystem/23_pause_pause.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/23_pause_pause.py Tue Dec 23 15:27:54 2008 -0800
@@ -0,0 +1,98 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Anoop V Chakkalakkal<anoop.vijayan(a)in.ibm.com>
+# 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
+#
+# Test Case Info:
+# --------------
+# This test case is used to verify the Virtual System State Transition
+# information is captured in the RequestedState Property of the VS.
+# The test is considered to be successful if RequestedState Property
+# has a value of 9 when the VS is moved from active to paused state
+# and returns an excpetion when paused again.
+#
+# List of Valid state values (Refer to VSP spec doc Table 2 for more)
+# ---------------------------------
+# State | Values
+# ---------------------------------
+# Defined | 3
+# Active | 2
+# Paused | 9
+#
+# Date: 29-02-2008
+
+import sys
+from CimTest.Globals import logger
+from XenKvmLib.const import do_main
+from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from XenKvmLib.vxml import get_class
+
+sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+
+default_dom = 'cs_test_domain'
+
+bug_libvirt = "00011"
+
+@do_main(sup_types)
+def main():
+ options = main.options
+ server = options.ip
+ virt = options.virt
+
+ action_failed = False
+ try:
+ # define the vs
+ cxml = get_class(options.virt)(default_dom)
+ ret = cxml.cim_define(server)
+ if not ret:
+ raise Exception("Failed to define the guest: %s" % default_dom)
+
+ # start, pause
+ status = cxml.cim_start(server)
+ if status != PASS:
+ action_failed = True
+ raise Exception("Unable start dom '%s'" % default_dom)
+
+ status = cxml.cim_pause(server)
+ if status != PASS:
+ action_failed = True
+ raise Exception("Unable pause dom '%s'" % default_dom)
+
+ status = cxml.cim_pause(server)
+ if status != FAIL:
+ action_failed = True
+ raise Exception("Pausing an already paused guest should fail")
+
+ status = PASS
+
+ except Exception, detail:
+ logger.error("Exception: '%s'", detail)
+ status = FAIL
+
+ cxml.cim_destroy(server)
+ cxml.undefine(server)
+
+ if action_failed and virt == "LXC":
+ return XFAIL_RC(bug_libvirt)
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
diff -r f95c0c4d4ef6 -r 1d9bc3da6af0 suites/libvirt-cim/cimtest/ComputerSystem/23_suspend_suspend.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/23_suspend_suspend.py Tue Dec 23 15:09:04 2008 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2008 IBM Corp.
-#
-# Authors:
-# Anoop V Chakkalakkal<anoop.vijayan(a)in.ibm.com>
-# 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
-#
-# Test Case Info:
-# --------------
-# This test case is used to verify the Virtual System State Transition
-# information is captured in the RequestedState Property of the VS.
-# The test is considered to be successful if RequestedState Property
-# has a value of 9 when the VS is moved from active to suspend state
-# and returns an excpetion when supended again.
-#
-# List of Valid state values (Refer to VSP spec doc Table 2 for more)
-# ---------------------------------
-# State | Values
-# ---------------------------------
-# Defined | 3
-# Active | 2
-# Suspended | 9
-#
-# Date: 29-02-2008
-
-import sys
-import pywbem
-from VirtLib import utils
-from CimTest.Globals import logger
-from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
-from XenKvmLib.test_doms import destroy_and_undefine_domain
-from XenKvmLib.common_util import create_using_definesystem, \
- call_request_state_change, \
- try_request_state_change, \
- poll_for_state_change
-
-sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-
-ACTIVE_STATE = 2
-SUSPND_STATE = 9
-
-default_dom = 'cs_test_domain'
-TIME = "00000000000000.000000:000"
-err_no = pywbem.CIM_ERR_FAILED
-err_desc = "Domain not running"
-
-bug_libvirt = "00011"
-
-@do_main(sup_types)
-def main():
- options = main.options
- server = options.ip
- virt = options.virt
-
- tc_scen = [('Start', [ACTIVE_STATE, ACTIVE_STATE]), \
- ('Suspend', [SUSPND_STATE, SUSPND_STATE])]
- try:
- # define the vs
- status = create_using_definesystem(default_dom,
- server,
- virt=virt)
- if status != PASS:
- logger.error("Unable to define domain '%s' using DefineSystem()",
- default_dom)
- return status
-
- # start, suspend
- for action, state in tc_scen:
- en_state = state[0]
- rq_state = state[1]
- status = call_request_state_change(default_dom, server,
- rq_state, TIME, virt)
- if status != PASS:
- logger.error("Unable to '%s' dom '%s' using RequestedStateChange()",
- action, default_dom)
- break
-
- status, dom_cs = poll_for_state_change(server, virt, default_dom, en_state,
- timeout=30)
- if status != PASS or dom_cs.RequestedState != rq_state:
- status = FAIL
- logger.error("Attributes for dom '%s' is not set as expected.",
- default_dom)
- break
-
- except Exception, detail:
- logger.error("Exception: '%s'", detail)
- status = FAIL
-
- if status != PASS:
- destroy_and_undefine_domain(default_dom, server, virt)
- if virt == 'LXC':
- return XFAIL_RC(bug_libvirt)
- return status
-
- # try to suspend already suspended VS
- rq_state = SUSPND_STATE
- status = try_request_state_change(default_dom, server,
- rq_state, TIME, err_no,
- err_desc, virt)
-
- destroy_and_undefine_domain(default_dom, server, virt)
-
- return status
-
-if __name__ == "__main__":
- sys.exit(main())
16 years
[PATCH] [TEST] Update CS 05_activate_defined_start.py
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1230073420 28800
# Node ID a9826c20a65bc16c2c205b183e4fa8eafde08d30
# Parent 660adffeba4f0bc2b9d54f8b5c750fbc623ca791
[TEST] Update CS 05_activate_defined_start.py
Re-wrote this test to fix readibilty and layout.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 660adffeba4f -r a9826c20a65b suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Tue Dec 23 13:51:22 2008 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Tue Dec 23 15:03:40 2008 -0800
@@ -42,19 +42,17 @@
# Date : 17-10-2007
import sys
-from XenKvmLib import enumclass
-from XenKvmLib import vxml
-from VirtLib import utils
+from XenKvmLib.enumclass import GetInstance
+from XenKvmLib.vxml import get_class
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from XenKvmLib.classes import get_typed_class
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "DomST1"
-mem = 128 # MB
-bug_no = "00002"
-START_STATE = 3
+
+START_STATE = 3
FINAL_STATE = 2
@do_main(sup_types)
@@ -62,7 +60,7 @@
options = main.options
status = FAIL
- cxml = vxml.get_class(options.virt)(test_dom, mem)
+ cxml = get_class(options.virt)(test_dom)
ret = cxml.cim_define(options.ip)
#Define a VS
if not ret :
@@ -73,52 +71,35 @@
keys = { 'Name' : test_dom, 'CreationClassName' : cs_class }
try:
- cs = enumclass.GetInstance(options.ip, cs_class, keys)
- if cs.Name == test_dom:
- from_State = cs.EnabledState
- else:
- logger.error("VS '%s' is not available", test_dom)
- return status
+ cs = GetInstance(options.ip, cs_class, keys)
+ if cs.Name != test_dom:
+ raise Exception("VS '%s' is not available" % test_dom)
+
+ if int(cs.EnabledState) != int(START_STATE):
+ raise Exception("%s start state is %s, exp %s" % (test_dom,
+ cs.EnabledState, START_STATE))
+
+ #Change the state of the VS to Start
+ status = cxml.cim_start(options.ip)
+ if status != PASS:
+ raise Exception("Unable start dom '%s'" % test_dom)
+
+ #Get the value of the EnabledState property and RequestedState property.
+ cs = GetInstance(options.ip, cs_class, keys)
+ if cs.Name != test_dom:
+ raise Exception("VS '%s' is not found" % test_dom)
+
+ if int(cs.EnabledState) != int(FINAL_STATE):
+ raise Exception("%s final state is %s, exp %s" % (test_dom,
+ cs.RequestedState, FINAL_STATE))
+
+ if int(cs.EnabledState) != int(cs.RequestedState):
+ raise Exception("%s enabled state %s != requested state %s" % \
+ (test_dom, cs.EnabledState, cs.RequestedState))
except Exception, detail:
logger.error("Exception: %s" % detail)
- cxml.undefine(options.ip)
- return status
-
- try:
- #Change the state of the VS to Start
- status = cxml.cim_start(options.ip)
- if status != PASS:
- logger.error("Unable start dom '%s' using "
- "RequestedStateChange()", test_dom)
- cxml.undefine(options.ip)
- return status
-
- #Get the value of the EnabledState property and RequestedState property.
- cs= enumclass.GetInstance(options.ip, cs_class, keys)
- if cs.Name == test_dom:
- to_RequestedState = cs.RequestedState
- enabledState = cs.EnabledState
- else:
- logger.error("VS '%s' is not found", test_dom)
- return status
-
- # Success:
- # if
- # From state == defined
- # To state == running
- # Enabled_state == RequestedState
-
- if from_State == START_STATE and \
- to_RequestedState == FINAL_STATE and \
- enabledState == to_RequestedState:
- status = PASS
- else:
- logger.error("VS '%s' transition from Defined State to "
- "Activate state was not Successful", test_dom)
- status = XFAIL_RC(bug_no)
- except Exception, detail:
- logger.error("Exception: %s" % detail)
+ status = FAIL
cxml.cim_destroy(options.ip)
cxml.undefine(options.ip)
16 years
Test Run Summary (Dec 29 2008): Xen on Red Hat Enterprise Linux Server release 5.2 Beta (Tikanga) with Pegasus
by Deepti B Kalakeri
=================================================
Test Run Summary (Dec 29 2008): Xen on Red Hat Enterprise Linux Server
release 5.2 Beta (Tikanga) with Pegasus
=================================================
Distro: Red Hat Enterprise Linux Server release 5.2 Beta (Tikanga)
Kernel: 2.6.18-88.el5xen
libvirt: 0.3.3
Hypervisor: Xen 3.1.0
CIMOM: Pegasus 2.7.0
Libvirt-cim revision: 791
Libvirt-cim changeset: 3557859610b4
Cimtest revision: 575
Cimtest changeset: 5849e413cc6e
=================================================
FAIL : 3
XFAIL : 1
SKIP : 3
PASS : 133
-----------------
Total : 140
=================================================
FAIL Test Summary:
ComputerSystem - 41_cs_to_settingdefinestate.py: FAIL
RASD - 01_verify_rasd_fields.py: FAIL
VirtualSystemMigrationService - 02_host_migrate_type.py: FAIL
=================================================
XFAIL Test Summary:
ComputerSystem - 33_suspend_reboot.py: XFAIL
=================================================
SKIP Test Summary:
ComputerSystem - 02_nosystems.py: SKIP
LogicalDisk - 02_nodevs.py: SKIP
NetworkPort - 03_user_netport.py: SKIP
=================================================
Full report:
--------------------------------------------------------------------
AllocationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
AllocationCapabilities - 02_alloccap_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 01_enum.py: PASS
--------------------------------------------------------------------
ComputerSystem - 02_nosystems.py: SKIP
--------------------------------------------------------------------
ComputerSystem - 03_defineVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 04_defineStartVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 05_activate_defined_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 06_paused_active_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 22_define_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 23_suspend_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 27_define_suspend_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 32_start_reboot.py: PASS
--------------------------------------------------------------------
ComputerSystem - 33_suspend_reboot.py: XFAIL
ERROR - In fn cim_state_change()
ERROR - Failed to change state of the domain 'test_domain'
ERROR - Exception: (7, u'CIM_ERR_NOT_SUPPORTED: State not supported')
ERROR - Exception: Unable Suspend dom 'test_domain'
InvokeMethod(RequestStateChange): CIM_ERR_NOT_SUPPORTED: State not supported
Bug:<00012>
--------------------------------------------------------------------
ComputerSystem - 35_start_reset.py: PASS
--------------------------------------------------------------------
ComputerSystem - 40_RSC_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 41_cs_to_settingdefinestate.py: FAIL
ERROR - Xen_SystemDevice returned 6 Logical Devices objects
--------------------------------------------------------------------
ComputerSystem - 42_cs_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystemIndication - 01_created_indication.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 03_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 04_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 05_hostsystem_cap.py: PASS
--------------------------------------------------------------------
ElementConforms - 01_forward.py: PASS
--------------------------------------------------------------------
ElementConforms - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementConforms - 03_ectp_fwd_errs.py: PASS
--------------------------------------------------------------------
ElementConforms - 04_ectp_rev_errs.py: PASS
--------------------------------------------------------------------
ElementSettingData - 01_forward.py: PASS
--------------------------------------------------------------------
ElementSettingData - 03_esd_assoc_with_rasd_errs.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 02_elecap_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 01_enum.py: PASS
--------------------------------------------------------------------
HostSystem - 02_hostsystem_to_rasd.py: PASS
--------------------------------------------------------------------
HostSystem - 03_hs_to_settdefcap.py: PASS
--------------------------------------------------------------------
HostSystem - 04_hs_to_EAPF.py: PASS
--------------------------------------------------------------------
HostSystem - 05_hs_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 06_hs_to_vsms.py: PASS
--------------------------------------------------------------------
HostedDependency - 01_forward.py: PASS
--------------------------------------------------------------------
HostedDependency - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedDependency - 03_enabledstate.py: PASS
--------------------------------------------------------------------
HostedDependency - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 01_forward.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedService - 01_forward.py: PASS
--------------------------------------------------------------------
HostedService - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedService - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedService - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
LogicalDisk - 01_disk.py: PASS
--------------------------------------------------------------------
LogicalDisk - 02_nodevs.py: SKIP
ERROR - System has defined domains; unable to run
--------------------------------------------------------------------
LogicalDisk - 03_ld_gi_errs.py: PASS
--------------------------------------------------------------------
Memory - 01_memory.py: PASS
--------------------------------------------------------------------
Memory - 02_defgetmem.py: PASS
--------------------------------------------------------------------
Memory - 03_mem_gi_errs.py: PASS
--------------------------------------------------------------------
NetworkPort - 01_netport.py: PASS
--------------------------------------------------------------------
NetworkPort - 02_np_gi_errors.py: PASS
--------------------------------------------------------------------
NetworkPort - 03_user_netport.py: SKIP
--------------------------------------------------------------------
Processor - 01_processor.py: PASS
--------------------------------------------------------------------
Processor - 02_definesys_get_procs.py: PASS
--------------------------------------------------------------------
Processor - 03_proc_gi_errs.py: PASS
--------------------------------------------------------------------
Profile - 01_enum.py: PASS
--------------------------------------------------------------------
Profile - 02_profile_to_elec.py: PASS
--------------------------------------------------------------------
Profile - 03_rprofile_gi_errs.py: PASS
--------------------------------------------------------------------
RASD - 01_verify_rasd_fields.py: FAIL
ERROR - Mistmatching association values
--------------------------------------------------------------------
RASD - 02_enum.py: PASS
--------------------------------------------------------------------
RASD - 03_rasd_errs.py: PASS
--------------------------------------------------------------------
RASD - 04_disk_rasd_size.py: PASS
--------------------------------------------------------------------
RedirectionService - 01_enum_crs.py: PASS
--------------------------------------------------------------------
RedirectionService - 02_enum_crscap.py: PASS
--------------------------------------------------------------------
RedirectionService - 03_RedirectionSAP_errs.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 01_verify_refprof.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 02_refprofile_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 05_RAPF_err.py: PASS
--------------------------------------------------------------------
ResourcePool - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePool - 02_rp_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 02_rpcc_gi_errs.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 02_rcps_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 03_CreateResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 05_AddResourcesToResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService -
06_RemoveResourcesFromResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: PASS
--------------------------------------------------------------------
SettingsDefine - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefine - 02_reverse.py: PASS
--------------------------------------------------------------------
SettingsDefine - 03_sds_fwd_errs.py: PASS
--------------------------------------------------------------------
SettingsDefine - 04_sds_rev_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 04_forward_vsmsdata.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 05_reverse_vsmcap.py: PASS
--------------------------------------------------------------------
SystemDevice - 01_forward.py: PASS
--------------------------------------------------------------------
SystemDevice - 02_reverse.py: PASS
--------------------------------------------------------------------
SystemDevice - 03_fwderrs.py: PASS
--------------------------------------------------------------------
VSSD - 01_enum.py: PASS
--------------------------------------------------------------------
VSSD - 02_bootldr.py: PASS
--------------------------------------------------------------------
VSSD - 03_vssd_gi_errs.py: PASS
--------------------------------------------------------------------
VSSD - 04_vssd_to_rasd.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 02_vsmcap_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 01_definesystem_name.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 02_destroysystem.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 03_definesystem_ess.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 04_definesystem_ers.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 05_destroysystem_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 06_addresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 07_addresource_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 08_modifyresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 09_procrasd_persist.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 10_hv_version.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 11_define_memrasdunits.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 12_referenced_config.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 13_refconfig_additional_devs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 14_define_sys_disk.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 15_mod_system_settings.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationService - 01_migratable_host.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationService - 02_host_migrate_type.py: FAIL
ERROR - EnabledState is 9 instead of 2.
ERROR - Try to increase the timeout and run the test again
ERROR - Error start domain dom_migrate
ERROR - AttributeError : 'NoneType' object has no attribute 'destroy'
Traceback (most recent call last):
File "./lib/XenKvmLib/const.py", line 132, in do_try
File "02_host_migrate_type.py", line 184, in main
cxml.destroy(options.ip)
AttributeError: 'NoneType' object has no attribute 'destroy'
ERROR - None
--------------------------------------------------------------------
VirtualSystemMigrationService - 05_migratable_host_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 02_vsmsd_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 01_forward.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 02_reverse.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 03_vssdc_fwd_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 04_vssdc_rev_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 02_vs_sservice_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 02_vs_sservicecap_gi_errs.py:
PASS
--------------------------------------------------------------------
Thanks and Regards,
Deepti.
16 years
[PATCH] [TEST] Fix ComputerSystem/41_cs_to_settingdefinestate.py to work with Input and Graphics devices
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1230616480 28800
# Node ID 50352cad18df68a6beb36a0c16c7e4b2591b8290
# Parent 5849e413cc6e3d3330d11fbda9e9b954af774ac0
[TEST] Fix ComputerSystem/41_cs_to_settingdefinestate.py to work with Input and Graphics devices
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 5849e413cc6e -r 50352cad18df suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Tue Dec 23 13:51:22 2008 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Mon Dec 29 21:54:40 2008 -0800
@@ -62,17 +62,21 @@
from XenKvmLib.classes import get_typed_class
from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib.assoc import Associators, AssociatorNames
+from XenKvmLib.const import get_provider_version
from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES, \
CIM_ERROR_ASSOCIATORS
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib import rasd
from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
-verify_diskrasd_values, verify_memrasd_values, rasd_init_list
+verify_diskrasd_values, verify_memrasd_values, verify_inputrasd_values, \
+verify_displayrasd_values, rasd_init_list
from XenKvmLib.common_util import poll_for_state_change
from XenKvmLib.classes import get_typed_class
sup_types = ['Xen', 'XenFV', 'KVM']
+graphics_dev_rev = 725
+input_dev_rev = 745
test_dom = "CrossClass_GuestDom"
test_vcpus = 1
@@ -200,7 +204,9 @@
prasd = get_typed_class(virt, 'ProcResourceAllocationSettingData')
mrasd = get_typed_class(virt, 'MemResourceAllocationSettingData')
nrasd = get_typed_class(virt, 'NetResourceAllocationSettingData')
- drasd = get_typed_class(virt, 'DiskResourceAllocationSettingData')
+ drasd = get_typed_class(virt, 'DiskResourceAllocationSettingData')
+ grasd = get_typed_class(virt, 'GraphicsResourceAllocationSettingData')
+ irasd = get_typed_class(virt, 'InputResourceAllocationSettingData')
try:
@@ -216,7 +222,13 @@
# and hence expect the in_setting_define_state to contain just 4 entries.
an = get_typed_class(virt, "SystemDevice")
qcn = "Logical Devices"
- exp_len = 4
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev >= graphics_dev_rev and curr_cim_rev <= input_dev_rev:
+ exp_len = 5
+ elif curr_cim_rev >= input_dev_rev:
+ exp_len = 6
+ else:
+ exp_len = 4
if check_len(an, in_setting_define_state, qcn, exp_len) != PASS:
return FAIL, in_setting_define_state
@@ -256,6 +268,10 @@
status = verify_diskrasd_values(assoc_info[index], rasd)
elif CCName == mrasd:
status = verify_memrasd_values(assoc_info[index], rasd)
+ elif CCName == grasd:
+ status = verify_displayrasd_values(assoc_info[index], rasd)
+ elif CCName == irasd:
+ status = verify_inputrasd_values(assoc_info[index], rasd)
else:
status = FAIL
if status != PASS:
@@ -362,7 +378,13 @@
# Verifying that the in_vssdc_list contains 4 entries one each for mem rasd,
# network rasd, processor rasd and disk rasd.
- exp_len = 4
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev >= graphics_dev_rev and curr_cim_rev <= input_dev_rev:
+ exp_len = 5
+ elif curr_cim_rev >= input_dev_rev:
+ exp_len = 6
+ else:
+ exp_len = 4
if check_len(an, in_vssdc_list, qcn, exp_len) != PASS:
vsxml.destroy(server)
return FAIL
16 years
[PATCH] [TEST] Fixing the 01_verify_rasd_fields.py tc of RASD
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1230542050 28800
# Node ID 3d716a88ae175ef1f19cc1c55addfb3fcdbcb18e
# Parent b7d80fdeb2a3318749f0faa4b2ad9725da97cc56
[TEST] Fixing the 01_verify_rasd_fields.py tc of RASD.
Tested for KVM, Xen, LXC with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r b7d80fdeb2a3 -r 3d716a88ae17 suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py
--- a/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py Mon Dec 22 23:03:01 2008 -0800
+++ b/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py Mon Dec 29 01:14:10 2008 -0800
@@ -47,18 +47,14 @@
import sys
-from CimTest import Globals
from XenKvmLib.const import do_main
-from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib import assoc
from XenKvmLib import vxml
from XenKvmLib.classes import get_typed_class
-from XenKvmLib import rasd
-from CimTest.Globals import logger
+from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORS
from CimTest.ReturnCodes import PASS, FAIL
-from XenKvmLib import rasd
-from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
-verify_diskrasd_values, verify_memrasd_values, rasd_init_list
+from XenKvmLib.rasd import enum_rasds
+from XenKvmLib.common_util import parse_instance_id
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
@@ -67,74 +63,82 @@
test_mem = 128
test_mac = "00:11:22:33:44:aa"
-def assoc_values(assoc_info, xml, disk, virt="Xen"):
- status, rasd_values, in_list = rasd_init_list(xml, virt, disk, test_dom,
- test_mac, test_mem)
+def init_rasd_list(virt, ip):
+ rasd_insts = {}
+ rasds, status = enum_rasds(virt, ip)
+ if status != PASS:
+ logger.error("Enum RASDs failed")
+ return rasd_insts, status
+
+ for rasd_cn, rasd_list in rasds.iteritems():
+ for rasd in rasd_list:
+ guest, dev, status = parse_instance_id(rasd.InstanceID)
+ if status != PASS:
+ logger.error("Unable to parse InstanceID: %s" % rasd.InstanceID)
+ return rasd_insts, FAIL
+
+ if guest == test_dom:
+ rasd_insts[rasd.Classname] = rasd
+
+ return rasd_insts, PASS
+
+def verify_rasd(virt, ip, assoc_info):
+ rasds, status = init_rasd_list(virt, ip)
if status != PASS:
return status
-
- procrasd = rasd_values['%s' %in_list['proc']]
- netrasd = rasd_values['%s' %in_list['net']]
- diskrasd = rasd_values['%s' %in_list['disk']]
- memrasd = rasd_values['%s' %in_list['mem']]
- if virt == 'LXC':
- proc_status = 0
- disk_status = 0
- else:
- proc_status = 1
- disk_status = 1
+ if len(assoc_info) != len(rasds):
+ logger.error("%d assoc_info != %d RASD insts",
+ len(assoc_info), len(rasds))
+ return FAIL
- net_status = 0
- mem_status = 1
- status = 0
- try:
- for res in assoc_info:
- if res['InstanceID'] == procrasd['InstanceID']:
- proc_status = rasd.verify_procrasd_values(res, procrasd)
- elif res['InstanceID'] == netrasd['InstanceID']:
- net_status = rasd.verify_netrasd_values(res, netrasd)
- elif res['InstanceID'] == diskrasd['InstanceID']:
- disk_status = rasd.verify_diskrasd_values(res, diskrasd)
- elif res['InstanceID'] == memrasd['InstanceID']:
- mem_status = rasd.verify_memrasd_values(res, memrasd)
+ for rasd in assoc_info:
+ guest, dev, status = parse_instance_id(rasd['InstanceID'])
+ if status != PASS:
+ logger.error("Unable to parse InstanceID: %s", rasd['InstanceID'])
+ return status
+
+ if guest != test_dom:
+ continue
+
+ logger.info("Verifying: %s", rasd.classname)
+ exp_rasd = rasds[rasd.classname]
+ for item in rasd.items():
+ key = item[0]
+ exp_val = eval('exp_rasd.' + key)
+ ret_rasd_val = rasd[key]
+ if ret_rasd_val == exp_val:
+ status = PASS
else:
- status = 1
- if status != 0 or proc_status != 0 or net_status != 0 or \
- disk_status != 0 or mem_status != 0 :
- logger.error("Mistmatching association values" )
- status = 1
- except Exception, detail :
- logger.error("Exception in assoc_values function: %s" % detail)
- status = 1
-
- return status
-
+ logger.info("Got %s instead of %s", ret_rasd_val, exp_val)
+ status = FAIL
+ break
+
+ if status != PASS:
+ logger.error("RASD with id %s not returned", exp_rasd.InstanceID)
+ return FAIL
+
+ return PASS
+
@do_main(sup_types)
def main():
options = main.options
virt = options.virt
- status = PASS
-
- destroy_and_undefine_all(options.ip)
- if virt == 'Xen':
- test_disk = 'xvda'
- else:
- test_disk = 'hda'
+ server = options.ip
+ status = FAIL
virt_xml = vxml.get_class(virt)
if virt == 'LXC':
cxml = virt_xml(test_dom)
else:
cxml = virt_xml(test_dom, mem=test_mem, vcpus = test_vcpus,
- mac = test_mac, disk = test_disk)
- ret = cxml.create(options.ip)
+ mac = test_mac)
+
+ ret = cxml.create(server)
if not ret:
logger.error('Unable to create domain %s' % test_dom)
return FAIL
- if status == 1:
- destroy_and_undefine_all(options.ip)
- return FAIL
+
if virt == "XenFV":
instIdval = "Xen:%s" % test_dom
else:
@@ -143,20 +147,15 @@
vssdc_cn = get_typed_class(virt, 'VirtualSystemSettingDataComponent')
vssd_cn = get_typed_class(virt, 'VirtualSystemSettingData')
try:
- assoc_info = assoc.Associators(options.ip, vssdc_cn, vssd_cn,
+ assoc_info = assoc.Associators(server, vssdc_cn, vssd_cn,
InstanceID = instIdval)
- status = assoc_values(assoc_info, cxml, test_disk, virt)
+ status = verify_rasd(virt, server, assoc_info)
except Exception, details:
- logger.error(Globals.CIM_ERROR_ASSOCIATORS,
- get_typed_class(virt, vssdc_cn))
+ logger.error(CIM_ERROR_ASSOCIATORS, vssdc_cn)
logger.error("Exception : %s" % details)
status = FAIL
-
- try:
- cxml.destroy(options.ip)
- cxml.undefine(options.ip)
- except Exception:
- logger.error("Destroy or undefine domain failed")
+
+ cxml.destroy(server)
return status
if __name__ == "__main__":
16 years