
Kaitlin Rupert wrote:
Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1194453648 28800 # Node ID 926009fc62a0080bcf93aaddf098b074ce71a096 # Parent 404c4803b1b542676c4d283226a7cc3b7f3ab58d Change cu_compare_ref() to be a little lighter-weight Now, we just check the keys that were provided by the client (or the CIMOM if that ever starts to happen). We will have already checked the required keys to actually do the lookup in the provider, which serves the "required" key purpose. Changes to libvirt-cim to follow shortly...
Signed-off-by: Dan Smith <danms@us.ibm.com>
I think this is a good compromise - looks good. +1
I agree to Kaitlin, that this is a good compromise. I had discussions with some CIM specialists and we concluded that currently a strict definition - on how the key values have to be set and checked - can not be found in one of the DMTF Spec's. The only clear statement is, that the sum of all key properties form the unique instance identifier. An agreement was also, that the provider should only accept these object paths (in regard to the number of key properties and their values), that the provider itself delivers via an enumeration. The current implementation includes the - more academical - possibility that a client generates an object path by itself, which is definitely a controversial and not recommended approach. This is not problematic as long as the client takes care of all key properties. Only the case that key properties are not handed over by the client breaks interoperability. But this could be fixed by a slight switch in the cu_compare_ref() function. Instead of getting the key count out of the reference it could be retrieved out of the instance : diff -r 6f09834081cf instance_util.c --- a/instance_util.c Mon Nov 12 11:03:04 2007 -0800 +++ b/instance_util.c Tue Nov 13 12:36:24 2007 +0100 @@ -118,8 +118,13 @@ const char *cu_compare_ref(const CMPIObj CMPIStatus s; int count; const char *prop = NULL; + CMPIObjectPath *op; - count = CMGetKeyCount(ref, &s); + op = CMGetObjectPath(inst, &s); + if ((op == NULL) || (s.rc != CMPI_RC_OK)) + return NULL; + + count = CMGetKeyCount(op, &s); if (s.rc != CMPI_RC_OK) { CU_DEBUG("Unable to get key count"); return NULL; The reason why the CIMOMs do not check the key properties (and accept not set key properties ) might be, that no CIM spec does definitely clarify the responsibilities here. So the CIMOM hands it over to the provider. Which makes sense as the provider is the one with the implementation logic for the key generation and always needs a way to identify its real instances out of a given object path. -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck@linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294