Jay Gagnon wrote:
# HG changeset patch
# User Jay Gagnon <grendel(a)linux.vnet.ibm.com>
# Date 1194557532 18000
# Node ID cf0a2938ba0b9d2e7af8a5790d0e56cc7564df73
# Parent 2d09468e2de7ed9194907bfff1efbb16ba40202d
Add another relationship to ElementCapabilities, the ResourcePool-AllocationCapabilities
connection. Only supports the pool_to_alloc direction, because it is the only one
that's terribly interesting, but the other direction will need to be added at some
point.
Signed-off-by: Jay Gagnon <grendel(a)linux.vnet.ibm.com>
+
+ inst = get_typed_instance(_BROKER, "AllocationCapabilities",
+ NAMESPACE(ref));
+ CMSetProperty(inst, "InstanceID", inst_id, CMPI_chars);
+
+ ret = cu_get_u16_path(ref, "ResourceType", &type);
+ if (ret != 1) {
+ CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
+ "Could not get ResourceType.");
+ goto out;
+ }
+ CMSetProperty(inst, "ResourceType", &type, CMPI_uint16);
+
+ inst_list_add(list, inst);
+
+ out:
+ free(inst_id);
+
+ return s;
+}
Just a nit-picky thing here... why not call the AllocCapabilities
function that setups the instance? I think using the same InstanceID
for the AllocCapa as the pool might not always return the correct
instance because AllocCapa uses <pool type>/0 as the InstanceID. But
something like the NetworkingPool returns "NetworkPool/xenbr0". So
you'll be creating an instance with "NetworkPool/xenbr0" as the
InstanceID, which would conflict with what EnumInstances from AllocCapa
would return.
--
Kaitlin Rupert
IBM Linux Technology Center
karupert(a)us.ibm.com