[libvirt] [PATCH 0/7] Introduce API for dumping domain IP addresses

Eric Blake eblake at redhat.com
Fri Jun 8 14:58:10 UTC 2012


On 06/08/2012 08:39 AM, Michal Privoznik wrote:

>>> This API is called virDomainInterfacesAddresses (okay, maybe
>>> too many plurals) and returns a dynamically allocated array
>>> of virDomainInterface struct. The great disadvantage once
>>> this gets released, it's written in stone and we cannot change
>>> or add an item into it. Therefore we might add a padding into
>>> it - something like reserved for future use. On the other hand,
>>> everything important is already there - what else we will want
>>> to add? :)
>>
>> How about returning an XML document instead of a struct?  We've been
>> burned by structs in the past...
> 
> If we decide to go this way, then we should return JSON which is easier
> to parse within C code. However, the most easy to use is current
> proposal IMO.

We have a history of returning XML for anything that needs to be easily
extensible.  An application compiling against libvirt.so already has to
know how to parse XML, but currently does not have to know how to parse
JSON.  I'd much rather stick with XML than make life harder for
applications to learn two formats.  I agree that XPath notation is a bit
harder than direct field access, but I think the goal of future
extensibility outweighs the goal of ease-of-representation if the
simpler representation will lock us into an API nightmare.

-- 
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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120608/65e67612/attachment-0001.sig>


More information about the libvir-list mailing list