xl: Change output from xl -N create to be more useful
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 26 Jun 2015 14:19:46 +0000 (15:19 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 3 Jul 2015 13:43:11 +0000 (14:43 +0100)
commit75be4d1965c96bf4df5940f0f90212ceeecadb34
tree617e5d85b184155191414fcb0861a470a5c92d0d
parent58072f13da55ee59a1543783cc9c9015fcb9be70
xl: Change output from xl -N create to be more useful

Currently, xl -N create produces:

    {
        "domid": null,
        "config": {
            "c_info": {
                "type": "pv",
     [etc]
    }

The domid is always NULL (as the domain has not been created at this
stage).

This is annoying if you want to take this output and use it for some
actually useful purpose like domain creation: either it needs to be
massaged, or the the consuming tool needs to be taught to look inside
the json object for the `config' element (which IMO makes no sense as
an interface).

We would like to be able to pass libxl json configs around sensibly.
In the future maybe xl will grow an option to create a domain from a
json config, and this is currently something I want to be able to have
a test tool do.

Note that this change is NOT BACKWARDS COMPATIBLE.  But it would only
adversely affects anyone who uses `xl -N create' and then saves and
processes the JSON.  (The output from xl list et al is not changed; it
normally needs the domid.)  Such a user should probably have already
have complained about the infelicitous output.  If they haven't it
would be simple enough for them to bookend the output so as to provide
compatible output.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Euan Harris <euan.harris@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Print json output to correct filehandle
    (Using newly introduced flush_stream.)
tools/libxl/xl_cmdimpl.c