# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1204797489 -3600
# Node ID 64e4b5f13878ff7b1ba59bea42709d0cac1c7bbc
# Parent 91ac728ec7c9b5e68b73d90039aa75f293978dd3
RAFP: adopt DevicePool interface changes
- adopted changes to DevicePool interface
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 91ac728ec7c9 -r 64e4b5f13878 src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c Thu Mar 06 10:58:08 2008 +0100
+++ b/src/Virt_ResourceAllocationFromPool.c Thu Mar 06 10:58:09 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;
}