# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1204892340 -3600
# Node ID 1488fea7392b76963e081ca5c638c8d89ce53860
# Parent c903f8ad74ff8484666ca965e03ec42b40ab15ce
RAFP: adopt DevicePool interface changes
- adopted changes to DevicePool interface
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r c903f8ad74ff -r 1488fea7392b src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c Fri Mar 07 13:18:59 2008 +0100
+++ b/src/Virt_ResourceAllocationFromPool.c Fri Mar 07 13:19:00 2008 +0100
@@ -45,7 +45,6 @@ static CMPIStatus rasd_to_pool(const CMP
uint16_t type;
const char *id = NULL;
char *poolid = NULL;
- virConnectPtr conn = NULL;
CMPIInstance *pool = NULL;
CMPIInstance *inst = NULL;
@@ -78,28 +77,17 @@ static CMPIStatus rasd_to_pool(const CMP
goto out;
}
- conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
- if (conn == NULL)
- goto out;
-
- pool = get_pool_by_id(_BROKER,
- conn,
- poolid,
- NAMESPACE(ref));
- if (pool != NULL) {
- inst_list_add(list, pool);
- cu_statusf(_BROKER, &s,
- CMPI_RC_OK,
- "");
- } else {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unable to find pool `%s'", poolid);
- }
+ s = get_pool_by_name(_BROKER,
+ ref,
+ poolid,
+ &pool);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ inst_list_add(list, pool);
out:
free(poolid);
- virConnectClose(conn);
return s;
}
@@ -191,7 +179,11 @@ static CMPIStatus pool_to_rasd(const CMP
CMPIInstance *inst;
if (!match_hypervisor_prefix(ref, info))
- return s;
+ goto out;
+
+ s = get_pool_by_ref(_BROKER, ref, &inst);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
@@ -200,17 +192,13 @@ static CMPIStatus pool_to_rasd(const CMP
goto out;
}
- type = device_type_from_poolid(poolid);
- if (type == VIRT_DEV_UNKNOWN) {
+ type = res_type_from_pool_id(poolid);
+ if (type == CIM_RES_TYPE_UNKNOWN) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Invalid InstanceID or unsupported pool type");
goto out;
}
-
- s = get_pool_inst(_BROKER, ref, &inst);
- if ((s.rc != CMPI_RC_OK) || (inst == NULL))
- goto out;
rasds_from_pool(type,
ref,
@@ -218,9 +206,6 @@ static CMPIStatus pool_to_rasd(const CMP
info->properties,
list);
- cu_statusf(_BROKER, &s,
- CMPI_RC_OK,
- "");
out:
return s;
}