WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] ioemu: Send logs to stderr and have xend

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] ioemu: Send logs to stderr and have xend redirect stderr to the
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Feb 2008 06:10:18 -0800
Delivery-date: Thu, 28 Feb 2008 06:10:58 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204194565 0
# Node ID e44c6b67a48315f4c0c2cbbefff0465ddb823975
# Parent  b6cda88a3da6ba3db1cb8bd9210c99d4ebfec04a
ioemu: Send logs to stderr and have xend redirect stderr to the
correct log file.

At the same time, this patch renames the logfile to be
'qemu-dm-{NAME}.log' instead of qemu-dm-{ID}.log.  This makes it
easier to track/find the QEMU logfile associated with a VM. It will
also save 1 backup qemu-dm-{NAME}.log.1 so if a domain crashes &
restart, you don't loose/overwrite the logfile immediately.

Finally it changes the QEMU monitor prompt back to '(qemu)' instead of
'(HVMXen)' because automated tools /scripts interacting with QEMU's
monitor need a consistent prompt to look for & changing it for Xen
serves no useful purpose.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 tools/ioemu/keymaps.c          |    4 ++--
 tools/ioemu/monitor.c          |    2 +-
 tools/ioemu/vl.c               |    4 +---
 tools/python/xen/xend/image.py |   29 ++++++++++++++++++++++++++++-
 4 files changed, 32 insertions(+), 7 deletions(-)

diff -r b6cda88a3da6 -r e44c6b67a483 tools/ioemu/keymaps.c
--- a/tools/ioemu/keymaps.c     Thu Feb 28 10:21:21 2008 +0000
+++ b/tools/ioemu/keymaps.c     Thu Feb 28 10:29:25 2008 +0000
@@ -126,11 +126,11 @@ static kbd_layout_t *parse_keyboard_layo
                    if (rest && strstr(rest, "numlock")) {
                        add_to_key_range(&k->keypad_range, keycode);
                        add_to_key_range(&k->numlock_range, keysym);
-                       fprintf(stderr, "keypad keysym %04x keycode %d\n", 
keysym, keycode);
+                       //fprintf(stderr, "keypad keysym %04x keycode %d\n", 
keysym, keycode);
                    }
                    if (rest && strstr(rest, "shift")) {
                        add_to_key_range(&k->shift_range, keysym);
-                       fprintf(stderr, "shift keysym %04x keycode %d\n", 
keysym, keycode);
+                       //fprintf(stderr, "shift keysym %04x keycode %d\n", 
keysym, keycode);
                    }
 
                    /* if(keycode&0x80)
diff -r b6cda88a3da6 -r e44c6b67a483 tools/ioemu/monitor.c
--- a/tools/ioemu/monitor.c     Thu Feb 28 10:21:21 2008 +0000
+++ b/tools/ioemu/monitor.c     Thu Feb 28 10:29:25 2008 +0000
@@ -2520,7 +2520,7 @@ static void monitor_handle_command1(void
 
 static void monitor_start_input(void)
 {
-    readline_start("(HVMXen) ", 0, monitor_handle_command1, NULL);
+    readline_start("(qemu) ", 0, monitor_handle_command1, NULL);
 }
 
 static void term_event(void *opaque, int event)
diff -r b6cda88a3da6 -r e44c6b67a483 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Thu Feb 28 10:21:21 2008 +0000
+++ b/tools/ioemu/vl.c  Thu Feb 28 10:29:25 2008 +0000
@@ -7611,9 +7611,7 @@ int main(int argc, char **argv)
         }
     }
 
-    /* Now send logs to our named config */
-    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm-%d.log", domid);
-    cpu_set_log_filename(qemu_dm_logfilename);
+    cpu_set_log(0);
 
 #ifndef NO_DAEMONIZE
     if (daemonize && !nographic && vnc_display == NULL && vncunused == 0) {
diff -r b6cda88a3da6 -r e44c6b67a483 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Feb 28 10:21:21 2008 +0000
+++ b/tools/python/xen/xend/image.py    Thu Feb 28 10:29:25 2008 +0000
@@ -296,7 +296,34 @@ class ImageHandler:
                         { 'dom': self.vm.getDomid(), 'read': True, 'write': 
True })
         log.info("spawning device models: %s %s", self.device_model, args)
         # keep track of pid and spawned options to kill it later
-        self.pid = os.spawnve(os.P_NOWAIT, self.device_model, args, env)
+
+        logfile = "/var/log/xen/qemu-dm-%s.log" %  
str(self.vm.info['name_label'])
+        if os.path.exists(logfile):
+            if os.path.exists(logfile + ".1"):
+                os.unlink(logfile + ".1")
+            os.rename(logfile, logfile + ".1")
+
+        null = os.open("/dev/null", os.O_RDONLY)
+        logfd = os.open(logfile, os.O_WRONLY|os.O_CREAT|os.O_TRUNC)
+        
+        pid = os.fork()
+        if pid == 0: #child
+            try:
+                os.dup2(null, 0)
+                os.dup2(logfd, 1)
+                os.dup2(logfd, 2)
+                os.close(null)
+                os.close(logfd)
+                try:
+                    os.execve(self.device_model, args, env)
+                except:
+                    os._exit(127)
+            except:
+                os._exit(127)
+        else:
+            self.pid = pid
+            os.close(null)
+            os.close(logfd)
         self.vm.storeDom("image/device-model-pid", self.pid)
         log.info("device model pid: %d", self.pid)
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] ioemu: Send logs to stderr and have xend redirect stderr to the, Xen patchbot-unstable <=