[libvirt] [PATCH 07/12] vcpu: make old API trivially wrap to new API

Eric Blake eblake at redhat.com
Fri Oct 1 15:28:46 UTC 2010


On 10/01/2010 09:26 AM, Matthias Bolte wrote:
>> @@ -2392,6 +2393,11 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
>>      esxVI_ManagedObjectReference *task = NULL;
>>      esxVI_TaskInfoState taskInfoState;
>>
>> +    if (flags != VIR_DOMAIN_VCPU_ACTIVE) {
>> +        ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
>> +        return -1;
>> +    }
>> +
>
> Why not use virCheckFlags here?

virCheckFlags is useful for the maximal set of permitted flags, 
regardless of whether they are set or cleared.  This instance was going 
for zero semantic change, therefore we expect an exact flag set.  At 
which point, checking for the exact flag is easier than checking for all 
supported flags and then an exact flag check.

See patch 11/12 for an example of how qemu replaces an exact flag check 
with virCheckFlags when we finally add real support for all flag 
combinations.  The same thing can be done for esx when (and if) we 
figure out how to support all flag combinations.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list