# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1198263076 28800
# Node ID e029eb82cf076cdf046bdbbfdcc099fef3ec0ec2
# Parent 58166b55f2b923859186c9d4bab47778c209e032
Add check in EAFP to ensure ref passed is an actual instance.
EAFP currently returns instances for invalid refs where the InstanceID doesn't match
the classname type (see failing query).
Get the ResourcePool instance that corresponds to the ref using get_pool_inst(). If this
fails, the reference is not valid.
Failing query:
wbemcli ain -ac Xen_ElementAllocatedFromPool
'http://localhost:5988/root/virt:Xen_DiskPool.InstanceID="NetworkPool/virbr0"'
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 58166b55f2b9 -r e029eb82cf07 src/Virt_ElementAllocatedFromPool.c
--- a/src/Virt_ElementAllocatedFromPool.c Fri Dec 21 10:40:31 2007 -0800
+++ b/src/Virt_ElementAllocatedFromPool.c Fri Dec 21 10:51:16 2007 -0800
@@ -202,6 +202,7 @@ static CMPIStatus pool_to_vdev(const CMP
const char *poolid;
CMPIStatus s = {CMPI_RC_OK, NULL};
uint16_t type;
+ CMPIInstance *inst;
if (!match_hypervisor_prefix(ref, info))
return s;
@@ -223,6 +224,9 @@ static CMPIStatus pool_to_vdev(const CMP
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);