[PATCH] Fix units adherence in MemoryRASD processing in DefineSystem()
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1216828041 25200
# Node ID f542e90d4c672efa40a907b8c7040d6df714bd38
# Parent 8d236493f5d67a952bfab94a3fc19a34b3fdf394
Fix units adherence in MemoryRASD processing in DefineSystem()
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 8d236493f5d6 -r f542e90d4c67 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Jul 23 08:15:14 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 23 08:47:21 2008 -0700
@@ -469,12 +469,37 @@
static const char *mem_rasd_to_vdev(CMPIInstance *inst,
struct virt_device *dev)
{
+ const char *units;
+ int shift;
+
cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.mem.size);
cu_get_u64_prop(inst, "Reservation", &dev->dev.mem.size);
dev->dev.mem.maxsize = dev->dev.mem.size;
cu_get_u64_prop(inst, "Limit", &dev->dev.mem.maxsize);
- dev->dev.mem.size <<= 10;
- dev->dev.mem.maxsize <<= 10;
+
+ if (cu_get_str_prop(inst, "AllocationUnits", &units) != CMPI_RC_OK) {
+ CU_DEBUG("Memory RASD has no units, assuming bytes");
+ units = "Bytes";
+ }
+
+ if (STREQC(units, "Bytes"))
+ shift = -10;
+ else if (STREQC(units, "KiloBytes"))
+ shift = 0;
+ else if (STREQC(units, "MegaBytes"))
+ shift = 10;
+ else if (STREQC(units, "GigaBytes"))
+ shift = 20;
+ else
+ return "Unknown AllocationUnits in Memory RASD";
+
+ if (shift < 0) {
+ dev->dev.mem.size >>= -shift;
+ dev->dev.mem.maxsize >>= -shift;
+ } else {
+ dev->dev.mem.size <<= shift;
+ dev->dev.mem.maxsize <<= shift;
+ }
return NULL;
}
16 years, 5 months
[PATCH] Invert the bit of type-selection logic in resource_del() to match the other
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1216844705 25200
# Node ID 9c40868b04724e898011ecd6717162bc02c61781
# Parent 039b7c1f078d007f02224652235edea0a7113926
Invert the bit of type-selection logic in resource_del() to match the other
functions.
AFAICT, this still did succeeded and failed in the right places, but
deeper down and with less appropriate error messages.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 039b7c1f078d -r 9c40868b0472 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Jul 23 13:23:03 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 23 13:25:05 2008 -0700
@@ -1258,14 +1258,14 @@
_list = find_list(dominfo, type, &count);
if ((type == CIM_RES_TYPE_MEM) || (type == CIM_RES_TYPE_PROC) ||
- (_list != NULL))
- list = *_list;
- else {
+ (*_list == NULL)) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Cannot delete resources of type %" PRIu16, type);
goto out;
}
+
+ list = *_list;
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
16 years, 5 months
[PATCH] Fix (again) domain_online()
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1216844583 25200
# Node ID 039b7c1f078d007f02224652235edea0a7113926
# Parent 3327f39024303cb8a218110d039e37bf9c2b12cd
Fix (again) domain_online()
In the neverending quest to get domain_online() to do the Right Thing(tm),
this patch attempts to count VIR_DOMAIN_NOSTATE as running for Xen,
and as offline for KVM and LXC.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 3327f3902430 -r 039b7c1f078d libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Wed Jul 23 12:22:04 2008 -0700
+++ b/libxkutil/misc_util.c Wed Jul 23 13:23:03 2008 -0700
@@ -383,21 +383,53 @@
{
virDomainInfo info;
virDomainPtr _dom;
- bool rc;
+ bool rc = false;
+ virConnectPtr conn = NULL;
+ int flags[] = {VIR_DOMAIN_BLOCKED,
+ VIR_DOMAIN_RUNNING,
+ VIR_DOMAIN_NOSTATE,
+ };
+ int compare_flags = 3;
+ int i;
+
+ conn = virDomainGetConnect(dom);
+ if (conn == NULL) {
+ CU_DEBUG("Unknown connection type, assuming RUNNING,BLOCKED");
+ compare_flags = 2;
+ } else if (STREQC(virConnectGetType(conn), "Xen")) {
+ CU_DEBUG("Type is Xen");
+ compare_flags = 3;
+ } else if (STREQC(virConnectGetType(conn), "QEMU")) {
+ CU_DEBUG("Type is KVM");
+ compare_flags = 2;
+ } else if (STREQC(virConnectGetType(conn), "LXC")) {
+ CU_DEBUG("Type is LXC");
+ compare_flags = 2;
+ } else {
+ CU_DEBUG("Unknown type `%s', assuming RUNNING,BLOCKED",
+ virConnectGetType(conn));
+ compare_flags = 2;
+ }
_dom = virDomainLookupByName(virDomainGetConnect(dom),
virDomainGetName(dom));
if (_dom == NULL) {
CU_DEBUG("Unable to re-lookup domain");
- return false;
+ goto out;
}
- if (virDomainGetInfo(_dom, &info) != 0)
+ if (virDomainGetInfo(_dom, &info) != 0) {
rc = false;
- else
- rc = (info.state == VIR_DOMAIN_BLOCKED) ||
- (info.state == VIR_DOMAIN_RUNNING) ||
- (info.state == VIR_DOMAIN_NOSTATE);
+ goto out;
+ }
+
+ for (i = 0; i < compare_flags; i++) {
+ if (info.state == flags[i]) {
+ rc = true;
+ break;
+ }
+ }
+ out:
virDomainFree(_dom);
return rc;
16 years, 5 months
[PATCH] (#2) Fix a few bugs in the reset() call in CS
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1216845120 25200
# Node ID 9669e9cfbf6f7645c503a8f337cafe6a70028093
# Parent 427e74d2c45881820ee33b8b6cdeb9cff57a68c0
(#2) Fix a few bugs in the reset() call in CS.
This fixes the following issues:
-After the destroy call, the domain pointer is no longer valid. We need to get a new one to use for the Create call.
-In the situation where the guest was created without being defined, we need to get the XML and then define the before calling the create call.
Updates:
-Remove unused virDomainInfo variable.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 427e74d2c458 -r 9669e9cfbf6f src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Mon Jul 21 13:28:13 2008 -0700
+++ b/src/Virt_ComputerSystem.c Wed Jul 23 13:32:00 2008 -0700
@@ -673,12 +673,44 @@
static int domain_reset(virDomainPtr dom)
{
int ret;
+ virConnectPtr conn = NULL;
+ char *xml = NULL;
+
+ conn = virDomainGetConnect(dom);
+ if (conn == NULL) {
+ CU_DEBUG("Unable to get connection from domain");
+ return 1;
+ }
+
+ xml = virDomainGetXMLDesc(dom, 0);
+ if (xml == NULL) {
+ CU_DEBUG("Unable to retrieve domain XML");
+ return 1;
+ }
ret = virDomainDestroy(dom);
if (ret)
- return ret;
+ goto out;
+
+ dom = virDomainLookupByName(virDomainGetConnect(dom),
+ virDomainGetName(dom));
+
+ if (dom == NULL) {
+ dom = virDomainDefineXML(conn, xml);
+ if (dom == NULL) {
+ CU_DEBUG("Failed to define domain from XML");
+ ret = 1;
+ goto out;
+ }
+ }
+
+ if (!domain_online(dom))
+ CU_DEBUG("Guest is now offline");
ret = virDomainCreate(dom);
+
+ out:
+ free(xml);
return ret;
}
16 years, 5 months
Cimtest Report for LXC on F9 (2008/07/07)
by Guo Lian Yun
stro: Fedora 9 Beta
kernel-2.6.25-0.218.rc8.git7.fc9.x86_64
CIMOM: tog-pegasus-2.7.0-6.fc9.x86_64
cimtest: changeset-240
==================================================================
PASS : 90
FAIL : 1
XFAIL : 1
SKIP : 38
-----------------
Total : 130
========================= FAILED
==========================================
ComputerSystem - 04_defineStartVS.py: FAIL
ERROR - Error: property values are not set for VS domguest
======================CIMTEST FULL
REPORT==================================
AllocationCapabilities - 01_enum.py: PASS
AllocationCapabilities - 02_alloccap_gi_errs.py: PASS
ComputerSystem - 01_enum.py: PASS
ComputerSystem - 02_nosystems.py: PASS
ComputerSystem - 03_defineVS.py: PASS
ComputerSystem - 04_defineStartVS.py: FAIL
ComputerSystem - 05_activate_defined_start.py: XFAIL Bug: 00002
ComputerSystem - 06_paused_active_suspend.py: SKIP
ComputerSystem - 22_define_suspend.py: PASS
ComputerSystem - 23_suspend_suspend.py: SKIP
ComputerSystem - 27_define_suspend_errs.py: PASS
ComputerSystem - 32_start_reboot.py: SKIP
ComputerSystem - 33_suspend_reboot.py: SKIP
ComputerSystem - 35_start_reset.py: SKIP
ComputerSystem - 40_RSC_start.py: SKIP
ComputerSystem - 41_cs_to_settingdefinestate.py: SKIP
ComputerSystem - 42_cs_gi_errs.py: PASS
ComputerSystemIndication - 01_created_indication.py: SKIP
ElementAllocatedFromPool - 01_forward.py: SKIP
ElementAllocatedFromPool - 02_reverse.py: SKIP
ElementAllocatedFromPool - 03_reverse_errs.py: SKIP
ElementAllocatedFromPool - 04_forward_errs.py: SKIP
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: SKIP
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: SKIP
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: SKIP
LogicalDisk - 02_nodevs.py: SKIP
LogicalDisk - 03_ld_gi_errs.py: SKIP
Memory - 01_memory.py: PASS
Memory - 02_defgetmem.py: PASS
Memory - 03_mem_gi_errs.py: PASS
NetworkPort - 01_netport.py: SKIP
NetworkPort - 02_np_gi_errors.py: SKIP
NetworkPort - 03_user_netport.py: SKIP
Processor - 01_processor.py: SKIP
Processor - 02_definesys_get_procs.py: SKIP
Processor - 03_proc_gi_errs.py: SKIP
Profile - 01_enum.py: PASS
Profile - 02_profile_to_elec.py: SKIP
Profile - 03_rprofile_gi_errs.py: PASS
RASD - 01_verify_rasd_fields.py: PASS
RASD - 02_enum.py: PASS
RASD - 03_rasd_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: SKIP
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: SKIP
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: SKIP
ResourcePoolConfigurationService - 05_AddResourcesToResourcePool.py: SKIP
ResourcePoolConfigurationService - 06_RemoveResourcesFromResourcePool.py:
SKIP
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: SKIP
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: SKIP
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: SKIP
VirtualSystemManagementService - 07_addresource_neg.py: PASS
VirtualSystemManagementService - 08_modifyresource.py: SKIP
VirtualSystemManagementService - 09_procrasd_persist.py: SKIP
VirtualSystemMigrationCapabilities - 01_enum.py: PASS
VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: PASS
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
VirtualSystemMigrationSettingData - 01_enum.py: PASS
VirtualSystemMigrationSettingData - 02_vsmsd_gi_errs.py: PASS
VirtualSystemSettingDataComponent - 01_forward.py: SKIP
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
Best,
Regards
Daisy (运国莲)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol(a)cn.ibm.com
TEL: (86)-21-60922144
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203
16 years, 5 months
[PATCH] Add hypervisor version information to the Caption field of the VSMS
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1216826114 25200
# Node ID 8d236493f5d67a952bfab94a3fc19a34b3fdf394
# Parent caa024a3a0938bcb709df190a02fcce0d738c165
Add hypervisor version information to the Caption field of the VSMS.
I don't really see anywhere else this fits into the model, so setting
the caption as such seems reasonable to me.
Comments and arguments are welcome :)
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r caa024a3a093 -r 8d236493f5d6 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Jul 23 07:53:08 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 23 08:15:14 2008 -0700
@@ -1706,6 +1706,9 @@
const char *name = NULL;
const char *ccname = NULL;
virConnectPtr conn = NULL;
+ unsigned long hv_version = 0;
+ const char * hv_type = NULL;
+ char *caption = NULL;
*_inst = NULL;
conn = connect_by_classname(broker, CLASSNAME(reference), &s);
@@ -1742,6 +1745,30 @@
goto out;
}
+ hv_type = virConnectGetType(conn);
+ if (hv_type == NULL)
+ hv_type = "Unkown";
+
+ if (virConnectGetVersion(conn, &hv_version) < 0) {
+ CU_DEBUG("Unable to get hypervisor version");
+ hv_version = 0;
+ }
+
+ if (asprintf(&caption,
+ "%s %lu.%lu.%lu",
+ hv_type,
+ hv_version / 1000000,
+ (hv_version % 1000000) / 1000,
+ (hv_version % 1000000) % 1000) == -1)
+ caption = NULL;
+
+ if (caption != NULL)
+ CMSetProperty(inst, "Caption",
+ (CMPIValue *)caption, CMPI_chars);
+ else
+ CMSetProperty(inst, "Caption",
+ (CMPIValue *)"Unknown Hypervisor", CMPI_chars);
+
CMSetProperty(inst, "Name",
(CMPIValue *)"Management Service", CMPI_chars);
@@ -1767,6 +1794,7 @@
CMPI_RC_OK,
"");
out:
+ free(caption);
virConnectClose(conn);
*_inst = inst;
16 years, 5 months
[PATCH] [TEST] #4 Update VSSDC.01 for KVM/XenFV/LXC support
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216792796 25200
# Node ID f311f3dfa6451c7e5efeda76582e36cd119a46d4
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] #4 Update VSSDC.01 for KVM/XenFV/LXC support
The test defines non-bootloader guests for all platform types, also remove the
part of thet test that verifies the bootloader
Updates from 1 to 2:
Pass test_disk and test_mac as parameters into init_list() function.
Updates from 2 to 3:
Remove build_vssd_info() and call compare_all_prop() in assoc_values()
Updates from 3 to 4:
1) Remove otiose rlist define line for LXC option
2) change assoc_values comments, it verifies all of the values of instance
3) check compare_all_prop return, if it return fail, print a log message
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 3703b7be5a10 -r f311f3dfa645 suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py Wed Jul 16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py Tue Jul 22 22:59:56 2008 -0700
@@ -52,32 +52,31 @@
import sys
from XenKvmLib import enumclass
from VirtLib import utils
-from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
-from XenKvmLib.test_xml import testxml_bl
-from XenKvmLib.test_xml import xml_get_dom_bootloader
+from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib.assoc import compare_all_prop
from CimTest import Globals
from XenKvmLib import assoc
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, do_main
from CimTest.ReturnCodes import FAIL, PASS
-sup_types = ['Xen']
+sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "VSSDC_dom"
test_vcpus = 2
test_mac = "00:11:22:33:44:aa"
test_disk = 'xvda'
-status = 0
-VSType = "Xen"
-def init_list():
+def init_list(test_disk, test_mac, virt='Xen'):
"""
Creating the lists that will be used for comparisons.
"""
- rlist = ['Xen_DiskResourceAllocationSettingData',
- 'Xen_MemResourceAllocationSettingData',
- 'Xen_NetResourceAllocationSettingData',
- 'Xen_ProcResourceAllocationSettingData'
+ rlist = [get_typed_class(virt, 'DiskResourceAllocationSettingData'),
+ get_typed_class(virt, 'MemResourceAllocationSettingData'),
+ get_typed_class(virt, 'NetResourceAllocationSettingData'),
+ get_typed_class(virt, 'ProcResourceAllocationSettingData')
]
prop_list = {rlist[0] : "%s/%s" % (test_dom, test_disk),
@@ -85,57 +84,33 @@
rlist[2] : "%s/%s" % (test_dom, test_mac),
rlist[3] : "%s/%s" % (test_dom, "proc")
}
+ if virt == 'LXC':
+ prop_list = {rlist[1] : "%s/%s" % (test_dom, "mem")}
return prop_list
-def build_vssd_info(ip, vssd):
- """
- Creating the vssd fileds lists that will be used for comparisons.
- """
-
- if vssd.Bootloader == "" or vssd.Caption == "" or \
- vssd.InstanceID == "" or vssd.ElementName == "" or \
- vssd.VirtualSystemIdentifier == "" or vssd.VirtualSystemType == "":
- logger.error("One of the required VSSD details seems to be empty")
- test_domain_function(test_dom, ip, "undefine")
- return FAIL
-
- vssd_vals = {'Bootloader' : vssd.Bootloader,
- 'Caption' : vssd.Caption,
- 'InstanceID' : vssd.InstanceID,
- 'ElementName' : vssd.ElementName,
- 'VirtualSystemIdentifier' : vssd.VirtualSystemIdentifier,
- 'VirtualSystemType' : vssd.VirtualSystemType
- }
-
- return vssd_vals
-
-def assoc_values(ip, assoc_info, cn, an, vals):
+def assoc_values(ip, assoc_info, cn, an, vssd):
"""
The association info of
Xen_VirtualSystemSettingDataComponent with every RASDclass is
- verified for following fields:
- Caption, InstanceID, ElementName, VirtualSystemIdentifier,
- VirtualSystemType, Bootloader
+ verified all of the values
"""
try:
if len(assoc_info) != 1:
- Globals.logger.error("%s returned %i resource objects for '%s'" % \
- (an, len(assoc_info), cn))
+ logger.error("%s returned %i resource objects for '%s'" % \
+ (an, len(assoc_info), cn))
return FAIL
-
- for prop, val in vals.iteritems():
- if assoc_info[0][prop] != val:
- Globals.logger.error("%s mismatch: returned %s instead of %s" %\
- (prop, assoc_info[0][prop], val))
- return FAIL
-
- return PASS
-
+ status = compare_all_prop(assoc_info[0], vssd)
+ if status != PASS:
+ logger.error("Verification error: got %s, expect %s" % \
+ (assoc_info[0], vssd))
+ return FAIL
except Exception, detail :
logger.error("Exception in assoc_values function: %s" % detail)
- return FAIL
+ return FAIL
+
+ return PASS
@do_main(sup_types)
def main():
@@ -143,49 +118,53 @@
status = FAIL
destroy_and_undefine_all(options.ip)
- test_xml = testxml_bl(test_dom, vcpus = test_vcpus, \
- mac = test_mac, disk = test_disk, \
- server = options.ip,\
- gtype = 0)
- ret = test_domain_function(test_xml, options.ip, cmd = "define")
+ prop_list = init_list(test_disk, test_mac, options.virt)
+ virt_xml = vxml.get_class(options.virt)
+ if options.virt == 'LXC':
+ cxml = virt_xml(test_dom)
+ else:
+ cxml = virt_xml(test_dom, vcpus = test_vcpus, \
+ mac = test_mac, disk = test_disk)
+ ret = cxml.define(options.ip)
if not ret:
logger.error("Failed to define the dom: %s", test_dom)
return FAIL
- instIdval = "%s:%s" % (VSType, test_dom)
+ if options.virt == 'XenFV':
+ instIdval = "Xen:%s" % test_dom
+ else:
+ instIdval = "%s:%s" % (options.virt, test_dom)
+
keyname = "InstanceID"
+ key_list = { 'InstanceID' : instIdval }
+ vssd_cn = get_typed_class(options.virt, 'VirtualSystemSettingData')
- key_list = { 'InstanceID' : instIdval }
try:
vssd = enumclass.getInstance(options.ip, \
- enumclass.Xen_VirtualSystemSettingData, \
- key_list)
+ 'VirtualSystemSettingData', \
+ key_list, \
+ options.virt)
if vssd is None:
logger.error("VSSD instance for %s not found" % test_dom)
- test_domain_function(test_dom, options.ip, "undefine")
+ cxml.undefine(options.ip)
return FAIL
-
- vssd_vals = build_vssd_info(options.ip, vssd)
-
except Exception, detail :
- logger.error(Globals.CIM_ERROR_GETINSTANCE, \
- 'Xen_VirtualSystemSettingData')
+ logger.error(Globals.CIM_ERROR_GETINSTANCE, vssd_cn)
logger.error("Exception : %s" % detail)
- test_domain_function(test_dom, options.ip, "undefine")
+ cxml.undefine(options.ip)
return FAIL
- prop_list = init_list()
try:
# Looping through the RASD_cllist, call association
# Xen_VirtualSystemSettingDataComponent with each class in RASD_cllist
- an = 'Xen_VirtualSystemSettingDataComponent'
+ an = get_typed_class(options.virt, 'VirtualSystemSettingDataComponent')
for rasd_cname, prop in prop_list.iteritems():
assoc_info = assoc.Associators(options.ip, an, rasd_cname,
- InstanceID = prop)
+ options.virt, InstanceID = prop)
# Verify the association fields returned for particular rasd_cname.
status = assoc_values(options.ip, assoc_info, rasd_cname, an,
- vssd_vals)
+ vssd)
if status != PASS:
break
@@ -194,7 +173,7 @@
logger.error("Exception : %s" % detail)
status = FAIL
- test_domain_function(test_dom, options.ip, "undefine")
+ cxml.undefine(options.ip)
return status
if __name__ == "__main__":
16 years, 5 months
[PATCH] (#2) For pause, reboot, and enable add support for guests in the NOSTATE state
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1216757900 25200
# Node ID cc69139baaddfd14451940fc7bab9239be0edfcb
# Parent 695e6e7fb85f14e7e7685b94832b0fc73027e405
(#2) For pause, reboot, and enable add support for guests in the NOSTATE state.
It's possible that a XenFV guest might return no state instead of blocked or running. This can occur when the guest is active, but isn't running of the CPU or blocked waiting for it.
This should be a safe approach - we return an error if the guest is in some other state or if libvirt is unable to successfully change the state of the guest.
Updates:
-For the reboot and reset operations, add support for paused guests (per the VSP).
-If the guest returns VIR_DOMAIN_NOSTATE, the provider should return the value CIM_STATE_ENABLED, not CIM_STATE_UNKNOWN.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 695e6e7fb85f -r cc69139baadd src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Wed Jul 23 13:10:16 2008 -0700
+++ b/src/Virt_ComputerSystem.c Tue Jul 22 13:18:20 2008 -0700
@@ -139,7 +139,7 @@
static uint16_t state_lv_to_cim(const char lv_state)
{
if (lv_state == VIR_DOMAIN_NOSTATE)
- return CIM_STATE_UNKNOWN;
+ return CIM_STATE_ENABLED;
else if (lv_state == VIR_DOMAIN_RUNNING)
return CIM_STATE_ENABLED;
else if (lv_state == VIR_DOMAIN_BLOCKED)
@@ -780,6 +780,7 @@
switch (info->state) {
case VIR_DOMAIN_RUNNING:
case VIR_DOMAIN_BLOCKED:
+ case VIR_DOMAIN_NOSTATE:
CU_DEBUG("Pause domain");
ret = virDomainSuspend(dom);
break;
@@ -805,6 +806,8 @@
switch (info->state) {
case VIR_DOMAIN_RUNNING:
case VIR_DOMAIN_BLOCKED:
+ case VIR_DOMAIN_NOSTATE:
+ case VIR_DOMAIN_PAUSED:
CU_DEBUG("Reboot domain");
ret = virDomainReboot(dom, 0);
break;
@@ -830,6 +833,8 @@
switch (info->state) {
case VIR_DOMAIN_RUNNING:
case VIR_DOMAIN_BLOCKED:
+ case VIR_DOMAIN_NOSTATE:
+ case VIR_DOMAIN_PAUSED:
CU_DEBUG("Reset domain");
ret = domain_reset(dom);
break;
16 years, 5 months
[PATCH] [TEST] Updating 04_hs_to_EAPF.py to use the verify_device_values() included in the logicaldevices.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1216734523 25200
# Node ID db255fa25e46430920e4e39af495f90ce05ec399
# Parent 6d1ac5c3497b95a230217f8c5f8b226c07fb1b31
[TEST] Updating 04_hs_to_EAPF.py to use the verify_device_values() included in the logicaldevices.py.
1) Elminated the need to call various verify_<>_values() calls, instead using verify_device_values() fn.
NOTE: The tc should be modified to support XenFV, KVM, LXC further.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 6d1ac5c3497b -r db255fa25e46 suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py
--- a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py Tue Jul 22 06:42:27 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py Tue Jul 22 06:48:43 2008 -0700
@@ -58,8 +58,7 @@ from XenKvmLib.test_xml import testxml_b
from XenKvmLib.test_xml import testxml_bridge
from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
from VirtLib.live import network_by_bridge
-from XenKvmLib.logicaldevices import verify_proc_values, verify_mem_values, \
-verify_net_values, verify_disk_values
+from XenKvmLib.logicaldevices import verify_device_values
from XenKvmLib.common_util import cleanup_restore, test_dpath, \
create_diskpool_file
@@ -185,12 +184,12 @@ def check_len(an, assoc_list_info, qcn,
return PASS
def verify_eafp_values(server, in_pllist):
-# Looping through the in_pllist to get association for various pools.
+ # Looping through the in_pllist to get association for various pools.
status = PASS
an = "Xen_ElementAllocatedFromPool"
exp_len = 1
qcn = "Logical Devices"
- eapf_values = eapf_list()
+ eafp_values = eapf_list()
for cn, instid in sorted(in_pllist.items()):
try:
assoc_info = Associators(server, an, cn, InstanceID = instid)
@@ -200,18 +199,12 @@ def verify_eafp_values(server, in_pllist
break
assoc_eafp_info = inst_list[0]
CCName = assoc_eafp_info['CreationClassName']
- if CCName == 'Xen_Processor':
- status = verify_proc_values(assoc_eafp_info, eapf_values)
- elif CCName == 'Xen_NetworkPort':
- status = verify_net_values(assoc_eafp_info, eapf_values)
- elif CCName == 'Xen_LogicalDisk':
- status = verify_disk_values(assoc_eafp_info, eapf_values)
- elif CCName == 'Xen_Memory':
- status = verify_mem_values(assoc_eafp_info, eapf_values)
- else:
- status = FAIL
+ status = verify_device_values(assoc_eafp_info, CCName,
+ eafp_values, virt='Xen')
+
if status != PASS:
- break
+ return status
+
except Exception, detail:
logger.error(CIM_ERROR_ASSOCIATORS, an)
logger.error("Exception: %s", detail)
16 years, 5 months
[PATCH] Fix a few bugs in the reset() call in CS
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1216843816 25200
# Node ID 695e6e7fb85f14e7e7685b94832b0fc73027e405
# Parent 427e74d2c45881820ee33b8b6cdeb9cff57a68c0
Fix a few bugs in the reset() call in CS.
This fixes the following issues:
-After the destroy call, the domain pointer is no longer valid. We need to get a new one to use for the Create call.
-In the situation where the guest was created without being defined, we need to get the XML and then define the before calling the create call.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 427e74d2c458 -r 695e6e7fb85f src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Mon Jul 21 13:28:13 2008 -0700
+++ b/src/Virt_ComputerSystem.c Wed Jul 23 13:10:16 2008 -0700
@@ -673,12 +673,45 @@
static int domain_reset(virDomainPtr dom)
{
int ret;
+ virConnectPtr conn = NULL;
+ virDomainInfo info;
+ char *xml = NULL;
+
+ conn = virDomainGetConnect(dom);
+ if (conn == NULL) {
+ CU_DEBUG("Unable to get connection from domain");
+ return 1;
+ }
+
+ xml = virDomainGetXMLDesc(dom, 0);
+ if (xml == NULL) {
+ CU_DEBUG("Unable to retrieve domain XML");
+ return 1;
+ }
ret = virDomainDestroy(dom);
if (ret)
- return ret;
+ goto out;
+
+ dom = virDomainLookupByName(virDomainGetConnect(dom),
+ virDomainGetName(dom));
+
+ if (dom == NULL) {
+ dom = virDomainDefineXML(conn, xml);
+ if (dom == NULL) {
+ CU_DEBUG("Failed to define domain from XML");
+ ret = 1;
+ goto out;
+ }
+ }
+
+ if (!domain_online(dom))
+ CU_DEBUG("Guest is now offline");
ret = virDomainCreate(dom);
+
+ out:
+ free(xml);
return ret;
}
16 years, 5 months