[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/2] libxl: preserve console tty across soft reset
On soft reset we remove the domain from xenstore and introduce it back to have everything reconnected. Console, however, stays attached (as xenconsoled checks if the domain is dying and our domain is not) but we lose the information about tty: before soft reset: console = "" ... type = "xenconsoled" output = "pty" tty = "/dev/pts/1" ... after: console = "" ... type = "xenconsoled" output = "pty" tty = "" ... The issue applies to both HVM and PVH but for HVM guests serial console through QEMU is usually in use and for PVH we don't have it. Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> --- tools/libxl/libxl_console.c | 5 ++++- tools/libxl/libxl_create.c | 8 +++++++- tools/libxl/libxl_internal.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index cbc70b7..446e766 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -316,7 +316,10 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid, flexarray_append(ro_front, "output"); flexarray_append(ro_front, console->output); flexarray_append(ro_front, "tty"); - flexarray_append(ro_front, ""); + if (state && state->console_tty) + flexarray_append(ro_front, state->console_tty); + else + flexarray_append(ro_front, ""); if (state) { flexarray_append(ro_front, "port"); diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 95fd96b..ad8a424 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1696,7 +1696,7 @@ static int do_domain_soft_reset(libxl_ctx *ctx, libxl__domain_create_state *dcs; libxl__domain_build_state *state; libxl__domain_save_state *dss; - char *dom_path, *xs_store_mfn, *xs_console_mfn; + char *dom_path, *xs_store_mfn, *xs_console_mfn, *xs_console_tty; uint32_t domid_out; int rc; @@ -1737,6 +1737,12 @@ static int do_domain_soft_reset(libxl_ctx *ctx, state->console_mfn = xs_console_mfn ? atol(xs_console_mfn): 0; free(xs_console_mfn); + xs_console_tty = xs_read(ctx->xsh, XBT_NULL, + GCSPRINTF("%s/console/tty", dom_path), + NULL); + state->console_tty = libxl__strdup(gc, xs_console_tty); + free(xs_console_tty); + dss->ao = ao; dss->domid = dss->dsps.domid = domid_soft_reset; dss->dsps.dm_savefile = GCSPRINTF(LIBXL_DEVICE_MODEL_SAVE_FILE".%d", diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 7722665..88fca8e 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1123,6 +1123,7 @@ typedef struct { uint32_t console_port; uint32_t console_domid; unsigned long console_mfn; + char *console_tty; char *saved_state; -- 2.9.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |