[Libvirt-cim] [PATCH 3 of 3] Add check in RAFP to ensure ref passed is an actual instance

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Dec 20 20:48:47 UTC 2007


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1198183692 28800
# Node ID 89eacde64e5385e9003a8312983ab41468d8f54b
# Parent  3a2bf29ad7376918fdfd77990cbdc15c8d9bf4c7
Add check in RAFP to ensure ref passed is an actual instance.

RAFP 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, rasds_from_pool() will return an empty instance list.

Failing query:
wbemcli ain -ac Xen_ResourceAllocationFromPool 'http://localhost:5988/root/virt:Xen_ProcessorPool.InstanceID="MemoryPool/0"'

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 3a2bf29ad737 -r 89eacde64e53 src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c	Thu Dec 20 12:47:42 2007 -0800
+++ b/src/Virt_ResourceAllocationFromPool.c	Thu Dec 20 12:48:12 2007 -0800
@@ -194,7 +194,7 @@ static CMPIStatus pool_to_rasd(const CMP
                 goto out;
         }
 
-        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,




More information about the Libvirt-cim mailing list