# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1197967960 -3600
# Node ID 10e6c4ff5ebcd46dd8a2cb6952ea8d8201624f4d
# Parent fcb43d2882bc6925c41b7e451e6c41e42d430025
SDC: returned instances are not of type specific subclass
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r fcb43d2882bc -r 10e6c4ff5ebc src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Tue Dec 18 09:50:50 2007 +0100
+++ b/src/Virt_SettingsDefineCapabilities.c Tue Dec 18 09:52:40 2007 +0100
@@ -42,6 +42,7 @@
#include "Virt_SettingsDefineCapabilities.h"
#include "Virt_DevicePool.h"
+#include "Virt_RASD.h"
const static CMPIBroker *_BROKER;
@@ -657,9 +658,10 @@ static CMPIInstance *sdc_rasd_inst(const
sdc_rasd_type type)
{
CMPIInstance *inst = NULL;
- struct sdc_rasd_prop *prop_list;
+ struct sdc_rasd_prop *prop_list = NULL;
int i;
- char *inst_id;
+ const char *inst_id = NULL;
+ const char *base = NULL;
uint16_t resource_type;
/* Defaults for the following are from
CIM_SettingsDefineCapabilities.mof. */
@@ -700,15 +702,21 @@ static CMPIInstance *sdc_rasd_inst(const
cu_statusf(broker, s,
CMPI_RC_ERR_FAILED,
"Unsupported sdc_rasd type");
- goto out;
}
if (s->rc != CMPI_RC_OK)
goto out;
+
+ if (rasd_classname_from_type(rasd->resource_type, &base) != CMPI_RC_OK) {
+ cu_statusf(broker, s,
+ CMPI_RC_ERR_FAILED,
+ "Resource type not known");
+ goto out;
+ }
inst = get_typed_instance(broker,
CLASSNAME(ref),
- "ResourceAllocationSettingData",
+ base,
NAMESPACE(ref));
CMSetProperty(inst, "InstanceID", inst_id, CMPI_chars);
@@ -725,10 +733,8 @@ static CMPIInstance *sdc_rasd_inst(const
prop_list[i].value, prop_list[i].type);
}
- CU_DEBUG("freeing prop_list");
+ out:
free_rasd_prop_list(prop_list);
- out:
- CU_DEBUG("Returning inst");
return inst;
}