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

[Xen-changelog] [xen-unstable] xend: open qemu-dm logfile in append mode if log rotation is disabled by config.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1214906349 -3600
# Node ID 763c32fdbd13111cfc0f5eca0d858ff3d5732207
# Parent  20966aa897390b622fd0d4286dc812a09450eb8c
xend: open qemu-dm logfile in append mode if log rotation is disabled by config.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/image.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -r 20966aa89739 -r 763c32fdbd13 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Tue Jul 01 10:58:43 2008 +0100
+++ b/tools/python/xen/xend/image.py    Tue Jul 01 10:59:09 2008 +0100
@@ -380,8 +380,10 @@ class ImageHandler:
         self.logfile = "/var/log/xen/qemu-dm-%s.log" %  
str(self.vm.info['name_label'])
 
         # rotate log
+        logfile_mode = os.O_WRONLY|os.O_CREAT|os.O_APPEND
         logrotate_count = XendOptions.instance().get_qemu_dm_logrotate_count()
         if logrotate_count > 0:
+            logfile_mode |= os.O_TRUNC
             if os.path.exists("%s.%d" % (self.logfile, logrotate_count)):
                 os.unlink("%s.%d" % (self.logfile, logrotate_count))
             for n in range(logrotate_count - 1, 0, -1):
@@ -392,7 +394,7 @@ class ImageHandler:
                 os.rename(self.logfile, self.logfile + ".1")
 
         null = os.open("/dev/null", os.O_RDONLY)
-        logfd = os.open(self.logfile, 
os.O_WRONLY|os.O_CREAT|os.O_TRUNC|os.O_APPEND)
+        logfd = os.open(self.logfile, logfile_mode)
         
         sys.stderr.flush()
         pid = os.fork()

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


 


Rackspace

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