xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Steven Noonan <snoonan@amazon.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Matt Wilson <msw@linux.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Matt Wilson <msw@amazon.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	zhigang.x.wang@oracle.com
Subject: Re: [PATCH] xl: print runtime info in "xl list -l"
Date: Wed, 25 Sep 2013 13:41:57 -0400	[thread overview]
Message-ID: <20130925174157.GA7253@phenom.dumpdata.com> (raw)
In-Reply-To: <1378990329.10076.54.camel@kazak.uk.xensource.com>

On Thu, Sep 12, 2013 at 01:52:09PM +0100, Ian Campbell wrote:
> On Wed, 2013-09-04 at 10:04 -0400, Konrad Rzeszutek Wilk wrote:
> >  - No status in xl list -l when only dom0 is present. 
> 
> Which bits of status are you interested in?

The
    (status 2)

field.
> 
> I'm thinking something like the following, which will include the
> content of libxl_dominfo for every domain.
> 
> 8<----------------------------------
> 
> >From ee9fb6c41cd53afd4983fd2e21ad0e39f178c066 Mon Sep 17 00:00:00 2001
> From: Ian Campbell <ian.campbell@citrix.com>
> Date: Thu, 12 Sep 2013 13:50:33 +0100
> Subject: [PATCH] xl: print runtime info in "xl list -l"
> 
> Include dom0 runtime information, but not domain config.

With that I get (with /etc/xen/xl.conf having output_mode=sxp)

