|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xl: print runtime info in "xl list -l"
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@xxxxxxxxxx>
> 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@xxxxxxxxxx>
> ---
> 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
>
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |