
# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1204547111 -3600 # Node ID e8d6ec769854a8b3276de24919e3f5a50382aaaa # Parent 0110c5e63a7f4ed7bc556dacb407dba8a0f1380d EAFP: adopt DevicePool interface changes Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r 0110c5e63a7f -r e8d6ec769854 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Mon Mar 03 13:19:38 2008 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Mon Mar 03 13:25:11 2008 +0100 @@ -66,7 +66,6 @@ static CMPIStatus vdev_to_pool(const CMP uint16_t type; const char *id = NULL; char *poolid = NULL; - virConnectPtr conn = NULL; CMPIInstance *pool = NULL; if (!match_hypervisor_prefix(ref, info)) @@ -95,25 +94,14 @@ static CMPIStatus vdev_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; } @@ -199,6 +187,10 @@ static CMPIStatus pool_to_vdev(const CMP if (!match_hypervisor_prefix(ref, info)) return s; + 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, CMPI_RC_ERR_FAILED, @@ -215,10 +207,6 @@ static CMPIStatus pool_to_vdev(const CMP "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; devs_from_pool(type, ref, poolid, list);