[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] DomU suspension/hibernation

Ian C,

On Wed, Jun 19, 2013 at 8:16 AM, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
On Wed, 2013-06-19 at 13:57 +0100, Ian Murray wrote:
> I think I have this sorted now. The JSON "{" that is used to signify
> the start of domain data is preceeded with 4 spaces in the xl list -l
> output. Add those four spaces into the regex (needs to be exact
> otherwise there will be more unwanted matches, I think) and put quotes
> around the variable in the grep statement(s) and it works for me... so
> a 5 line patch or so.

Thanks, that sounds "good" (as in the best we can do within the confines
of parsing JSON In shell...)

I don't think this commit went into 4.2:
        commit ac963eb7895b8351017bb6005505c2b176202f0e
        Author: Ian Campbell <ian.campbell@xxxxxxxxxx>
        Date:   Thu Aug 23 19:12:28 2012 +0100

            xl: make "xl list -l" proper JSON

            Bastian Blank reports that the output of this command is just multiple
            JSON objects concatenated and is not a single properly formed JSON

            Fix this by wrapping in an array. This turned out to be a bit more
            intrusive than I was expecting due to the requirement to keep
            supporting the SXP output mode.

            Python's json module is happy to parse the result...

            Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
            Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

but it is in 4.3, I can't remember if it added any extra indentation or
whatever but could you try it?

> I will do more testing tonight and get a patch together if you are
> comfortable with the above in principle.
> There is still an issue with xl list -l giving bogus domid's when
> using sxp format, but that's for another day. Maybe that is fixed in
> 4.3 already.

This is an odd one, this sort of thing is sometimes down to a tools vs.
hypervisor mismatch but if other stuff is working (like
starting/stopping/suspending domains) then that doesn't seem very

Looking at the diff from 4.2 to 4.3 this line in 4.2 looks very
        if (default_output_format == OUTPUT_FORMAT_JSON)
            s = printf_info_one_json(hand, info[i].domid, &d_config);
            printf_info_sexp(domid, &d_config);

(note domid in one case, info[i].domid in the other). This ties in
slightly with this fix, which I think is post 4.2, in terms of the
confusion arising from using the global domid (which is likely
not-initialised in this context):

        commit a73a7a0c647a9a5e30d8bc473c0a1e8648817183
        Author: Ian Campbell <ian.campbell@xxxxxxxxxx>
        Date:   Mon Sep 17 11:17:02 2012 +0100

            xl: Remove global domid and enable -Wshadow

            Lots of functions loop over a list of domain and others take a domid as
            a parameter, shadowing the global one and leading to all sorts of

            Therefore remove the global domid and explicitly pass it around as

            Adds a domid to the parameters for many functions and switches many
            others from taking a char * domain specifier to taking a domid, pushing
            the domid lookup to the toplevel.

            Replaces some open-coded domain_qualifier_to_domid error checking with

            Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
            Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
            [ ijc -- annotate find_domain() with warn_unused_result and fix the
                     handful of errors. ]
            Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

I don't think we want to backport that whole thing but the hunk:
        @@ -2808,7 +2805,7 @@ static void list_domains_details(const libxl_dominfo *inf
                 if (default_output_format == OUTPUT_FORMAT_JSON)
                     s = printf_info_one_json(hand, info[i].domid, &d_config);
        -            printf_info_sexp(domid, &d_config);
        +            printf_info_sexp(info[i].domid, &d_config);

Looks like a good candidate. Can you give it a go?


  I just edited xl_cmdimpl.c by hand with the hunk listed in your email. I can confirm that "xl list -l" now gives a valid domain id for each domain loaded, when outputting in sxp format.


Xen-users mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.