|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] xend deprecation
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@xxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxx>
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@xxxxxxxxxx>
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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |