ChangeSet 1.1662.1.16, 2005/06/07 13:54:45+01:00, cl349@xxxxxxxxxxxxxxxxxxxx
params.py, SrvDaemon.py:
Add xenstored.
ignore:
Add tools/xenstore/xenstored.
Signed-off-by: Mike Wray <mike.wray@xxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
SrvDaemon.py | 31 ++++++++++++++++++++++++++++++-
params.py | 17 +++++++++++------
2 files changed, 41 insertions(+), 7 deletions(-)
diff -Nru a/tools/python/xen/xend/server/SrvDaemon.py
b/tools/python/xen/xend/server/SrvDaemon.py
--- a/tools/python/xen/xend/server/SrvDaemon.py 2005-06-09 13:08:58 -04:00
+++ b/tools/python/xen/xend/server/SrvDaemon.py 2005-06-09 13:08:58 -04:00
@@ -125,9 +125,13 @@
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.
The return value is defined by the LSB:
@@ -163,6 +167,27 @@
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 and (not XENSTORED_DEBUG):
+ self.daemonize()
+ os.execl("/usr/sbin/xenstored", "xenstored", "--no-fork")
+
def daemonize(self):
if not XEND_DAEMONIZE: return
# Detach from TTY.
@@ -193,10 +218,14 @@
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.
diff -Nru a/tools/python/xen/xend/server/params.py
b/tools/python/xen/xend/server/params.py
--- a/tools/python/xen/xend/server/params.py 2005-06-09 13:08:58 -04:00
+++ b/tools/python/xen/xend/server/params.py 2005-06-09 13:08:58 -04:00
@@ -21,9 +21,14 @@
return v
# The following parameters could be placed in a configuration file.
-XEND_PID_FILE = '/var/run/xend.pid'
-XEND_TRACE_FILE = '/var/log/xend.trace'
-XEND_DEBUG_LOG = '/var/log/xend-debug.log'
-XEND_USER = 'root'
-XEND_DEBUG = getenv("XEND_DEBUG", 0, conv=int)
-XEND_DAEMONIZE = getenv("XEND_DAEMONIZE", not XEND_DEBUG, conv=int)
+XEND_PID_FILE = '/var/run/xend.pid'
+XEND_TRACE_FILE = '/var/log/xend.trace'
+XEND_DEBUG_LOG = '/var/log/xend-debug.log'
+XEND_USER = 'root'
+XEND_DEBUG = getenv("XEND_DEBUG", 0, conv=int)
+XEND_DAEMONIZE = getenv("XEND_DAEMONIZE", not XEND_DEBUG, conv=int)
+
+XENSTORED_PID_FILE = '/var/run/xenstored.pid'
+XENSTORED_RUN_DIR = '/var/run/xenstored'
+XENSTORED_LIB_DIR = '/var/lib/xenstored'
+XENSTORED_DEBUG = getenv("XSDAEMON_DEBUG", 0, conv=int)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|