move xenstored from xend out into its own rc script and add xenstore sysconfig file
PATCH 22/24 move xenstored from xend out into its own rc script and add xenstore sysconfig file
This patch starts xenstore in its own rc script instead of in xend.
This creates a logical place where the user can select between a xenstore daemon running in dom0 and a xenstore stub domain.
It also makes more sense to have xenstore started seperately. Prior to this change xend started xenstored when it was first run, but would not kill it when it died. If xend was run again it would try to start xenstored again but this would fail silently as xenstored was already running. This was a bit confusing.
In order to prevent problems arising from the new rc script not being chkconfig'd "service xend start" now checks "service xenstored status" and starts xenstored if necessary.
tools/hotplug/Linux/Makefile +4 -0
@@ -2,9 +2,11 @@ include $(XEN_ROOT)/tools/Rules.mk # Init scripts. +XENSTORED_INITD = init.d/xenstored XEND_INITD = init.d/xend XENDOMAINS_INITD = init.d/xendomains XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains +XENSTORE_SYSCONFIG = init.d/sysconfig.xenstore # Xen configuration dir and configs to go there. XEN_CONFIG_DIR = /etc/xen
@@ -56,9 +58,11 @@ install-initd: [ -d $(DESTDIR)/etc/init.d ] || $(INSTALL_DIR) $(DESTDIR)/etc/init.d [ -d $(DESTDIR)/etc/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)/etc/sysconfig + $(INSTALL_PROG) $(XENSTORED_INITD) $(DESTDIR)/etc/init.d $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)/etc/init.d $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)/etc/sysconfig/xendomains + $(INSTALL_PROG) $(XENSTORE_SYSCONFIG) $(DESTDIR)/etc/sysconfig/xenstore .PHONY: install-scripts install-scripts:
tools/hotplug/Linux/init.d/xend +13 -2
@@ -8,9 +8,9 @@ # description: Starts and stops the Xen control daemon. ### BEGIN INIT INFO # Provides: xend -# Required-Start: $syslog $remote_fs +# Required-Start: $syslog $remote_fs xenstored # Should-Start: -# Required-Stop: $syslog $remote_fs +# Required-Stop: $syslog $remote_fs xenstored # Should-Stop: # Default-Start: 3 4 5 # Default-Stop: 0 1 2 6
@@ -39,6 +39,17 @@ case "$1" in start) + # Make sure xenstored is running before continuing. It was recently + # moved out to its own rc script so it may not have been chkconfig'd + if ! service xenstored status &>/dev/null ; then + echo "xend: service xenstored not running" + echo "xend: please chkconfig xenstored" + echo "xend: starting service xenstored" + service xenstored start + if [ $? -ne 0 ] ; then + exit 1 + fi + fi touch /var/lock/subsys/xend xend start await_daemons_up
tools/hotplug/Linux/init.d/xendomains +2 -2
@@ -16,9 +16,9 @@ # ### BEGIN INIT INFO # Provides: xendomains -# Required-Start: $syslog $remote_fs xend +# Required-Start: $syslog $remote_fs xenstored xend # Should-Start: -# Required-Stop: $syslog $remote_fs xend +# Required-Stop: $syslog $remote_fs xenstored xend # Should-Stop: # Default-Start: 3 4 5 # Default-Stop: 0 1 2 6
tools/hotplug/Linux/init.d/xenstored new file +152 -0
152 lines not on this page · raw message
tools/misc/xend +0 -27
@@ -81,30 +81,6 @@ if os.fork() == 0: os.execvp(daemon, (daemon,) + args) -def start_xenstored(): - pidfname = "/var/run/xenstore.pid" - try: - f = open(pidfname, "a") - try: - fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) - rootdir = os.getenv("XENSTORED_ROOTDIR") or "/var/lib/xenstored" - for i in glob.glob(rootdir + "/tdb*"): - try: - os.unlink(i) - except: - pass - os.unlink(pidfname) - except: - pass - f.close() - except: - pass - XENSTORED_TRACE = os.getenv("XENSTORED_TRACE") - cmd = "xenstored --pid-file /var/run/xenstore.pid" - if XENSTORED_TRACE: - cmd += " -T /var/log/xen/xenstored-trace.log" - s,o = commands.getstatusoutput(cmd) - def start_consoled(): XENCONSOLED_TRACE = os.getenv("XENCONSOLED_TRACE") args = ""
@@ -127,12 +103,10 @@ print 'usage: %s {start|stop|reload|restart}' % sys.argv[0] elif sys.argv[1] == 'start': if os.uname()[0] != "SunOS": - start_xenstored() start_consoled() start_blktapctrl() return daemon.start() elif sys.argv[1] == 'trace_start': - start_xenstored() start_consoled() start_blktapctrl() return daemon.start(trace=1)
@@ -141,7 +115,6 @@ elif sys.argv[1] == 'reload': return daemon.reloadConfig() elif sys.argv[1] == 'restart': - start_xenstored() start_consoled() start_blktapctrl() return daemon.stop() or daemon.start()
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel