[PATCH] Have DefineSystem() return error if VirtualQuantity of proc/mem RASD isn't set
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1223052487 25200
# Node ID cc78b9491823c2cb3db064039c48cb980ab28ee7
# Parent 2952b0fb0fef8e77b34c04a779ac44b1d092876f
Have DefineSystem() return error if VirtualQuantity of proc/mem RASD isn't set
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 2952b0fb0fef -r cc78b9491823 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri Oct 03 09:46:29 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Fri Oct 03 09:48:07 2008 -0700
@@ -450,10 +450,16 @@
struct virt_device *dev)
{
const char *units;
+ CMPIrc ret;
int shift;
- cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.mem.size);
- cu_get_u64_prop(inst, "Reservation", &dev->dev.mem.size);
+ ret = cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.mem.size);
+ if (ret != CMPI_RC_OK)
+ ret = cu_get_u64_prop(inst, "Reservation", &dev->dev.mem.size);
+
+ if (ret != CMPI_RC_OK)
+ return "Missing `VirtualQuantity' field in Memory RASD";
+
dev->dev.mem.maxsize = dev->dev.mem.size;
cu_get_u64_prop(inst, "Limit", &dev->dev.mem.maxsize);
@@ -492,7 +498,9 @@
uint32_t def_weight = 0;
uint64_t def_limit = 0;
- cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.vcpu.quantity);
+ rc = cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.vcpu.quantity);
+ if (rc != CMPI_RC_OK)
+ return "Missing `VirtualQuantity' field in Processor RASD";
op = CMGetObjectPath(inst, NULL);
if (op == NULL) {
16 years, 2 months
make error
by Deepti B Kalakeri
Hi,
With the latest libvirt-cim provider sources(revision:704) I see the
following error during make.
cd .libs && rm -f libVirt_ServiceAffectsElement.la && ln -s
../libVirt_ServiceAffectsElement.la libVirt_ServiceAffectsElement.la)
make[3]: Leaving directory `/home/VSM/SRC/libvirt-cim/src'
make[2]: Leaving directory `/home/VSM/SRC/libvirt-cim/src'
Making all in doc
make[2]: Entering directory `/home/VSM/SRC/libvirt-cim/doc'
Generating the Web pages
make[2]: Leaving directory `/home/VSM/SRC/libvirt-cim/doc'
Making all in base_schema
make[2]: Entering directory `/home/VSM/SRC/libvirt-cim/base_schema'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/VSM/SRC/libvirt-cim/base_schema'
make[2]: Entering directory `/home/VSM/SRC/libvirt-cim'
make[2]: *** No rule to make target ` ', needed by `all-am'. Stop.
make[2]: Leaving directory `/home/VSM/SRC/libvirt-cim'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/VSM/SRC/libvirt-cim'
make: *** [all] Error 2
This error is seen on F10 , RHEL5.2 and F9.
For now I deleted the Makefile entry for ServiceAffectsElement.mof and
the make works fine for me.
Thanks and Regards,
Deepti.
16 years, 2 months
[PATCH] Add ServiceAffectsElement schema
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1222976893 25200
# Node ID 0a1c174ed64d24a9e30872a86e2c206e5789d821
# Parent a2759cb96488a8079a24d8c47223ca5c7c7f3524
Add ServiceAffectsElement schema
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r a2759cb96488 -r 0a1c174ed64d schema/ServiceAffectsElement.mof
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/ServiceAffectsElement.mof Thu Oct 02 12:48:13 2008 -0700
@@ -0,0 +1,22 @@
+// Copyright IBM Corp. 2008
+
+[Association,
+ Provider("cmpi::Virt_ServiceAffectsElement")
+]
+class Xen_ServiceAffectsElement : CIM_ServiceAffectsElement
+{
+};
+
+[Association,
+ Provider("cmpi::Virt_ServiceAffectsElement")
+]
+class KVM_ServiceAffectsElement : CIM_ServiceAffectsElement
+{
+};
+
+[Association,
+ Provider("cmpi::Virt_ServiceAffectsElement")
+]
+class LXC_ServiceAffectsElement : CIM_ServiceAffectsElement
+{
+};
diff -r a2759cb96488 -r 0a1c174ed64d schema/ServiceAffectsElement.registration
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/ServiceAffectsElement.registration Thu Oct 02 12:48:13 2008 -0700
@@ -0,0 +1,5 @@
+# Copyright IBM Corp. 2007
+# Classname Namespace ProviderName ProviderModule ProviderTypes
+Xen_ServiceAffectsElement root/virt Virt_ServiceAffectsElement Virt_ServiceAffectsElement association
+KVM_ServiceAffectsElement root/virt Virt_ServiceAffectsElement Virt_ServiceAffectsElement association
+LXC_ServiceAffectsElement root/virt Virt_ServiceAffectsElement Virt_ServiceAffectsElement association
16 years, 2 months
[PATCH] [TEST] Updating some more tc for for Association parameter changes
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1223040869 25200
# Node ID a2cbe9ff6889c49c9a4478a592d3a10b55e64c1a
# Parent e437224852a71d5123f66c998a15d7893e1528dc
[TEST] Updating some more tc for for Association parameter changes
1) updated CS 41_cs_to_settingdefinestate.py tc.
2) updated HostedResourcePool/01_forward.py
3) updated HostedResourcePool/02_reverse.py
4) SettingsDefineCapabilities/01_forward.py
5) SettingsDefineCapabilities/04_forward_vsmsdata.py
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r e437224852a7 -r a2cbe9ff6889 suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Fri Oct 03 05:35:35 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Fri Oct 03 06:34:29 2008 -0700
@@ -150,8 +150,7 @@ def get_associatornames_info(server, vir
an,
cn,
CreationClassName=cn,
- Name = name,
- virt=virt)
+ Name = name)
if len(assoc_info) < 1:
logger.error("%s returned %i %s objects" % (an, len(assoc_info), qcn))
status = FAIL
@@ -171,8 +170,7 @@ def get_associators_info(server, virt, v
assoc_info = Associators(server,
an,
cn,
- InstanceID = instid,
- virt=virt)
+ InstanceID = instid)
if len(assoc_info) < 1:
logger.error("%s returned %i %s objects" %
(an, len(assoc_info), qcn))
@@ -239,8 +237,7 @@ def get_SDS_verify_RASD_build_vssdc_inpu
DeviceID = devid,
CreationClassName = cn,
SystemName = test_dom,
- SystemCreationClassName = sccn,
- virt=virt)
+ SystemCreationClassName = sccn)
# we expect only one RASD record to be returned for each device that is used to
# query with the SettingsDefineState association.
diff -r e437224852a7 -r a2cbe9ff6889 suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py Fri Oct 03 05:35:35 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py Fri Oct 03 06:34:29 2008 -0700
@@ -52,8 +52,7 @@ def main():
assoc_cn,
host_sys.CreationClassName,
Name = host_sys.Name,
- CreationClassName = host_sys.CreationClassName,
- virt = options.virt)
+ CreationClassName = host_sys.CreationClassName)
except Exception, details:
logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % assoc_cn)
logger.error("Exception:", details)
diff -r e437224852a7 -r a2cbe9ff6889 suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py Fri Oct 03 05:35:35 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py Fri Oct 03 06:34:29 2008 -0700
@@ -59,8 +59,7 @@ def main():
for k, v in poollist.items():
try:
- assoc_host = assoc.AssociatorNames(options.ip, assoc_cn, k, InstanceID = v, \
- virt = options.virt)
+ assoc_host = assoc.AssociatorNames(options.ip, assoc_cn, k, InstanceID = v)
except Exception:
logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % v)
return FAIL
diff -r e437224852a7 -r a2cbe9ff6889 suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Fri Oct 03 05:35:35 2008 -0700
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Fri Oct 03 06:34:29 2008 -0700
@@ -167,7 +167,7 @@ def verify_sdc_with_ac(virt, server, poo
for instid in sorted(instlist):
try:
assoc_info = assoc.Associators(server, assoc_cname, cn,
- InstanceID = instid, virt=virt)
+ InstanceID = instid)
if len(assoc_info) != 4:
logger.error("%s returned %i ResourcePool objects"
"instead 4", assoc_cname, len(assoc_info))
diff -r e437224852a7 -r a2cbe9ff6889 suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py Fri Oct 03 05:35:35 2008 -0700
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py Fri Oct 03 06:34:29 2008 -0700
@@ -55,8 +55,7 @@ def main():
qcn = get_typed_class(options.virt, 'VirtualSystemMigrationCapabilities')
instid = 'MigrationSettingData'
try:
- assoc_info = assoc.Associators(server, an, cn, InstanceID = instid,
- virt=options.virt)
+ assoc_info = assoc.Associators(server, an, cn, InstanceID = instid)
if len(assoc_info) != 1:
logger.error("%s returned %i %s objects", an, len(assoc_info), qcn)
return FAIL
diff -r e437224852a7 -r a2cbe9ff6889 suites/libvirt-cim/lib/XenKvmLib/assoc.py
--- a/suites/libvirt-cim/lib/XenKvmLib/assoc.py Fri Oct 03 05:35:35 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/assoc.py Fri Oct 03 06:34:29 2008 -0700
@@ -45,6 +45,7 @@ def AssociatorNames(host, assoc_cn, clas
names = []
try:
+ logger.error("DEBUG instanceref, is %s", instanceref)
names = conn.AssociatorNames(instanceref, AssocClass=assoc_cn)
except pywbem.CIMError, arg:
print arg[1]
@@ -67,6 +68,7 @@ def Associators(host, assoc_cn, classnam
names = []
try:
+ logger.error("DEBUG instanceref, is %s", instanceref)
names = conn.Associators(instanceref, AssocClass=assoc_cn)
except pywbem.CIMError, arg:
print arg[1]
16 years, 2 months
[PATCH 00 of 10] [TEST] Association parameter changes.
by Deepti B. Kalakeri
This patchset contains changes to around 27 test cases for Association parameter changes.
The changes have been tested with Xen, XenFV( with current sources on RHEL5.2) and with KVM (currents sources, F9).
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
16 years, 2 months
[PATCH] Add obligatory LXC console
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1222981899 25200
# Node ID 7244474e5d2e118316e1636b06f99acb54062489
# Parent ed51b685c0027aa4a80aab53b96451dbd8084c44
Add obligatory LXC console
This will become less naive when we get real modeling for this, but it
needs to be there for general usefulness in the time being. For now,
just assume a sane default.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r ed51b685c002 -r 7244474e5d2e libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Thu Oct 02 12:54:29 2008 -0700
+++ b/libxkutil/xmlgen.c Thu Oct 02 14:11:39 2008 -0700
@@ -617,6 +617,16 @@
return strdup("<!-- unsupported domain type -->\n");
}
+static int console_xml(struct domain *dominfo,
+ char **xml)
+{
+ if (dominfo->type == DOMAIN_LXC) {
+ astrcat(xml, "<console type='pty'/>\n");
+ }
+
+ return 0;
+}
+
char *system_to_xml(struct domain *dominfo)
{
char *devxml = strdup("");
@@ -668,6 +678,8 @@
1,
graphics_to_xml);
+ console_xml(dominfo, &devxml);
+
concat_devxml(&sysdevxml,
dominfo->dev_mem,
dominfo->dev_mem_ct,
16 years, 2 months
[PATCH] Remove sdc_rasd_prop structs from SDC
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1222970713 25200
# Node ID a2759cb96488a8079a24d8c47223ca5c7c7f3524
# Parent cbe9f59669b6b9342cf14db087139a302a1bff12
Remove sdc_rasd_prop structs from SDC
Instead, a pointer to CMPIInstance can be passed to the <>_template() functions, and the functional can be responsible for setting the properties directly. Also, the functions will now return a CMPIStatus value instead of a sdc_rasd_prop struct.
This is more useful than structs because some of the property values may differ between the virtualization types.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r cbe9f59669b6 -r a2759cb96488 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Mon Sep 15 14:44:37 2008 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c Thu Oct 02 11:05:13 2008 -0700
@@ -249,68 +249,13 @@
return s;
}
-static bool rasd_prop_copy_value(struct sdc_rasd_prop src,
- struct sdc_rasd_prop *dest)
+static CMPIStatus mem_template(const CMPIObjectPath *ref,
+ int template_type,
+ CMPIInstance *inst)
{
- bool rc = true;
-
- CU_DEBUG("Copying '%s'", src.field);
- if (src.type & CMPI_string) {
- dest->value = (CMPIValue *)strdup((char *)src.value);
- } else if (src.type & CMPI_INTEGER) {
- dest->value = malloc(sizeof(CMPIValue));
- memcpy(dest->value, src.value, sizeof(CMPIValue));
- } else {
- rc = false;
- }
-
- return rc;
-}
-
-static bool dup_rasd_prop_list(struct sdc_rasd_prop *src,
- struct sdc_rasd_prop **dest)
-{
- int count, i;
- bool ret;
- *dest = NULL;
-
- for (i = 0, count = 1; src[i].field != NULL; i++, count++) {
- *dest = realloc(*dest, count * sizeof(struct sdc_rasd_prop));
- (*dest)[i].field = strdup(src[i].field);
- ret = rasd_prop_copy_value(src[i], &(*dest)[i]);
- (*dest)[i].type = src[i].type;
- }
-
- /* Make sure to terminate the list. */
- *dest = realloc(*dest, count * sizeof(struct sdc_rasd_prop));
- (*dest)[i] = (struct sdc_rasd_prop)PROP_END;
-
- return true;
-}
-
-static void free_rasd_prop_list(struct sdc_rasd_prop *prop_list)
-{
- int i;
-
- if (!prop_list)
- return;
-
- for (i = 0; prop_list[i].field != NULL; i++) {
- free(prop_list[i].field);
- free(prop_list[i].value);
- }
-
- free (prop_list);
-}
-
-static struct sdc_rasd_prop *mem_template(const CMPIObjectPath *ref,
- int template_type,
- CMPIStatus *s)
-{
- bool ret;
uint64_t mem_size;
const char *id;
- struct sdc_rasd_prop *rasd = NULL;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
switch (template_type) {
case SDC_RASD_MIN:
@@ -330,28 +275,20 @@
id = "Default";
break;
default:
- cu_statusf(_BROKER, s,
+ cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Unsupported sdc_rasd type");
goto out;
}
- struct sdc_rasd_prop tmp[] = {
- {"InstanceID", (CMPIValue *)id, CMPI_chars},
- {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
- {"VirtualQuantity", (CMPIValue *)&mem_size, CMPI_uint64},
- PROP_END
- };
-
- ret = dup_rasd_prop_list(tmp, &rasd);
- if (!ret) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not copy RASD");
- }
+ CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
+ CMSetProperty(inst, "AllocationUnits",
+ (CMPIValue *)"KiloBytes", CMPI_chars);
+ CMSetProperty(inst, "VirtualQuantity",
+ (CMPIValue *)&mem_size, CMPI_uint64);
out:
- return rasd;
+ return s;
}
static bool get_max_procs(const CMPIObjectPath *ref,
@@ -377,14 +314,14 @@
return ret;
}
-static struct sdc_rasd_prop *proc_template(const CMPIObjectPath *ref,
- int template_type,
- CMPIStatus *s)
+static CMPIStatus proc_template(const CMPIObjectPath *ref,
+ int template_type,
+ CMPIInstance *inst)
{
bool ret;
uint64_t num_procs;
const char *id;
- struct sdc_rasd_prop *rasd = NULL;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
switch (template_type) {
case SDC_RASD_MIN:
@@ -392,7 +329,7 @@
id = "Minimum";
break;
case SDC_RASD_MAX:
- ret = get_max_procs(ref, &num_procs, s);
+ ret = get_max_procs(ref, &num_procs, &s);
if (!ret)
goto out;
id = "Maximum";
@@ -406,29 +343,20 @@
id = "Default";
break;
default:
- cu_statusf(_BROKER, s,
+ cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Unsupported sdc_rasd type");
goto out;
}
- struct sdc_rasd_prop tmp[] = {
- {"InstanceID", (CMPIValue *)id, CMPI_chars},
- {"AllocationUnits", (CMPIValue *)"Processors", CMPI_chars},
- {"VirtualQuantity", (CMPIValue *)&num_procs, CMPI_uint64},
- PROP_END
- };
-
- ret = dup_rasd_prop_list(tmp, &rasd);
- if (!ret) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not copy RASD");
- }
+ CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
+ CMSetProperty(inst, "AllocationUnits",
+ (CMPIValue *)"Processors", CMPI_chars);
+ CMSetProperty(inst, "VirtualQuantity",
+ (CMPIValue *)&num_procs, CMPI_uint64);
out:
-
- return rasd;
+ return s;
}
static uint64_t net_max_xen(const CMPIObjectPath *ref,
@@ -508,14 +436,14 @@
return ret;
}
-static struct sdc_rasd_prop *net_template(const CMPIObjectPath *ref,
- int template_type,
- CMPIStatus *s)
+static CMPIStatus net_template(const CMPIObjectPath *ref,
+ int template_type,
+ CMPIInstance *inst)
{
bool ret;
uint64_t num_nics;
const char *id;
- struct sdc_rasd_prop *rasd = NULL;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
switch (template_type) {
case SDC_RASD_MIN:
@@ -523,7 +451,7 @@
id = "Minimum";
break;
case SDC_RASD_MAX:
- ret = get_max_nics(ref, &num_nics, s);
+ ret = get_max_nics(ref, &num_nics, &s);
if (!ret)
goto out;
id = "Maximum";
@@ -537,27 +465,18 @@
id = "Default";
break;
default:
- cu_statusf(_BROKER, s,
+ cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Unsupported sdc_rasd type");
goto out;
}
- struct sdc_rasd_prop tmp[] = {
- {"InstanceID", (CMPIValue *)id, CMPI_chars},
- {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint64},
- PROP_END
- };
-
- ret = dup_rasd_prop_list(tmp, &rasd);
- if (!ret) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not copy RASD");
- }
+ CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
+ CMSetProperty(inst, "VirtualQuantity",
+ (CMPIValue *)&num_nics, CMPI_uint64);
out:
- return rasd;
+ return s;
}
static int get_disk_freespace(const CMPIObjectPath *ref,
@@ -606,14 +525,14 @@
return ret;
}
-static struct sdc_rasd_prop *disk_template(const CMPIObjectPath *ref,
- int template_type,
- CMPIStatus *s)
+static CMPIStatus disk_template(const CMPIObjectPath *ref,
+ int template_type,
+ CMPIInstance *inst)
{
bool ret;
uint64_t disk_size;
const char *id;
- struct sdc_rasd_prop *rasd = NULL;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
switch(template_type) {
case SDC_RASD_MIN:
@@ -621,7 +540,7 @@
id = "Minimum";
break;
case SDC_RASD_MAX:
- ret = get_disk_freespace(ref, s, &disk_size);
+ ret = get_disk_freespace(ref, &s, &disk_size);
if (!ret)
goto out;
id = "Maximum";
@@ -635,28 +554,20 @@
id = "Default";
break;
default:
- cu_statusf(_BROKER, s,
+ cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Unsupported sdc_rasd type");
goto out;
}
- struct sdc_rasd_prop tmp[] = {
- {"InstanceID", (CMPIValue *)id, CMPI_chars},
- {"AllocationQuantity", (CMPIValue *)"MegaBytes", CMPI_chars},
- {"VirtualQuantity", (CMPIValue *)&disk_size, CMPI_uint64},
- PROP_END
- };
-
- ret = dup_rasd_prop_list(tmp, &rasd);
- if (!ret) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not copy RASD");
- }
+ CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
+ CMSetProperty(inst, "AllocationQuantity",
+ (CMPIValue *)"MegaBytes", CMPI_chars);
+ CMSetProperty(inst, "VirtualQuantity",
+ (CMPIValue *)&disk_size, CMPI_uint64);
out:
- return rasd;
+ return s;
}
static CMPIInstance *sdc_rasd_inst(CMPIStatus *s,
@@ -665,26 +576,7 @@
uint16_t resource_type)
{
CMPIInstance *inst = NULL;
- struct sdc_rasd_prop *prop_list = NULL;
- int i;
const char *base = NULL;
-
- if (resource_type == CIM_RES_TYPE_MEM)
- prop_list = mem_template(ref, type, s);
- else if (resource_type == CIM_RES_TYPE_PROC)
- prop_list = proc_template(ref, type, s);
- else if (resource_type == CIM_RES_TYPE_NET)
- prop_list = net_template(ref, type, s);
- else if (resource_type == CIM_RES_TYPE_DISK)
- prop_list = disk_template(ref, type, s);
- else {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Unsupported resource type");
- }
-
- if (s->rc != CMPI_RC_OK)
- goto out;
if (rasd_classname_from_type(resource_type, &base) != CMPI_RC_OK) {
cu_statusf(_BROKER, s,
@@ -697,17 +589,27 @@
CLASSNAME(ref),
base,
NAMESPACE(ref));
-
+
+ if (resource_type == CIM_RES_TYPE_MEM)
+ *s = mem_template(ref, type, inst);
+ else if (resource_type == CIM_RES_TYPE_PROC)
+ *s = proc_template(ref, type, inst);
+ else if (resource_type == CIM_RES_TYPE_NET)
+ *s = net_template(ref, type, inst);
+ else if (resource_type == CIM_RES_TYPE_DISK)
+ *s = disk_template(ref, type, inst);
+ else {
+ cu_statusf(_BROKER, s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported resource type");
+ }
+
+ if (s->rc != CMPI_RC_OK)
+ goto out;
+
CMSetProperty(inst, "ResourceType", &resource_type, CMPI_uint16);
- for (i = 0; prop_list[i].field != NULL; i++) {
- CU_DEBUG("Setting property '%s'", prop_list[i].field);
- CMSetProperty(inst, prop_list[i].field,
- prop_list[i].value, prop_list[i].type);
- }
-
out:
- free_rasd_prop_list(prop_list);
return inst;
}
@@ -726,7 +628,7 @@
goto out;
}
CU_DEBUG("Got inst");
- if (inst != NULL) {
+ if ((s.rc == CMPI_RC_OK) && (inst != NULL)) {
inst_list_add(list, inst);
CU_DEBUG("Added inst");
} else {
diff -r cbe9f59669b6 -r a2759cb96488 src/Virt_SettingsDefineCapabilities.h
--- a/src/Virt_SettingsDefineCapabilities.h Mon Sep 15 14:44:37 2008 -0700
+++ b/src/Virt_SettingsDefineCapabilities.h Thu Oct 02 11:05:13 2008 -0700
@@ -44,12 +44,6 @@
SDC_RANGE_INC = 3,
} range;
-struct sdc_rasd_prop {
- char *field;
- CMPIValue *value;
- CMPIType type;
-};
-
/*
* Local Variables:
* mode: C
16 years, 2 months
[PATCH] [TEST] Fixing and updating 02_reverse.py of HostedDependency to work with sblim-base-provider
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1222777504 25200
# Node ID 74c27c6878537864db0d9a2f37dcfc826abffa5b
# Parent 52f8b84c5bc6c3665b434b18707e2debbc0c0bff
[TEST] Fixing and updating 02_reverse.py of HostedDependency to work with sblim-base-provider.
1) Updated the tc to work with/without sblim-base-provider.
2) Updated the tc to use cim_define().
3) Updated call_request_state_change() to start the domain.
3) Included the bug no 00007.
4) Used get_host_info() for getting the host information.
Tested with Xen, XenFV, KVM on current sources and with/without sblim-base-provider installed.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 52f8b84c5bc6 -r 74c27c687853 suites/libvirt-cim/cimtest/HostedDependency/02_reverse.py
--- a/suites/libvirt-cim/cimtest/HostedDependency/02_reverse.py Tue Sep 30 05:06:02 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedDependency/02_reverse.py Tue Sep 30 05:25:04 2008 -0700
@@ -29,7 +29,7 @@
# Example cli command is
# wbemcli ain -ac Xen_HostedDependency
# 'http://localhost:5988/root/virt:
-# Xen_HostSystem.CreationClassName="Xen_HostSystem",Name="mx3650b.in.ibm.com"'
+# Xen_HostSystem.CreationClassName="Xen_HostSystem",Name="3650b"'
#
# For which we get the following output
# localhost:5988/root/virt:Xen_ComputerSystem.
@@ -48,41 +48,50 @@ from XenKvmLib.classes import get_class_
from XenKvmLib.classes import get_class_basename
from CimTest.Globals import logger
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL
+from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from XenKvmLib.common_util import get_host_info, call_request_state_change
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "hd_domain"
test_mac = "00:11:22:33:44:55"
+TIME = "00000000000000.000000:000"
+bug_sblim = "00007"
@do_main(sup_types)
def main():
options = main.options
+ virt = options.virt
+ server = options.ip
status = PASS
- virtxml = vxml.get_class(options.virt)
- if options.virt == "LXC":
+ virtxml = vxml.get_class(virt)
+ if virt == "LXC":
cxml = virtxml(test_dom)
else:
cxml = virtxml(test_dom, mac = test_mac)
- ret = cxml.create(options.ip)
+ ret = cxml.cim_define(server)
if not ret:
- logger.error("ERROR: Failed to Create the dom: %s" % test_dom)
- status = FAIL
- return status
- keys = ['Name', 'CreationClassName']
+ logger.error("Failed to define the dom: %s" % test_dom)
+ return FAIL
+
+ rc = call_request_state_change(test_dom, server, 2, TIME, virt)
+ if rc != 0:
+ logger.error("Failed to start the dom: %s" % test_dom)
+ cxml.undefine(server)
+ return FAIL
+
try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)
- if host_sys[0].Name == "":
- raise Exception("HostName seems to be empty")
- else:
- # Instance of the HostSystem
- host_sys = host_sys[0]
+ status, host_name, host_ccn = get_host_info(server, virt)
+ if status != PASS:
+ cxml.destroy(server)
+ cxml.undefine(server)
+ return status
keys = ['Name', 'CreationClassName']
- cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
- if options.virt == 'Xen' or options.virt == 'XenFV':
+ cs = enumclass.enumerate(server, 'ComputerSystem', keys, virt)
+ if virt == 'Xen' or options.virt == 'XenFV':
# Xen honors additional domain-0
cs_list_len = 2
else:
@@ -94,19 +103,27 @@ def main():
# ComputerSystem.EnumerateInstances()
cs_names = [x.name for x in cs]
+ if host_ccn != 'Linux_ComputerSystem':
+ hs_ccn = get_class_basename(host_ccn)
+ else:
+ hs_ccn = host_ccn
+
# Get a list of ComputerSystem instances from the HostSystem instace
- host_ccn = host_sys.CreationClassName
- systems = assoc.AssociatorNames(options.ip, "HostedDependency",
- get_class_basename(host_ccn),
- options.virt,
+ systems = assoc.AssociatorNames(server, "HostedDependency",
+ hs_ccn, virt,
CreationClassName=host_ccn,
- Name=host_sys.Name)
+ Name=host_name)
+
# Compare each returned instance to make sure it's in the list
# that ComputerSystem.EnumerateInstances() returned
if len(systems) < 1:
- raise Exception("HostedDependency returned %d, expected at least 1" %
- len(systems))
+ logger.error("HostedDependency returned %d, expected at least 1",
+ len(systems))
+ cxml.destroy(server)
+ cxml.undefine(server)
+ return XFAIL_RC(bug_sblim)
+
ccn = cs[0].CreationClassName
for guest in systems:
@@ -119,7 +136,7 @@ def main():
# checking the CreationClassName returned is Xen_ComputerSystem
if ccn != guest["CreationClassName"]:
- logger.error("ERROR: CreationClassName does not match")
+ logger.error("CreationClassName does not match")
status = FAIL
# Go through anything remaining in the
@@ -131,15 +148,12 @@ def main():
guest["Name"])
status = FAIL
- except (UnboundLocalError, NameError), detail:
- logger.error("Exception: %s" % detail)
-
except Exception, detail:
- logger.error(detail)
+ logger.error("Exception: %s", detail)
status = FAIL
- cxml.destroy(options.ip)
- cxml.undefine(options.ip)
+ cxml.destroy(server)
+ cxml.undefine(server)
return status
if __name__ == "__main__":
16 years, 2 months