# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1197394944 28800
# Node ID 6c3ca59055416d7bb07716d3a750800e6087878e
# Parent 23183bc1e0f3c33038cd67b69613fb081fc8c2e3
Fix SDC - AllocationCapabilities - RASD returns error.
Querying SDC using an AllocationCapabilities instance returns: "Could not get
ResourceType". This is because SDC is expecting the AC ref to have the ResourceType
defined. But ResourceType isn't a key, so SDC can be queried without specifying a
value for ResourceType.
Instead of using the ResourceType attribute, get the resource type from the InstanceID.
Failing query:
wbemcli ai -ac Xen_SettingsDefineCapabilities
'http://localhost:5988/root/virt:Xen_AllocationCapabilities.InstanceID="ProcessorPool/0"'
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 23183bc1e0f3 -r 6c3ca5905541 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Tue Dec 11 09:42:08 2007 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c Tue Dec 11 09:42:24 2007 -0800
@@ -778,23 +778,31 @@ static CMPIStatus alloc_cap_to_rasd(cons
struct inst_list *list)
{
CMPIStatus s = {CMPI_RC_OK};
- int ret;
uint16_t type;
+ const char *id = NULL;
if (!match_hypervisor_prefix(ref, info))
return s;
CU_DEBUG("Getting ResourceType");
- ret = cu_get_u16_path(ref, "ResourceType", &type);
- if (ret != CMPI_RC_OK) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Could not get ResourceType");
- goto out;
- }
-
+ if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Missing InstanceID");
+ goto out;
+ }
+
+ type = device_type_from_poolid(id);
+
CU_DEBUG("ResourceType: %hi", type);
+
+ if (type == VIRT_DEV_UNKNOWN) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to determine resource type");
+ goto out;
+ }
s = sdc_rasds_for_type(ref, list, type);