diff options
author | Ian Jackson <ian.jackson@eu.citrix.com> | 2012-05-17 14:45:42 +0100 |
---|---|---|
committer | Ian Jackson <ian.jackson@eu.citrix.com> | 2012-05-17 14:45:42 +0100 |
commit | 2ea83794a601c3598dec43443a18863c7ac1317f (patch) | |
tree | 46016cd6c78a644351f0418dcb4e6b3cdac2662d /tools/libxl/xl_cmdimpl.c | |
parent | a836d6543e0b417e147f01950e4fccfdc87fc449 (diff) | |
download | xen-2ea83794a601c3598dec43443a18863c7ac1317f.tar.gz xen-2ea83794a601c3598dec43443a18863c7ac1317f.tar.bz2 xen-2ea83794a601c3598dec43443a18863c7ac1317f.zip |
libxl, xl: fix bootloader immediate console attach
Fix bugs related to console handling:
* In libxl_primary_console_exec, if libxl__domain_type fails, do
not abort, but instead log and return an error. This can occur
if the domid is invalid.
* In xl's autoconnect_console, rename the ctx formal parameter so
that when postfork creates a new ctx and puts it in the global ctx,
we don't end up using the old one (via the formal parameter which
has shadowed the global).
* In xl's autoconnect_console, pass the domid from the event
to libxl_primary_console_exec, rather than using the global domid
(which has not yet been set, since it is only set at completion
of the ao).
This causes xl create -c to once more work with pygrub.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/xl_cmdimpl.c')
-rw-r--r-- | tools/libxl/xl_cmdimpl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 38c572674a..a3201dd0b7 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1496,9 +1496,11 @@ static int freemem(libxl_domain_build_info *b_info) return ERROR_NOMEM; } -static void autoconnect_console(libxl_ctx *ctx, libxl_event *ev, void *priv) +static void autoconnect_console(libxl_ctx *ctx_ignored, + libxl_event *ev, void *priv) { pid_t *pid = priv; + uint32_t bldomid = ev->domid; libxl_event_free(ctx, ev); @@ -1512,7 +1514,7 @@ static void autoconnect_console(libxl_ctx *ctx, libxl_event *ev, void *priv) postfork(); sleep(1); - libxl_primary_console_exec(ctx, domid); + libxl_primary_console_exec(ctx, bldomid); /* Do not return. xl continued in child process */ fprintf(stderr, "Unable to attach console\n"); _exit(1); |