# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1204892345 -3600
# Node ID d24e8fe2d358588a2d3a6484111806e1986d90fa
# Parent 5c46a8e9bf8962d48535fd3b1c1b486d92a9b5b7
RAFP: adopt RASD interface changes
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 5c46a8e9bf89 -r d24e8fe2d358 src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c Fri Mar 07 13:19:04 2008 +0100
+++ b/src/Virt_ResourceAllocationFromPool.c Fri Mar 07 13:19:05 2008 +0100
@@ -51,7 +51,7 @@ static CMPIStatus rasd_to_pool(const CMP
if (!match_hypervisor_prefix(ref, info))
return s;
- if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) {
+ if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Unable to determine RASD type");
@@ -109,7 +109,7 @@ static int filter_by_pool(struct inst_li
if (op == NULL)
continue;
- if (rasd_type_from_classname(CLASSNAME(op), &type) !=
+ if (res_type_from_rasd_classname(CLASSNAME(op), &type) !=
CMPI_RC_OK)
continue;
@@ -123,52 +123,6 @@ static int filter_by_pool(struct inst_li
return dest->cur;
}
-static int rasds_from_pool(uint16_t type,
- const CMPIObjectPath *ref,
- const char *poolid,
- const char **properties,
- struct inst_list *list)
-{
- CMPIStatus s;
- virConnectPtr conn = NULL;
- virDomainPtr *doms = NULL;
- int count;
- int i;
-
- conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
- if (conn == NULL)
- return 0;
-
- count = get_domain_list(conn, &doms);
-
- for (i = 0; i < count; i++) {
- const char *name;
- struct inst_list tmp;
-
- inst_list_init(&tmp);
-
- name = virDomainGetName(doms[i]);
-
- rasds_for_domain(_BROKER,
- name,
- type,
- ref,
- properties,
- &tmp);
-
- filter_by_pool(list, &tmp, poolid);
-
- inst_list_free(&tmp);
-
- virDomainFree(doms[i]);
- }
-
- free(doms);
- virConnectClose(conn);
-
- return count;
-}
-
static CMPIStatus pool_to_rasd(const CMPIObjectPath *ref,
struct std_assoc_info *info,
struct inst_list *list)
@@ -176,7 +130,8 @@ static CMPIStatus pool_to_rasd(const CMP
CMPIStatus s = {CMPI_RC_OK, NULL};
const char *poolid;
uint16_t type;
- CMPIInstance *inst;
+ CMPIInstance *inst = NULL;
+ struct inst_list tmp_list;
if (!match_hypervisor_prefix(ref, info))
goto out;
@@ -200,11 +155,16 @@ static CMPIStatus pool_to_rasd(const CMP
goto out;
}
- rasds_from_pool(type,
- ref,
- poolid,
- info->properties,
- list);
+ inst_list_init(&tmp_list);
+
+ s = enum_rasds(_BROKER,
+ ref,
+ NULL,
+ type,
+ info->properties,
+ &tmp_list);
+
+ filter_by_pool(list, &tmp_list, poolid);
out:
return s;