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

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Dec 21 19:00:24 UTC 2007


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1198263517 28800
# Node ID 3ea63b2076c1d02b7c3c48910809b9fb11ee290f
# Parent  e029eb82cf076cdf046bdbbfdcc099fef3ec0ec2
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).

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_ResourceAllocationFromPool 'http://localhost:5988/root/virt:Xen_ProcessorPool.InstanceID="MemoryPool/0"'

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

diff -r e029eb82cf07 -r 3ea63b2076c1 src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c	Fri Dec 21 10:51:16 2007 -0800
+++ b/src/Virt_ResourceAllocationFromPool.c	Fri Dec 21 10:58:37 2007 -0800
@@ -183,6 +183,7 @@ static CMPIStatus pool_to_rasd(const CMP
         CMPIStatus s = {CMPI_RC_OK, NULL};
         const char *poolid;
         uint16_t type;
+        CMPIInstance *inst;
 
         if (!match_hypervisor_prefix(ref, info))
                 return s;
@@ -202,6 +203,9 @@ static CMPIStatus pool_to_rasd(const CMP
                 goto out;
         }
 
+        s = get_pool_inst(_BROKER, ref, &inst);
+        if ((s.rc != CMPI_RC_OK) || (inst == NULL))
+                goto out;
 
         rasds_from_pool(type, 
                         ref,




More information about the Libvirt-cim mailing list