ia64/xen-unstable

changeset 17933:763c32fdbd13

xend: open qemu-dm logfile in append mode if log rotation is disabled by config.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jul 01 10:59:09 2008 +0100 (2008-07-01)
parents 20966aa89739
children 73a4fbdfe0c4
files tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/python/xen/xend/image.py	Tue Jul 01 10:58:43 2008 +0100
     1.2 +++ b/tools/python/xen/xend/image.py	Tue Jul 01 10:59:09 2008 +0100
     1.3 @@ -380,8 +380,10 @@ class ImageHandler:
     1.4          self.logfile = "/var/log/xen/qemu-dm-%s.log" %  str(self.vm.info['name_label'])
     1.5  
     1.6          # rotate log
     1.7 +        logfile_mode = os.O_WRONLY|os.O_CREAT|os.O_APPEND
     1.8          logrotate_count = XendOptions.instance().get_qemu_dm_logrotate_count()
     1.9          if logrotate_count > 0:
    1.10 +            logfile_mode |= os.O_TRUNC
    1.11              if os.path.exists("%s.%d" % (self.logfile, logrotate_count)):
    1.12                  os.unlink("%s.%d" % (self.logfile, logrotate_count))
    1.13              for n in range(logrotate_count - 1, 0, -1):
    1.14 @@ -392,7 +394,7 @@ class ImageHandler:
    1.15                  os.rename(self.logfile, self.logfile + ".1")
    1.16  
    1.17          null = os.open("/dev/null", os.O_RDONLY)
    1.18 -        logfd = os.open(self.logfile, os.O_WRONLY|os.O_CREAT|os.O_TRUNC|os.O_APPEND)
    1.19 +        logfd = os.open(self.logfile, logfile_mode)
    1.20          
    1.21          sys.stderr.flush()
    1.22          pid = os.fork()