# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1198183662 28800
# Node ID 3a2bf29ad7376918fdfd77990cbdc15c8d9bf4c7
# Parent 912a37bdd53f3fbf8e13026d8cbc02921aa028c1
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).
Now that device_type_from_str() allows strings, instead of passing the poolid, pass the
classname base. If the InstanceID doesn't match that of a valid pool, devs_from_pool()
will return an empty instance list.
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 912a37bdd53f -r 3a2bf29ad737 src/Virt_ElementAllocatedFromPool.c
--- a/src/Virt_ElementAllocatedFromPool.c Thu Dec 20 12:47:41 2007 -0800
+++ b/src/Virt_ElementAllocatedFromPool.c Thu Dec 20 12:47:42 2007 -0800
@@ -215,7 +215,7 @@ static CMPIStatus pool_to_vdev(const CMP
CU_DEBUG("Got %s\n", poolid);
- type = device_type_from_poolid(poolid);
+ type = device_type_from_str(class_base_name(CLASSNAME(ref)));
if (type == VIRT_DEV_UNKNOWN) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,