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>
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) {
{
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;
}