-bash-4.1# xl list -l
dom0
no d_config
(domain
        (domid 0)
        (create_info)
        (hvm 1)
        (hap True)
        (oos <default>)
        (ssidref 0)
        (name (null))
        (uuid 00000000-0000-0000-0000-000000000000)
        (xsdata (null))
        (platformdata (null))
        (build_info)
        (max_vcpus 0)
        (tsc_mode (null))
        (max_memkb 0)
        (target_memkb 45887743)
        (nomigrate True)
        (image
                (hvm
                        (firmware )
                        (video_memkb 140277926854668)
                        (shadow_memkb 140280103390500)
                        (pae True)
                        (apic True)
                        (acpi True)
                        (nx False)
                        (viridian True)
                        (hpet False)
                        (vpt_align <default>)
                        (timer_mode (null))
                        (nestedhvm True)
                        (stdvga False)
                        (vnc <default>)
Segmentation fault

While under xm:
-bash-4.1# xm list -l
(domain
    (domid 0)
    (cpu_weight 256)
    (cpu_cap 0)
    (pool_name Pool-0)
    (bootloader '')
    (vcpus 4)
    (cpus ((0 1 2 3) (0 1 2 3) (0 1 2 3) (0 1 2 3)))
    (on_poweroff destroy)
    (on_crash restart)
    (uuid 00000000-0000-0000-0000-000000000000)
    (bootloader_args '')
    (name Domain-0)
    (on_reboot restart)
    (maxmem 6144)
    (memory 2048)
    (shadow_memory 0)
    (features '')
    (on_xend_start ignore)
    (on_xend_stop ignore)
    (cpu_time 11.138272406)
    (online_vcpus 4)
    (image (linux (kernel '') (superpages 0) (nomigrate 0) (tsc_mode 0)))
    (status 2)
    (state r-----)
)


Let me (once I am done with this email backlog) look at this and see if I
can make the segfault go away.

Thanks for the prototype!

> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
>  tools/libxl/xl_cmdimpl.c |   74 ++++++++++++++++++++++++++++------------------
>  1 file changed, 46 insertions(+), 28 deletions(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 884f050..46fdafc 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -298,7 +298,8 @@ static void dolog(const char *file, int line, const char *func, char *fmt, ...)
>  }
>  
>  static yajl_gen_status printf_info_one_json(yajl_gen hand, int domid,
> -                                            libxl_domain_config *d_config)
> +                                            libxl_domain_config *d_config,
> +                                            libxl_dominfo *d_info)
>  {
>      yajl_gen_status s;
>  
> @@ -317,13 +318,25 @@ static yajl_gen_status printf_info_one_json(yajl_gen hand, int domid,
>      if (s != yajl_gen_status_ok)
>          goto out;
>  
> -    s = yajl_gen_string(hand, (const unsigned char *)"config",
> -                        sizeof("config")-1);
> -    if (s != yajl_gen_status_ok)
> -        goto out;
> -    s = libxl_domain_config_gen_json(hand, d_config);
> -    if (s != yajl_gen_status_ok)
> -        goto out;
> +    if (d_config) {
> +        s = yajl_gen_string(hand, (const unsigned char *)"config",
> +                            sizeof("config")-1);
> +        if (s != yajl_gen_status_ok)
> +            goto out;
> +        s = libxl_domain_config_gen_json(hand, d_config);
> +        if (s != yajl_gen_status_ok)
> +            goto out;
> +    }
> +
> +    if (d_info) {
> +        s = yajl_gen_string(hand, (const unsigned char *)"info",
> +                            sizeof("info")-1);
> +        if (s != yajl_gen_status_ok)
> +            goto out;
> +        s = libxl_dominfo_gen_json(hand, d_info);
> +        if (s != yajl_gen_status_ok)
> +            goto out;
> +    }
>  
>      s = yajl_gen_map_close(hand);
>      if (s != yajl_gen_status_ok)
> @@ -350,7 +363,7 @@ static void printf_info(enum output_format output_format,
>          return;
>      }
>  
> -    s = printf_info_one_json(hand, domid, d_config);
> +    s = printf_info_one_json(hand, domid, d_config, NULL);
>      if (s != yajl_gen_status_ok)
>          goto out;
>  
> @@ -2990,7 +3003,7 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw,
>      }
>  }
>  
> -static void list_domains_details(const libxl_dominfo *info, int nb_domain)
> +static void list_domains_details(libxl_dominfo *info, int nb_domain)
>  {
>      libxl_domain_config d_config;
>  
> @@ -3017,26 +3030,31 @@ static void list_domains_details(const libxl_dominfo *info, int nb_domain)
>          s = yajl_gen_status_ok;
>  
>      for (i = 0; i < nb_domain; i++) {
> -        /* no detailed info available on dom0 */
> -        if (info[i].domid == 0)
> -            continue;
> -        rc = libxl_userdata_retrieve(ctx, info[i].domid, "xl", &data, &len);
> -        if (rc)
> -            continue;
> -        CHK_ERRNO(asprintf(&config_source, "<domid %d data>", info[i].domid));
> -        libxl_domain_config_init(&d_config);
> -        parse_config_data(config_source, (char *)data, len, &d_config, NULL);
> -        if (default_output_format == OUTPUT_FORMAT_JSON)
> -            s = printf_info_one_json(hand, info[i].domid, &d_config);
> -        else
> +        fprintf(stderr, "dom%d\n", info[i].domid);
> +
> +        if ( info[i].domid > 0 ) {
> +            fprintf(stderr, "parse d_config for dom%d\n", info[i].domid);
> +            rc = libxl_userdata_retrieve(ctx, info[i].domid, "xl", &data, &len);
> +            if (rc)
> +                continue;
> +            CHK_ERRNO(asprintf(&config_source, "<domid %d data>", info[i].domid));
> +            libxl_domain_config_init(&d_config);
> +            parse_config_data(config_source, (char *)data, len, &d_config, NULL);
> +        } else { fprintf(stderr, "no d_config\n"); }
> +        if (default_output_format == OUTPUT_FORMAT_JSON) {
> +            s = printf_info_one_json(hand, info[i].domid,
> +                                     i == 0 ? NULL : &d_config, &info[i]);
> +            if (s != yajl_gen_status_ok)
> +                goto out;
> +        } else
>              printf_info_sexp(info[i].domid, &d_config);
> -        libxl_domain_config_dispose(&d_config);
> -        free(data);
> -        free(config_source);
> -        if (s != yajl_gen_status_ok)
> -            goto out;
> -    }
>  
> +        if ( info[i].domid > 0 ) {
> +            libxl_domain_config_dispose(&d_config);
> +            free(data);
> +            free(config_source);
> +        }
> +    }
>      if (default_output_format == OUTPUT_FORMAT_JSON) {
>          s = yajl_gen_array_close(hand);
>          if (s != yajl_gen_status_ok)
> -- 
> 1.7.10.4
> 
> 
> 

  reply	other threads:[~2013-09-25 17:42 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30 23:40 [PATCH] xend: handle extended PCI configuration space when saving state Matt Wilson
2013-09-02  9:53 ` George Dunlap
2013-09-02 20:32   ` xend deprecation [Was: Re: [PATCH] xend: handle extended PCI configuration space when saving state] Matt Wilson
2013-09-03  8:03     ` Ian Campbell
2013-09-04  6:06       ` xend deprecation Matt Wilson
2013-09-04  7:29         ` Ian Campbell
2013-09-04 14:04           ` Konrad Rzeszutek Wilk
2013-09-04 15:18             ` George Dunlap
2013-09-04 15:34               ` Ian Campbell
2013-09-04 15:43                 ` Ian Jackson
2013-09-12 10:02                   ` Ian Campbell
2013-09-12 10:15                     ` Processed: " xen
2013-09-12 11:10                     ` Ian Jackson
2013-09-04 15:49                 ` Tim Deegan
2013-09-04 16:17                   ` Ian Jackson
2013-09-04 16:24                     ` Ian Campbell
2013-09-04 16:33                 ` Konrad Rzeszutek Wilk
2013-09-05  9:12                   ` George Dunlap
2013-09-06 13:36                     ` Konrad Rzeszutek Wilk
2013-09-06 13:49                       ` Ian Campbell
2013-09-06 14:01                         ` Jan Beulich
2013-09-06 14:15                           ` Ian Campbell
2013-09-05 10:18                   ` Fabio Fantoni
2013-09-05 10:27                     ` George Dunlap
2013-09-05 10:46                 ` George Dunlap
2013-09-04 16:29               ` Konrad Rzeszutek Wilk
2013-09-12 12:52             ` [PATCH] xl: print runtime info in "xl list -l" Ian Campbell
2013-09-25 17:41               ` Konrad Rzeszutek Wilk [this message]
2013-09-25 17:56                 ` Ian Campbell
2013-09-25 18:25                   ` Konrad Rzeszutek Wilk
2013-09-25 17:59                 ` Ian Campbell
2013-09-25 18:27                   ` Konrad Rzeszutek Wilk
2013-10-28 15:51                     ` Wei Liu
2013-09-12 14:02             ` xend deprecation Ian Campbell
2013-10-21 14:09             ` Wei Liu
2013-10-21 15:13               ` Zhigang Wang
2013-10-21 15:33               ` Ian Campbell
2013-10-21 15:35               ` Ian Campbell
2013-09-04 12:57         ` Stefano Stabellini
2013-09-12  9:50     ` Support for xm create -F (sxp configuration files) Ian Campbell
2013-09-12 10:00       ` Processed: " xen
2013-09-16 16:49       ` Matt Wilson
2013-11-05 14:39         ` Ian Campbell
2013-11-05 14:45           ` Processed: " xen
2013-09-03 16:33 ` [PATCH] xend: handle extended PCI configuration space when saving state Ian Campbell
2013-09-04  6:12   ` Matt Wilson
2013-09-04  6:47     ` Noonan, Steven
2013-09-04  7:30       ` Ian Campbell
2013-09-04 10:14   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130925174157.GA7253@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=msw@amazon.com \
    --cc=msw@linux.com \
    --cc=snoonan@amazon.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=zhigang.x.wang@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).