From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@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: xend deprecation
Date: Mon, 21 Oct 2013 16:33:25 +0100 [thread overview]
Message-ID: <1382369605.1657.37.camel@hastur.hellion.org.uk> (raw)
In-Reply-To: <20131021140953.GB1410@zion.uk.xensource.com>
On Mon, 2013-10-21 at 15:09 +0100, Wei Liu wrote:
> > - No status in xl list -l when only dom0 is present.
>
> This would not work because there is no config file for Dom0.
I sent a PoC patch which adds the content of libxl_dominfo (ie. the
runtime info) to the listing alongside the domain config. For dom0 only
the runtime info is included, but that is what is needed here.
> > - 'xl list -l' says 'Domain name must be specified' even though the '-l'
> > is for 'Output all VM details'
>
> Haven't traced this one down, but I presume this is caused by the same
> thing.
Yes, I think dom0 can be special cased to only care about libxl_dominfo
and not libxl_domain_config. I think I might have included that in the
PoC.
I thought I'd added a bug to track the thread with that PoC in it, but
apparently not. See the subthread starting at
<1378990329.10076.54.camel@kazak.uk.xensource.com>
I thought I'd posted the tty thing too, apparently not. It was like this
and hooked into the patch above to actually get printed.
Ian.
commit 4cffdf9517c668a176f37fa58236f4eb2fd4bbb0
Author: Ian Campbell <ian.campbell@citrix.com>
Date: Thu Sep 12 14:41:06 2013 +0100
libxl: expose the POV console tty in the dominfo.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 1bce4bb..8dea15f 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -510,9 +510,12 @@ int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid,
return 0;
}
-static void xcinfo2xlinfo(const xc_domaininfo_t *xcinfo,
+static void xcinfo2xlinfo(libxl__gc *gc,
+ const xc_domaininfo_t *xcinfo,
libxl_dominfo *xlinfo)
{
+ libxl_dominfo_init(xlinfo);
+
memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t));
xlinfo->domid = xcinfo->domain;
xlinfo->ssidref = xcinfo->ssidref;
@@ -539,10 +542,17 @@ static void xcinfo2xlinfo(const xc_domaininfo_t *xcinfo,
xlinfo->cpupool = xcinfo->cpupool;
xlinfo->domain_type = (xcinfo->flags & XEN_DOMINF_hvm_guest) ?
LIBXL_DOMAIN_TYPE_HVM : LIBXL_DOMAIN_TYPE_PV;
+
+ if (xcinfo->domaindomid && libxl_console_get_tty(CTX, xcinfo->domain, 0,
+ LIBXL_CONSOLE_TYPE_PV,
+ &xlinfo->console_tty) < 0)
+ LOG(WARN, "unable to get dom%d pv console tty\n", xcinfo->domain);
+
}
libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain_out)
{
+ GC_INIT(ctx);
libxl_dominfo *ptr;
int i, ret;
xc_domaininfo_t info[1024];
@@ -551,38 +561,46 @@ libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain_out)
ptr = calloc(size, sizeof(libxl_dominfo));
if (!ptr) {
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "allocating domain info");
- return NULL;
+ goto err;
}
ret = xc_domain_getinfolist(ctx->xch, 0, 1024, info);
if (ret<0) {
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
free(ptr);
- return NULL;
+ ptr = NULL;
+ goto err;
}
for (i = 0; i < ret; i++) {
- xcinfo2xlinfo(&info[i], &ptr[i]);
+ xcinfo2xlinfo(gc, &info[i], &ptr[i]);
}
*nb_domain_out = ret;
+err:
+ GC_FREE;
return ptr;
}
int libxl_domain_info(libxl_ctx *ctx, libxl_dominfo *info_r,
- uint32_t domid) {
+ uint32_t domid)
+{
+ GC_INIT(ctx);
xc_domaininfo_t xcinfo;
- int ret;
+ int ret, rc = ERROR_INVAL;
ret = xc_domain_getinfolist(ctx->xch, domid, 1, &xcinfo);
if (ret<0) {
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
return ERROR_FAIL;
}
- if (ret==0 || xcinfo.domain != domid) return ERROR_INVAL;
+ if (ret==0 || xcinfo.domain != domid) goto err;;
if (info_r)
- xcinfo2xlinfo(&xcinfo, info_r);
- return 0;
+ xcinfo2xlinfo(gc, &xcinfo, info_r);
+ rc = 0;
+err:
+ GC_FREE;
+ return rc;
}
static int cpupool_info(libxl__gc *gc,
@@ -3764,7 +3782,7 @@ retry_transaction:
abort_transaction = 1;
goto out;
}
- xcinfo2xlinfo(&info, &ptr);
+ xcinfo2xlinfo(gc, &info, &ptr);
uuid = libxl__uuid2string(gc, ptr.uuid);
libxl__xs_write(gc, t, libxl__sprintf(gc, "/vm/%s/memory", uuid),
"%"PRIu32, new_target_memkb / 1024);
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 10f95f4..6de305b 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -200,6 +200,8 @@ libxl_dominfo = Struct("dominfo",[
("shutdown", bool),
("dying", bool),
+ ("console_tty", string),
+
# Valid iff (shutdown||dying).
#
# Otherwise set to a value guaranteed not to clash with any valid
next prev parent reply other threads:[~2013-10-21 15:33 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
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 [this message]
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=1382369605.1657.37.camel@hastur.hellion.org.uk \
--to=ian.campbell@citrix.com \
--cc=George.Dunlap@eu.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=wei.liu2@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).