[libvirt] [PATCH 11/19] util: new functions virNetDev(Save|Read|Set)NetConfig()

Daniel P. Berrange berrange at redhat.com
Fri Mar 17 14:50:38 UTC 2017


On Fri, Mar 17, 2017 at 03:40:33PM +0100, Michal Privoznik wrote:
> On 03/17/2017 02:58 PM, Laine Stump wrote:
> > 
> > Why JSON rather than XML though? I don't have a real preference over one
> > or the other, but libvirt lore is *steeped* in XML, and all the other
> > libvirt config files are XML...
> 
> As discussed on IRC, I can write the code to save/parse the JSON here.
> You've done your part. However, I'm not sure I will manage to make it happen
> today, but maybe beginning of the next week if that is okay with you.
> 
> And for the future reference: I prefer JSON over XML because I find it
> producing smaller files in terms of size. And also easier to read by us
> humans at a first glance. These are the reasons I've gone with JSON in NSS
> modules. Unfortunately, we have to stick with XML for out public APIs, but
> for storing some pieces of internal information, we can use other formats
> too.

Agreed, if I were starting libvirt from scratch I don't think we'd use XML,
but rather JSON / YAML in APIs. Given where we are today though, our normal
practice should be to use XML in any public APIs. For stuff not related to
public APIs, we should choose the virConf format or JSON as appropriate.
virConf if a simple flat set of data, JSON for anything needing structure

Definitely don't invent any new text formats, unless it is needed for
interoperability with a pre-existing apps we need to integrate with.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|




More information about the libvir-list mailing list