[libvirt] [PATCH 3/5] list: Implement listAllInterfaces

Eric Blake eblake at redhat.com
Wed Sep 12 13:12:17 UTC 2012


On 09/11/2012 09:05 PM, Osier Yang wrote:
>>> +
>>> +    if (VIR_ALLOC_N(names, count)<  0) {
>>> +        virReportOOMError();
>>> +        return -1;
>>> +    }
>>
>>
>> If you want to check for a race here, you could allocate count+1 items
>> in the array, then do an ncf_list_interfaces telling it the maxcount is
>> "count+1" and check to see that you really only got count items back.
> 
> No want I think, :-)
> 
> Since I will adopt your below suggestion to igore the no found interface
> by "ncf_lookup_by_name", that means we should either ignore the race, or
> raise up error earlier here.
> 
> I think ignoring is better, any objections?

If we want to use the count+1 trick to ensure things didn't grow in the
meantime, then we should do it for ALL the fallbacks when vir*ListAll is
missing, not just the network listing.  I'm okay with not checking for
truncation, as it's simpler, and as it will only affect the fallback
code which we already documented in virsh.pod as being racy.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120912/7d6face9/attachment-0001.sig>


More information about the libvir-list mailing list