Kaitlin Rupert wrote:
Heidi Eckhart wrote:
> diff -r cb0e8b858f42 -r 6b1bf8231d82
> src/Virt_ResourcePoolConfigurationService.c
> --- a/src/Virt_ResourcePoolConfigurationService.c Fri Feb 01
> 11:17:15 2008 +0100
> +++ b/src/Virt_ResourcePoolConfigurationService.c Fri Feb 01
> 12:20:46 2008 +0100
> @@ -100,15 +100,20 @@ CMPIStatus rpcs_instance(const CMPIObjec
> {
> CMPIInstance *inst;
> CMPIInstance *host;
> - CMPIStatus s;
> + CMPIStatus s = {CMPI_RC_OK, NULL};
> CMPIData prop;
> + virConnectPtr conn = NULL;
> +
> + conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s);
> + if (conn == NULL)
> + goto out;
I would also set the status here. This would mean we don't need to
check for a NULL instance everywhere rpcs_instance() is called.
Well, this function
is used for enumeration and get requests. Setting an
error code for conn==NULL would break the CIM model for enumeration
request. An enumeration against CIM_RPCS on a Xen system with no KVM,
would get the error for KVM and valid instances for Xen. But this KVM
error would then cause the CIMOM to skip all returned and valid Xen
instances. In the case of a get, setting this error code indeed is required.
But the idea behind your comment is good. I will reorganize the
functions a bit and will resend the patch.
Virt_HostedService calls rpcs_instance(), but currently doesn't check
for a NULL. So if don't set the status here, HostedService will need
to be updated to check for a NULL instance.
Thanks for this hint :). I will fix this.
--
Regards
Heidi Eckhart
Software Engineer
IBM Linux Technology Center - Open Hypervisor