All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxenlight: write stubdoms logs to file
@ 2009-12-01 16:32 Stefano Stabellini
  0 siblings, 0 replies; only message in thread
From: Stefano Stabellini @ 2009-12-01 16:32 UTC (permalink / raw)
  To: xen-devel

Hi all,
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>

---

diff -r ab27d93cf622 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Dec 01 16:10:04 2009 +0000
+++ b/tools/libxl/libxl.c	Tue Dec 01 16:17:48 2009 +0000
@@ -1352,7 +1352,16 @@
             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) {
diff -r ab27d93cf622 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Dec 01 16:10:04 2009 +0000
+++ b/tools/libxl/libxl_utils.c	Tue Dec 01 16:17:48 2009 +0000
@@ -185,7 +185,7 @@
 {
     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;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-01 16:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-01 16:32 [PATCH] libxenlight: write stubdoms logs to file Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.