Attached are

three patches to fix a problem with Xend starting consoled.  consoled 
depends on xenstored to be running and xenstored is started on demand in 
Xend.  The patches change xenstored to manage its own pidfile, and have 
xend start actually start up xenstored.
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2005-08-04 18:51:55 +00:00
1 parent 55b7c09016
commit 1126965540
3 files changed
+29 -35

No files matched your search

-33
View File
@@ -126,12 +126,8 @@ class Daemon:
def cleanup_xend(self, kill=False):
return self.cleanup_process(XEND_PID_FILE, "xend", kill)
def cleanup_xenstored(self, kill=False):
return self.cleanup_process(XENSTORED_PID_FILE, "xenstored", kill)
def cleanup(self, kill=False):
self.cleanup_xend(kill=kill)
#self.cleanup_xenstored(kill=kill)
def status(self):
"""Returns the status of the xend daemon.
@@ -168,31 +164,6 @@ class Daemon:
pidfile.close()
return pid
def start_xenstored(self):
"""Fork and exec xenstored, writing its pid to XENSTORED_PID_FILE.
"""
def mkdirs(p):
try:
os.makedirs(p)
except:
pass
mkdirs(XENSTORED_RUN_DIR)
mkdirs(XENSTORED_LIB_DIR)
pid = self.fork_pid(XENSTORED_PID_FILE)
if pid:
# Parent
log.info("Started xenstored, pid=%d", pid)
else:
# Child
if XEND_DAEMONIZE:
self.daemonize()
if XENSTORED_DEBUG:
os.execl("/usr/sbin/xenstored", "xenstored", "--no-fork",
"-T", "/var/log/xenstored-trace.log")
else:
os.execl("/usr/sbin/xenstored", "xenstored", "--no-fork")
def daemonize(self):
if not XEND_DAEMONIZE: return
# Detach from TTY.
@@ -223,15 +194,11 @@ class Daemon:
4 Insufficient privileges
"""
xend_pid = self.cleanup_xend()
xenstored_pid = self.cleanup_xenstored()
if self.set_user():
return 4
os.chdir("/")
if xenstored_pid == 0:
self.start_xenstored()
if xend_pid > 0:
# Trying to run an already-running service is a success.
return 0
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.