[Libvirt-cim] [PATCH 1 of 2] RPCC: returns instances of Xen on a KVM only system

Jay Gagnon grendel at linux.vnet.ibm.com
Fri Feb 1 16:34:03 UTC 2008


Kaitlin Rupert wrote:
> Heidi Eckhart wrote:
>> # HG changeset patch
>> # User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
>> # Date 1201865505 -3600
>> # Node ID d4b86a39d55d2208c5f56a6666ccc212ab60a240
>> # Parent  6b1bf8231d82f51f25ac3d954b63962bfc7484c9
>> RPCC: returns instances of Xen on a KVM only system
>>
>> This breaks the approach that is used all over libvirt-cim
>> providers, where only instances of the currently supported
>> hypervisor type are returned.
>>
>> Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>
>>
>> diff -r 6b1bf8231d82 -r d4b86a39d55d
>> src/Virt_ResourcePoolConfigurationCapabilities.c
>> --- a/src/Virt_ResourcePoolConfigurationCapabilities.c    Fri Feb 01
>> 12:20:46 2008 +0100
>> +++ b/src/Virt_ResourcePoolConfigurationCapabilities.c    Fri Feb 01
>> 12:31:45 2008 +0100
>> @@ -51,28 +51,39 @@ static CMPIStatus get_rpc_cap(const CMPI
>>                                const CMPIObjectPath *reference,
>>                                CMPIInstance **_inst)
>>  {
>> -        CMPIInstance *inst;
>> +        CMPIStatus s = {CMPI_RC_OK, NULL};
>> +        CMPIInstance *inst = NULL;
>> +        virConnectPtr conn = NULL;
>> +
>> +        conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s);
>> +        if (conn == NULL)
>> +                goto out;
>
> Not sure if everyone will agree, but would it be a good idea to set an
> error status here?
>
> Currently, only Virt_ResourcePoolConfigurationCapabilities is calling
> this function, but I think that's a potential bug. 
> ElementCapabilities doesn't support this Capabilities class, but I
> think it should based on the ResourceAllocation profile.
>
> Of course, that's a subject of a different patch.  However, if we set
> the status here, then ElementCapabilities won't have to worry about
> checking whether the instance is NULL.
I think this might be one of those places where setting a negative
status could cause an error code to filter up to the CIMOM when we don't
want it to.  Something like the distinction between "CMPI_RC_ERR" and
"CMPI_RC_NOT_FOUND" or whatever that was.

-- 

-Jay




More information about the Libvirt-cim mailing list