[PATCH] Fix connect_by_classname() to set error status when connect fails
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1200005355 28800
# Node ID bb05fe5857468c3a524a29c06390d90ac84dde68
# Parent ca8dc23eacc44970a2d79978bc9de65aaa600b92
Fix connect_by_classname() to set error status when connect fails.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r ca8dc23eacc4 -r bb05fe585746 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Wed Jan 09 13:08:17 2008 +0100
+++ b/libxkutil/misc_util.c Thu Jan 10 14:49:15 2008 -0800
@@ -71,7 +71,9 @@ virConnectPtr connect_by_classname(const
conn = virConnectOpen(uri);
if (!conn) {
- CU_DEBUG("Unable to connect to `%s'", uri);
+ cu_statusf(broker, s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to connect to `%s'", uri);
return NULL;
}
16 years, 11 months
[PATCH] Fix array type missing in VSMigrationCapabilities properties
by lizg@cn.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1200042953 -28800
# Node ID ebb30883a8e98732e2800193eacc11cbe00eb18c
# Parent ca8dc23eacc44970a2d79978bc9de65aaa600b92
Fix array type missing in VSMigrationCapabilities properties.
sfcb doesn't seem to doing well on array without a type. It
will report an 'invalid data type 8192 2000' upon generating
the returned instances for EnumInstances request.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r ca8dc23eacc4 -r ebb30883a8e9 src/Virt_VSMigrationCapabilities.c
--- a/src/Virt_VSMigrationCapabilities.c Wed Jan 09 13:08:17 2008 +0100
+++ b/src/Virt_VSMigrationCapabilities.c Fri Jan 11 17:15:53 2008 +0800
@@ -46,7 +46,7 @@ static CMPIStatus set_method_properties(
CMPIStatus s;
uint16_t val;
- array = CMNewArray(broker, 2, CMPI_INTEGER, &s);
+ array = CMNewArray(broker, 2, CMPI_uint16, &s);
if (s.rc != CMPI_RC_OK)
return s;
@@ -57,10 +57,10 @@ static CMPIStatus set_method_properties(
CMSetArrayElementAt(array, 1, (CMPIValue *)&val, CMPI_uint16);
CMSetProperty(inst, "AsynchronousMethodsSupported",
- (CMPIValue *)&array, CMPI_ARRAY);
+ (CMPIValue *)&array, CMPI_uint16A);
- array = CMNewArray(broker, 2, CMPI_INTEGER, &s);
+ array = CMNewArray(broker, 2, CMPI_uint16, &s);
if (s.rc != CMPI_RC_OK)
return s;
@@ -71,7 +71,7 @@ static CMPIStatus set_method_properties(
CMSetArrayElementAt(array, 1, (CMPIValue *)&val, CMPI_uint16);
CMSetProperty(inst, "SynchronousMethodsSupported",
- (CMPIValue *)&array, CMPI_ARRAY);
+ (CMPIValue *)&array, CMPI_uint16A);
CMSetStatus(&s, CMPI_RC_OK);
16 years, 11 months
[PATCH] HRP: Validation of client given object path
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1199959479 -3600
# Node ID b69727ddc9a45a32c75547a90364759500280398
# Parent ca8dc23eacc44970a2d79978bc9de65aaa600b92
HRP: Validation of client given object path
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r ca8dc23eacc4 -r b69727ddc9a4 src/Virt_HostedResourcePool.c
--- a/src/Virt_HostedResourcePool.c Wed Jan 09 13:08:17 2008 +0100
+++ b/src/Virt_HostedResourcePool.c Thu Jan 10 11:04:39 2008 +0100
@@ -68,23 +68,13 @@ static CMPIStatus sys_to_pool(const CMPI
CMPIStatus s = {CMPI_RC_OK, NULL};
int i;
virConnectPtr conn;
- CMPIInstance *host;
- const char *prop;
if (!match_hypervisor_prefix(ref, info))
return s;
- s = get_host_cs(_BROKER, ref, &host);
+ s = validate_host_ref(_BROKER, ref);
if (s.rc != CMPI_RC_OK)
return s;
-
- prop = cu_compare_ref(ref, host);
- if (prop != NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_NOT_FOUND,
- "No such HostSystem instance (%s)", prop);
- return s;
- }
conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
if (conn == NULL)
16 years, 11 months
[PATCH 0 of 3] Memory devices from XML and raw XML parsing
by Dan Smith
This patch set:
- Moves memory device parsing to use XML like the rest
- Restructures the entry points of device-only parsing to share
more code
- Adds a function to parse plain XML into a dominfo structure for
times where we don't have a virDomainPtr
- Updates the xml_parse_test program to allow testing of the aforementioned
function, as well as clean up the option parsing to make way for more
features later
16 years, 11 months
[PATCH 0 of 4] RAFP: Validation of client's given object path missing
by Heidi Eckhart
The starting point for this patch series was the missing validation of the client's given object path of ResourceAllocationSettingData in the RAFP provider. This is fixed by patch #1.
Patch #2 switches the return code for getInstance from FAILED to NOT_FOUND for ResourceAllocationSettingData.
Patch #3 registeres the RASD provider for KVM.
Patch #4 switches the return code for getInstance from FAILED to NOT_FOUND for DevicePools.
16 years, 11 months
[PATCH] HS: returns results for wrong object path
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1199797461 -3600
# Node ID 555126035e912e9202ebcc93483ee936be5ae998
# Parent 1bbea87ad37dcb95321f43aa5e17e6fa7ec1836d
HS: returns results for wrong object path
The client given reference was not checked for existance in both
directions (from HostSystem to Service and reverse) and the call
returned wrong results. Now NOT_FOUND is returned in case of a
wrong object path.
Examples:
wbemcli ain -ac KVM_HostedService 'http://localhost/root/virt:KVM_ResourcePoolConfigurationService.CreationC..."wrong",wrong="wrong"'
wbemcli ain -ac KVM_HostedService 'http://localhost/root/virt:KVM_HostSystem.CreationClassName="KVM_HostSystem",Name="notthere"'
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 1bbea87ad37d -r 555126035e91 src/Virt_HostedService.c
--- a/src/Virt_HostedService.c Mon Jan 07 11:42:40 2008 -0800
+++ b/src/Virt_HostedService.c Tue Jan 08 14:04:21 2008 +0100
@@ -37,6 +37,57 @@
const static CMPIBroker *_BROKER;
+static CMPIStatus check_host_ref(const CMPIObjectPath *ref)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst;
+ const char *prop;
+
+ s = get_host_cs(_BROKER, ref, &inst);
+
+ prop = cu_compare_ref(ref, inst);
+ if (prop != NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "No such instance (%s)", prop);
+ }
+
+ return s;
+}
+
+static CMPIStatus check_service_ref(const CMPIObjectPath *ref)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst;
+ const char *prop;
+ char* classname;
+
+ classname = class_base_name(CLASSNAME(ref));
+
+ if (STREQC(classname, "VirtualSystemManagementService")) {
+ s = get_vsms(ref, &inst, _BROKER);
+ }
+ else if (STREQC(classname, "ResourcePoolConfigurationService")) {
+ s = rpcs_instance(ref, &inst, _BROKER);
+ }
+ else if (STREQC(classname, "VirtualSystemMigrationService")) {
+ s = get_migration_service(ref, &inst, _BROKER);
+ }
+ if (s.rc != CMPI_RC_OK)
+ return s;
+
+ prop = cu_compare_ref(ref, inst);
+ if (prop != NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "No such instance (%s)", prop);
+ }
+
+ free(classname);
+
+ return s;
+}
+
static CMPIStatus service_to_host(const CMPIObjectPath *ref,
struct std_assoc_info *info,
struct inst_list *list)
@@ -47,6 +98,10 @@ static CMPIStatus service_to_host(const
if (!match_hypervisor_prefix(ref, info))
return s;
+ s = check_service_ref(ref);
+ if (s.rc != CMPI_RC_OK)
+ return s;
+
s = get_host_cs(_BROKER, ref, &instance);
if (s.rc == CMPI_RC_OK)
inst_list_add(list, instance);
@@ -62,6 +117,10 @@ static CMPIStatus host_to_service(const
CMPIInstance *inst;
if (!match_hypervisor_prefix(ref, info))
+ return s;
+
+ s = check_host_ref(ref);
+ if (s.rc != CMPI_RC_OK)
return s;
s = rpcs_instance(ref, &inst, _BROKER);
16 years, 11 months
[PATCH 0 of 3] Fix offline VCPU representation
by Dan Smith
Currently, we cannot present information and instances for VCPUs when a
domain is powered off, because virDomainGetInfo() does not work unless a
domain is running.
This set ultimately changes the vcpu bits in device_parsing to, that's right,
actually *parse* the VCPU information from the XML like all the other devices,
which gives us VCPU information for offline domains.
To get there, I had to make the core of device_parsing a little more dyanmic
so that the parsing modules could return mulitple devices for a given
XML cycle, which vcpu needs.
16 years, 11 months
[PATCH] Fix virt_device_dup() for emu and graphics devices
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1199818304 28800
# Node ID 10d141f683370b6f04637bb9ad059bbd92051ce0
# Parent 85213a968ca3b6e86b03287c3cf7355d54f62165
Fix virt_device_dup() for emu and graphics devices
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 85213a968ca3 -r 10d141f68337 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Tue Jan 08 08:15:25 2008 -0800
+++ b/libxkutil/device_parsing.c Tue Jan 08 10:51:44 2008 -0800
@@ -395,6 +395,11 @@ struct virt_device *virt_device_dup(stru
dev->dev.vcpu.state = _dev->dev.vcpu.state;
dev->dev.vcpu.cpuTime = _dev->dev.vcpu.cpuTime;
dev->dev.vcpu.cpu = _dev->dev.vcpu.cpu;
+ } else if (dev->type == VIRT_DEV_EMU) {
+ DUP_FIELD(dev, _dev, dev.emu.path);
+ } else if (dev->type == VIRT_DEV_GRAPHICS) {
+ DUP_FIELD(dev, _dev, dev.graphics.type);
+ DUP_FIELD(dev, _dev, dev.graphics.port);
}
return dev;
16 years, 11 months
[PATCH] .#3 Replace printf() with CU_DEBUG in EAFP
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1199808925 28800
# Node ID 39bab8bae81e4bc102085144cea5f8c4016fde69
# Parent 021caa2990b499190a1123727ee52e2d6eaff209
.#3 Replace printf() with CU_DEBUG in EAFP.
Update - removed unnecessary printfs.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 021caa2990b4 -r 39bab8bae81e src/Virt_ElementAllocatedFromPool.c
--- a/src/Virt_ElementAllocatedFromPool.c Tue Jan 08 07:48:08 2008 -0800
+++ b/src/Virt_ElementAllocatedFromPool.c Tue Jan 08 08:15:25 2008 -0800
@@ -135,8 +135,6 @@ static int filter_by_pool(struct inst_li
if ((dev_id == NULL) || (cn == NULL))
continue;
- printf("Device %hhi:%s", type, dev_id);
-
poolid = pool_member_of(_BROKER, cn, type, dev_id);
if (poolid && STREQ(poolid, _poolid))
inst_list_add(dest, inst);
@@ -162,12 +160,8 @@ static int devs_from_pool(uint16_t type,
if (conn == NULL)
return 0;
- printf("Connected\n");
-
count = get_domain_list(conn, &doms);
- printf("Got %i domains\n", count);
-
for (i = 0; i < count; i++) {
const char *name;
struct inst_list tmp;
@@ -179,11 +173,7 @@ static int devs_from_pool(uint16_t type,
/* FIXME: Get VIRT_DEV_ type here */
dom_devices(_BROKER, doms[i], ns, type, &tmp);
- printf("Got devices\n");
-
filter_by_pool(list, &tmp, type, poolid);
-
- printf("Filtered\n");
inst_list_free(&tmp);
virDomainFree(doms[i]);
16 years, 11 months