[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] libxenlight: write stubdoms logs to file



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@xxxxxxxxxxxxx>

---

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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.