mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxenlight: write stubdoms logs to file
It turns out that there is a better way to write stubdoms logs to file than using libxl_console_attach: qemu is the one that provides the console backend for stubdoms and qemu is able to redirect a serial to file, so we can use this feature to make sure the first stubdom console is always redirected to a logfile. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This commit is contained in:
1 parent
f20744517f
commit
07443ee6da
2 files changed
+11
-2
No files matched your search
+10
-1
@@ -1352,7 +1352,16 @@ static int libxl_build_xenpv_qemu_args(struct libxl_ctx *ctx,
|
||||
num++;
|
||||
}
|
||||
if (num > 0) {
|
||||
info->serial = "pty";
|
||||
uint32_t guest_domid = libxl_is_stubdom(ctx, vfb->domid);
|
||||
if (guest_domid) {
|
||||
char *filename;
|
||||
char *name = libxl_sprintf(ctx, "qemu-dm-%s", libxl_domid_to_name(ctx, guest_domid));
|
||||
libxl_create_logfile(ctx, name, &filename);
|
||||
info->serial = libxl_sprintf(ctx, "file:%s", filename);
|
||||
free(filename);
|
||||
} else {
|
||||
info->serial = "pty";
|
||||
}
|
||||
num--;
|
||||
}
|
||||
if (num > 0) {
|
||||
|
||||
@@ -185,7 +185,7 @@ int libxl_is_stubdom(struct libxl_ctx *ctx, int domid)
|
||||
{
|
||||
char *target = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/target", libxl_xs_get_dompath(ctx, domid)));
|
||||
if (target)
|
||||
return 1;
|
||||
return atoi(target);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||