ia64/xen-unstable

changeset 2539:ea88ad0fa2df

bitkeeper revision 1.1159.1.171 (41542452bRfDdWxp_J3LdHeEUSX1Nw)

Add a flag to control daemonizing xend as it seems it might
be causing some problems.
author mjw@wray-m-3.hpl.hp.com
date Fri Sep 24 13:42:42 2004 +0000 (2004-09-24)
parents 5ba3470963d4
children a8fef40fad11
files tools/python/xen/xend/server/SrvDaemon.py
line diff
     1.1 --- a/tools/python/xen/xend/server/SrvDaemon.py	Fri Sep 24 13:40:25 2004 +0000
     1.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py	Fri Sep 24 13:42:42 2004 +0000
     1.3 @@ -42,6 +42,7 @@ import console
     1.4  import domain
     1.5  from params import *
     1.6  
     1.7 +DAEMONIZE = 1
     1.8  DEBUG = 1
     1.9  
    1.10  class NotifierProtocol(protocol.Protocol):
    1.11 @@ -464,16 +465,9 @@ class Daemon:
    1.12          else:
    1.13              # Child
    1.14              os.execl("/usr/sbin/xfrd", "xfrd")
    1.15 -            
    1.16 -    def start(self, trace=0):
    1.17 -        """Attempts to start the daemons.
    1.18 -        The return value is defined by the LSB:
    1.19 -        0  Success
    1.20 -        4  Insufficient privileges
    1.21 -        """
    1.22 -        xend_pid = self.cleanup_xend()
    1.23 -        xfrd_pid = self.cleanup_xfrd()
    1.24  
    1.25 +    def daemonize(self):
    1.26 +        if not DAEMONIZE: return
    1.27          # Detach from TTY.
    1.28          os.setsid()
    1.29  
    1.30 @@ -492,7 +486,19 @@ class Daemon:
    1.31              os.open('/dev/null', os.O_RDWR)
    1.32              os.dup(0)
    1.33          os.dup(1)
    1.34 +        
    1.35 +    def start(self, trace=0):
    1.36 +        """Attempts to start the daemons.
    1.37 +        The return value is defined by the LSB:
    1.38 +        0  Success
    1.39 +        4  Insufficient privileges
    1.40 +        """
    1.41 +        xend_pid = self.cleanup_xend()
    1.42 +        xfrd_pid = self.cleanup_xfrd()
    1.43  
    1.44 +
    1.45 +        self.daemonize()
    1.46 +        
    1.47          if self.set_user():
    1.48              return 4
    1.49          os.chdir("/")