[PATCH] Update CS and VSMS for compare_ref changes

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1194453696 28800 # Node ID 55d37343f11204b02dde1df910001e8021a5afc5 # Parent 704edab17bc7ceac8a0d59285cf7bfb3c900b188 Update CS and VSMS for compare_ref changes Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 704edab17bc7 -r 55d37343f112 src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Mon Nov 05 11:12:26 2007 -0800 +++ b/src/Virt_ComputerSystem.c Wed Nov 07 08:41:36 2007 -0800 @@ -379,12 +379,7 @@ static CMPIStatus get_domain(const CMPIO CMPIInstance *inst[2] = {NULL, NULL}; CMPIStatus s; virConnectPtr conn = NULL; - const struct cu_property *prop; - static struct cu_property props[] = { - {"CreationClassName", 0}, - {"Name", 1}, - {NULL, 0} - }; + const char *prop = NULL; conn = lv_connect(_BROKER, &s); if (conn == NULL) @@ -398,11 +393,11 @@ static CMPIStatus get_domain(const CMPIO goto out; } - prop = cu_compare_ref(reference, inst[0], props); + prop = cu_compare_ref(reference, inst[0]); if (prop != NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", prop->name); + "No such instance (%s)", prop); goto out; } diff -r 704edab17bc7 -r 55d37343f112 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Nov 05 11:12:26 2007 -0800 +++ b/src/Virt_VirtualSystemManagementService.c Wed Nov 07 08:41:36 2007 -0800 @@ -1030,24 +1030,17 @@ static CMPIStatus GetInstance(CMPIInstan { CMPIInstance *inst; CMPIStatus s; - const struct cu_property *prop; - static struct cu_property props[] = { - {"CreationClassName", 0}, - {"SystemName", 0}, - {"SystemCreationClassName", 0}, - {"Name", 1}, - {NULL, 0} - }; + const char *prop; s = _get_vsms(ref, &inst, 0); if (s.rc != CMPI_RC_OK) return s; - prop = cu_compare_ref(ref, inst, props); + prop = cu_compare_ref(ref, inst); if (prop != NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", prop->name); + "No such instance (%s)", prop); } else { CMSetStatus(&s, CMPI_RC_OK); CMReturnInstance(results, inst);

Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1194453696 28800 # Node ID 55d37343f11204b02dde1df910001e8021a5afc5 # Parent 704edab17bc7ceac8a0d59285cf7bfb3c900b188 Update CS and VSMS for compare_ref changes
Signed-off-by: Dan Smith <danms@us.ibm.com>
- prop = cu_compare_ref(ref, inst, props); + prop = cu_compare_ref(ref, inst); if (prop != NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_NOT_FOUND, - "No such instance (%s)", prop->name); + "No such instance (%s)", prop); } else { CMSetStatus(&s, CMPI_RC_OK); CMReturnInstance(results, inst);
I realized I already ack'ed the cu_compare_ref(), but here I realized that you're returning prop from cu_compare_ref(). prop is only meaningful when it's NULL - that is, in the case of an error. Otherwise, you're just returning the last prop in the list. Would a status value be more useful? -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com

KR> I realized I already ack'ed the cu_compare_ref(), but here I KR> realized that you're returning prop from cu_compare_ref(). prop KR> is only meaningful when it's NULL - that is, in the case of an KR> error. Otherwise, you're just returning the last prop in the KR> list. Would a status value be more useful? No, we're returning the first property name that failed the test, NULL if they all passed. This, as in the case of this patch, lets the provider do what it wishes for reporting. Right now, I put that in the status message we send back to the client. I want a rich error message potential without having to pass a broker pointer around, which is why I did it this way. If you use this function to compare a reference to an instance for something other than a GetInstance scenario, you might be interested in just the name of the property that failed, and not just a CMPIStatus you could return to the client. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert