[PATCH] Make ResourcePoolConfigurationService return errors when appropriate
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1194283579 28800
# Node ID 0ae96e2255c9d6b095b3cbdcbb247621a8abd91a
# Parent fa10054ee62b6f5bb7fc3f832464e4d6caf6f274
Make ResourcePoolConfigurationService return errors when appropriate
and fix up some other general error-handling around the needed changes.
This includes a use of the (now controversial) cu_compare_ref() function,
so I won't commit this until we come to a decision about it, but the
act of checking the reference is something we need to do here, no matter
how it shakes out.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r fa10054ee62b -r 0ae96e2255c9 src/Virt_ResourcePoolConfigurationService.c
--- a/src/Virt_ResourcePoolConfigurationService.c Mon Nov 05 06:59:19 2007 -0800
+++ b/src/Virt_ResourcePoolConfigurationService.c Mon Nov 05 09:26:19 2007 -0800
@@ -89,7 +89,8 @@ DEFAULT_EQ();
DEFAULT_EQ();
DEFAULT_INST_CLEANUP();
-static CMPIInstance *rpcs_instance(const CMPIObjectPath *reference)
+static CMPIStatus rpcs_instance(const CMPIObjectPath *reference,
+ CMPIInstance **_inst)
{
CMPIInstance *inst;
CMPIInstance *host;
@@ -98,28 +99,47 @@ static CMPIInstance *rpcs_instance(const
s = get_host_cs(_BROKER, reference, &host);
if (s.rc != CMPI_RC_OK)
- return NULL;
+ goto out;
inst = get_typed_instance(_BROKER,
"ResourcePoolConfigurationService",
NAMESPACE(reference));
+ if (inst == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get "
+ "ResourcePoolConfigurationService instance");
+ goto out;
+ }
CMSetProperty(inst, "Name",
(CMPIValue *)"RPCS", CMPI_chars);
prop = CMGetProperty(host, "CreationClassName", &s);
- if (s.rc != CMPI_RC_OK)
- return NULL;
+ if (s.rc != CMPI_RC_OK) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get CreationClassName from HostSystem");
+ goto out;
+ }
+
CMSetProperty(inst, "SystemCreationClassName",
(CMPIValue *)&prop.value.string, CMPI_string);
prop = CMGetProperty(host, "Name", NULL);
- if (s.rc != CMPI_RC_OK)
- return NULL;
+ if (s.rc != CMPI_RC_OK) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get Name from HostSystem");
+ goto out;
+ }
+
CMSetProperty(inst, "SystemName",
(CMPIValue *)&prop.value.string, CMPI_string);
- return inst;
+ *_inst = inst;
+ out:
+ return s;
}
static CMPIStatus GetInstance(CMPIInstanceMI *self,
@@ -129,12 +149,30 @@ static CMPIStatus GetInstance(CMPIInstan
const char **properties)
{
CMPIInstance *inst;
-
- inst = rpcs_instance(reference);
-
- CMReturnInstance(results, inst);
-
- return (CMPIStatus){CMPI_RC_OK, NULL};
+ CMPIStatus s;
+ const struct cu_property *prop;
+ static struct cu_property props[] = {
+ {"CreationClassName", 0},
+ {"SystemCreationClassName", 0},
+ {"SystemName", 0},
+ {"Name", 1},
+ {NULL, 0}
+ };
+
+ s = rpcs_instance(reference, &inst);
+ if (s.rc != CMPI_RC_OK)
+ return s;
+
+ prop = cu_compare_ref(reference, inst, props);
+ if (prop != NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "No such instance (%s)", prop->name);
+ } else {
+ CMReturnInstance(results, inst);
+ }
+
+ return s;
}
static CMPIStatus EnumInstanceNames(CMPIInstanceMI *self,
@@ -143,12 +181,13 @@ static CMPIStatus EnumInstanceNames(CMPI
const CMPIObjectPath *reference)
{
CMPIInstance *inst;
-
- inst = rpcs_instance(reference);
-
- cu_return_instance_name(results, inst);
-
- return (CMPIStatus){CMPI_RC_OK, NULL};
+ CMPIStatus s;
+
+ s = rpcs_instance(reference, &inst);
+ if (s.rc == CMPI_RC_OK)
+ cu_return_instance_name(results, inst);
+
+ return s;
}
static CMPIStatus EnumInstances(CMPIInstanceMI *self,
@@ -159,12 +198,13 @@ static CMPIStatus EnumInstances(CMPIInst
{
CMPIInstance *inst;
-
- inst = rpcs_instance(reference);
-
- CMReturnInstance(results, inst);
-
- return (CMPIStatus){CMPI_RC_OK, NULL};
+ CMPIStatus s;
+
+ s = rpcs_instance(reference, &inst);
+ if (s.rc == CMPI_RC_OK)
+ CMReturnInstance(results, inst);
+
+ return s;
}
17 years, 1 month
[PATCH] Fixes improper formatting in ElementAllocatedFromPool.mof. This was causing an error during the postinstall with Pegasus, which prevented the mof from being added to the repository correctly
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1194289946 28800
# Node ID ffb35bc02f07812cee133ebab999d8b463d51d03
# Parent e8577c608398eeb0812342dc942a4788116d4515
Fixes improper formatting in ElementAllocatedFromPool.mof. This was causing an error during the postinstall with Pegasus, which prevented the mof from being added to the repository correctly.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r e8577c608398 -r ffb35bc02f07 schema/ElementAllocatedFromPool.mof
--- a/schema/ElementAllocatedFromPool.mof Mon Nov 05 12:40:33 2007 +0100
+++ b/schema/ElementAllocatedFromPool.mof Mon Nov 05 11:12:26 2007 -0800
@@ -1,5 +1,7 @@
// Copyright IBM Corp. 2007
-Xen_ElementAllocatedFromPool : CIM_ElementAllocatedFromPool {
+[Association]
+class Xen_ElementAllocatedFromPool : CIM_ElementAllocatedFromPool {
};
-KVM_ElementAllocatedFromPool : CIM_ElementAllocatedFromPool {
+[Association]
+class KVM_ElementAllocatedFromPool : CIM_ElementAllocatedFromPool {
};
17 years, 1 month
[PATCH] Fix non-DMTF-conform property values on RegisteredProfile
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1194262833 -3600
# Node ID 86babdd4b732e6b1203acab9372cf42970032cbf
# Parent 8ddace706d4a00e3097553e734dd1842aca0a97a
Fix non-DMTF-conform property values on RegisteredProfile
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 8ddace706d4a -r 86babdd4b732 src/profiles.h
--- a/src/profiles.h Fri Nov 02 15:31:09 2007 -0700
+++ b/src/profiles.h Mon Nov 05 12:40:33 2007 +0100
@@ -31,15 +31,15 @@ struct reg_prof {
struct reg_prof SystemVirtualization = {
.reg_org = 2,
- .reg_id = "DSP1042-1.0.0a",
- .reg_name = "System Virtualization Profile",
- .reg_version = "1.0.0a",
+ .reg_id = "CIM:DSP1042-SystemVirtualization-1.0.0",
+ .reg_name = "System Virtualization",
+ .reg_version = "1.0.0",
.provider_name = "HostSystem"
};
struct reg_prof VirtualSystem = {
.reg_org = 2,
- .reg_id = "DSP1057-1.0.0a",
+ .reg_id = "CIM:DSP1057-VirtualSystem-1.0.0a",
.reg_name = "Virtual System Profile",
.reg_version = "1.0.0a",
.provider_name = "ComputerSystem"
17 years, 1 month
[PATCH] Replace #include of libvirt.h in ComputerSystem
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1194274759 28800
# Node ID fa10054ee62b6f5bb7fc3f832464e4d6caf6f274
# Parent 8ddace706d4a00e3097553e734dd1842aca0a97a
Replace #include of libvirt.h in ComputerSystem
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 8ddace706d4a -r fa10054ee62b src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Fri Nov 02 15:31:09 2007 -0700
+++ b/src/Virt_ComputerSystem.c Mon Nov 05 06:59:19 2007 -0800
@@ -28,6 +28,8 @@
#include <cmpift.h>
#include <cmpimacs.h>
+#include <libvirt.h>
+
#include "cs_util.h"
#include "libcmpiutil.h"
#include "misc_util.h"
17 years, 1 month
Namespace of association ElementCapabilities
by Heidi Eckhart
The association ElementCapabilities seems to be registered to the wrong
namespace ? Shouldn't it be root/ibmsd ?
Xen_ElementCapabilities root/interop Xen_ElementCapabilitiesProvider
Virt_ElementCapabilities association
KVM_ElementCapabilities root/interop KVM_ElementCapabilitiesProvider
Virt_ElementCapabilities association
--
Regards
Heidi Eckhart
Software Engineer
Linux Technology Center - Open Hypervisor
heidieck(a)linux.vnet.ibm.com
**************************************************
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
17 years, 1 month
[PATCH] Remove newline characters from CU_DEBUG calls now that the newline is automatic. Also remove a few debug messages that are no longer necessary and clutter output
by Jay Gagnon
# HG changeset patch
# User Jay Gagnon <grendel(a)linux.vnet.ibm.com>
# Date 1193939694 14400
# Node ID 66e4bd0fd892e97719769b5ad3128ed2ccbfc514
# Parent 308064b52d99dcfff6315a309cc8aa66cb55f556
Remove newline characters from CU_DEBUG calls now that the newline is automatic. Also remove a few debug messages that are no longer necessary and clutter output.
Signed-off-by: Jay Gagnon <grendel(a)linux.vnet.ibm.com>
diff -r 308064b52d99 -r 66e4bd0fd892 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Thu Nov 01 13:48:50 2007 -0400
+++ b/src/Virt_SettingsDefineCapabilities.c Thu Nov 01 13:54:54 2007 -0400
@@ -51,12 +51,10 @@ static bool rasd_prop_copy_value(struct
{
bool rc = true;
- CU_DEBUG("Copying '%s'.\n", src.field);
+ CU_DEBUG("Copying '%s'.", src.field);
if (src.type & CMPI_string) {
- CU_DEBUG("String type.\n");
dest->value = (CMPIValue *)strdup((char *)src.value);
} else if (src.type & CMPI_INTEGER) {
- CU_DEBUG("Integer type.\n");
dest->value = malloc(sizeof(CMPIValue));
memcpy(dest->value, src.value, sizeof(CMPIValue));
} else {
@@ -74,7 +72,6 @@ static bool dup_rasd_prop_list(struct sd
*dest = NULL;
for (i = 0, count = 1; src[i].field != NULL; i++, count++) {
- CU_DEBUG("count: %d, i: %d. reallocing.\n", count, i);
*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]);
@@ -82,7 +79,6 @@ static bool dup_rasd_prop_list(struct sd
}
/* Make sure to terminate the list. */
- CU_DEBUG("Terminating list. count: %d, i: %d\n", count, i);
*dest = realloc(*dest, count * sizeof(struct sdc_rasd_prop));
(*dest)[i] = (struct sdc_rasd_prop)PROP_END;
@@ -386,16 +382,16 @@ static CMPIInstance *sdc_rasd_inst(const
CMSetProperty(inst, "ResourceType", &resource_type, CMPI_uint16);
for (i = 0; prop_list[i].field != NULL; i++) {
- CU_DEBUG("Setting property '%s'.\n", prop_list[i].field);
+ CU_DEBUG("Setting property '%s'.", prop_list[i].field);
CMSetProperty(inst, prop_list[i].field,
prop_list[i].value, prop_list[i].type);
- CU_DEBUG("Set.\n");
- }
-
- CU_DEBUG("freeing prop_list.\n");
+ CU_DEBUG("Set.");
+ }
+
+ CU_DEBUG("freeing prop_list.");
free_rasd_prop_list(prop_list);
out:
- CU_DEBUG("Returning inst.\n");
+ CU_DEBUG("Returning inst.");
return inst;
}
@@ -422,17 +418,17 @@ static CMPIStatus sdc_rasds_for_type(con
CU_DEBUG("Problem getting inst.");
goto out;
}
- CU_DEBUG("Got inst.\n");
+ CU_DEBUG("Got inst.");
if (inst != NULL) {
inst_list_add(list, inst);
- CU_DEBUG("Added inst.\n");
+ CU_DEBUG("Added inst.");
} else {
- CU_DEBUG("Inst is null, not added.\n");
+ CU_DEBUG("Inst is null, not added.");
}
}
} else {
- CU_DEBUG("Unsupported type.\n");
+ CU_DEBUG("Unsupported type.");
CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
"Unsupported device type.");
}
@@ -449,7 +445,7 @@ static CMPIStatus alloc_cap_to_rasd(cons
int ret;
uint16_t type;
- CU_DEBUG("Getting ResourceType.\n");
+ CU_DEBUG("Getting ResourceType.");
ret = cu_get_u16_path(ref, "ResourceType", &type);
if (ret != 1) {
@@ -458,7 +454,7 @@ static CMPIStatus alloc_cap_to_rasd(cons
goto out;
}
- CU_DEBUG("ResourceType: %hi.\n", type);
+ CU_DEBUG("ResourceType: %hi.", type);
s = sdc_rasds_for_type(ref, list, type);
17 years, 1 month
[PATCH] Remove newline characters from CU_DEBUG calls now that the newline is automatic. Also remove a few debug messages that are no longer necessary and clutter output
by Jay Gagnon
# HG changeset patch
# User Jay Gagnon <grendel(a)linux.vnet.ibm.com>
# Date 1194274337 18000
# Node ID 81dadd293027c2b7f5448f81847966a467acca46
# Parent c085e6e20b40d6dd3cde7809b2681be53f6b4dea
Remove newline characters from CU_DEBUG calls now that the newline is automatic. Also remove a few debug messages that are no longer necessary and clutter output.
Signed-off-by: Jay Gagnon <grendel(a)linux.vnet.ibm.com>
diff -r c085e6e20b40 -r 81dadd293027 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Mon Nov 05 09:23:11 2007 -0500
+++ b/src/Virt_SettingsDefineCapabilities.c Mon Nov 05 09:52:17 2007 -0500
@@ -53,12 +53,10 @@ static bool rasd_prop_copy_value(struct
{
bool rc = true;
- CU_DEBUG("Copying '%s'.\n", src.field);
+ CU_DEBUG("Copying '%s'.", src.field);
if (src.type & CMPI_string) {
- CU_DEBUG("String type.\n");
dest->value = (CMPIValue *)strdup((char *)src.value);
} else if (src.type & CMPI_INTEGER) {
- CU_DEBUG("Integer type.\n");
dest->value = malloc(sizeof(CMPIValue));
memcpy(dest->value, src.value, sizeof(CMPIValue));
} else {
@@ -76,7 +74,6 @@ static bool dup_rasd_prop_list(struct sd
*dest = NULL;
for (i = 0, count = 1; src[i].field != NULL; i++, count++) {
- CU_DEBUG("count: %d, i: %d. reallocing.\n", count, i);
*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]);
@@ -84,7 +81,6 @@ static bool dup_rasd_prop_list(struct sd
}
/* Make sure to terminate the list. */
- CU_DEBUG("Terminating list. count: %d, i: %d\n", count, i);
*dest = realloc(*dest, count * sizeof(struct sdc_rasd_prop));
(*dest)[i] = (struct sdc_rasd_prop)PROP_END;
@@ -501,16 +497,16 @@ static CMPIInstance *sdc_rasd_inst(const
CMSetProperty(inst, "ResourceType", &resource_type, CMPI_uint16);
for (i = 0; prop_list[i].field != NULL; i++) {
- CU_DEBUG("Setting property '%s'.\n", prop_list[i].field);
+ CU_DEBUG("Setting property '%s'.", prop_list[i].field);
CMSetProperty(inst, prop_list[i].field,
prop_list[i].value, prop_list[i].type);
- CU_DEBUG("Set.\n");
- }
-
- CU_DEBUG("freeing prop_list.\n");
+ CU_DEBUG("Set.");
+ }
+
+ CU_DEBUG("freeing prop_list.");
free_rasd_prop_list(prop_list);
out:
- CU_DEBUG("Returning inst.\n");
+ CU_DEBUG("Returning inst.");
return inst;
}
@@ -537,17 +533,17 @@ static CMPIStatus sdc_rasds_for_type(con
CU_DEBUG("Problem getting inst.");
goto out;
}
- CU_DEBUG("Got inst.\n");
+ CU_DEBUG("Got inst.");
if (inst != NULL) {
inst_list_add(list, inst);
- CU_DEBUG("Added inst.\n");
+ CU_DEBUG("Added inst.");
} else {
- CU_DEBUG("Inst is null, not added.\n");
+ CU_DEBUG("Inst is null, not added.");
}
}
} else {
- CU_DEBUG("Unsupported type.\n");
+ CU_DEBUG("Unsupported type.");
CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
"Unsupported device type.");
}
@@ -564,7 +560,7 @@ static CMPIStatus alloc_cap_to_rasd(cons
int ret;
uint16_t type;
- CU_DEBUG("Getting ResourceType.\n");
+ CU_DEBUG("Getting ResourceType.");
ret = cu_get_u16_path(ref, "ResourceType", &type);
if (ret != 1) {
@@ -573,7 +569,7 @@ static CMPIStatus alloc_cap_to_rasd(cons
goto out;
}
- CU_DEBUG("ResourceType: %hi.\n", type);
+ CU_DEBUG("ResourceType: %hi.", type);
s = sdc_rasds_for_type(ref, list, type);
17 years, 1 month
[PATCH] fix trivial libcmpiutil compilation issue
by Daniel Veillard
# HG changeset patch
# User Daniel Veillard <veillard(a)redhat.com>
# Date 1193910954 -3600
# Node ID 5e54246e74833caed8f5176f8bd5bb9e28b60299
# Parent 05b01d03f0b801afe266d8d012bc464be6a2d165
Fix a trivial compilation problem,
the variable declaration is at the wrong place.
Signed-off-by: Daniel Veillard <veillard(a)redhat.com>
Daniel
diff -r 05b01d03f0b8 -r 5e54246e7483 eo_parser.c
--- a/eo_parser.c Sun Feb 15 22:01:53 2015 -0800
+++ b/eo_parser.c Thu Nov 01 10:55:54 2007 +0100
@@ -66,9 +66,9 @@ int cu_parse_embedded_instance(const cha
const CMPIBroker *broker,
CMPIInstance **instance)
{
+ int ret;
#ifdef HAVE_EOPARSER
int fd;
- int ret;
FILE *fp;
fd = write_temp(eo);
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
17 years, 1 month
Automatic information of updates to libvirt-cim and libcmpiutil
by Heidi Eckhart
Is there an automated process that informs the list each time an update
was made to the libvirt.org/hg/libvirt-cim and
libvirt.org/hg/libcmpiutil repositories. If not already there, this
would be great to have.
thanks ... Heidi
--
Regards
Heidi Eckhart
Software Engineer
Linux Technology Center - Open Hypervisor
heidieck(a)linux.vnet.ibm.com
**************************************************
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
17 years, 1 month
[PATCH 0 of 2] Move two classes to cu_compare_ref()
by Dan Smith
The first patch removes the internal reference key checking from VSMS
in favor of the libcmpiutil generic one. The second makes ComputerSystem
do similar checking. If this looks good to people, we'll want to do this
for (probably) all of the instance providers.
17 years, 1 month