Kaitlin Rupert wrote:
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1203702578 28800
# Node ID 2bff66d74872c62ef38fca81fafd32f0d7fb126a
# Parent d02f5729977381ec6f5aec3503dc5f970a428b88
Add property filtering to RASD provider.
wbemcli is unable to parse embedded instance arrays, so this additional property
filtering support will allow queries to exclude the HostResource property.
Failing Query:
wbemcli ei
http://localhost/root/virt:Xen_ProcResourceAllocationSettingData
*
* wbemcli: Parse Exception: Unknown attribute in list for PROPERTY.ARRAY (EMBEDDEDOB)
Passing Query:
wbemcli ei
http://localhost/root/virt:Xen_ProcResourceAllocationSettingData ResourceType
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r d02f57299773 -r 2bff66d74872 src/Virt_RASD.c
--- a/src/Virt_RASD.c Fri Feb 22 12:54:52 2008 +0100
+++ b/src/Virt_RASD.c Fri Feb 22 09:49:38 2008 -0800
@@ -312,6 +314,14 @@ static CMPIInstance *rasd_from_vdev(cons
NAMESPACE(ref));
if (inst == NULL)
return inst;
+
+ if (properties != NULL) {
+ const char *keys[] = {"InstanceID", NULL};
+ s = CMSetPropertyFilter(inst, properties, keys);
+ /* FIXME - in case of an error, should we continue on? */
+ if (s.rc != CMPI_RC_OK)
+ CU_DEBUG("Unable to set property filter: %d", s.rc);
+ }
That's a very good point to enable the provider interfaces for the
property filtering :). I think it makes sense to move this code into
get_typed_instance() of libxkutil, to avoid implementing these lines for
every provider. What's then only necessary is routing the properties
list through the interfaces. But you will now think ... and how about
the keys ? Well, that's an interesting thing. The CMPI 2.0 spec tells
the following about the keys:
CMPI 2.0 Spec; "The keyList argument shall be ignored by the MB; it is
here to maintain binary compatibility with previous specifications.
Providers should explicitly set the key names and values via the
CMPIInstanceMI.setObjectPath() function."
Translated I think this means, that we can ignore the keys by setting it
to NULL. Do you agree ?
You can also skip the check if a the properties filter is there, as NULL
is interpreted as "all properties accepted".
CMPI 2.0 Spec: "The propertyList argument defines the properties that
will be accepted by subsequent setProperty() operations. The
propertyList argument is an array of pointers to character strings,
terminated by a NULL pointer. A NULL value effectively means that all
properties will be accepted. A pointer to an empty list means that no
properties will be accepted."
CMPIStatus get_rasd_by_ref(const CMPIBroker *broker,
const CMPIObjectPath *reference,
+ const char **properties,
CMPIInstance **_inst)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
@@ -435,7 +447,7 @@ CMPIStatus get_rasd_by_ref(const CMPIBro
goto out;
}
- s = get_rasd_by_name(broker, reference, name, type, _inst);
+ s = get_rasd_by_name(broker, reference, name, type, properties, _inst);
Sorry, I broker your patch with my previous changes at this line.
--
Regards
Heidi Eckhart
Software Engineer
IBM Linux Technology Center - Open Hypervisor