From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: xen-devel@lists.xenproject.org
Cc: "Ian Campbell" <ian.campbell@citrix.com>,
"Stefano Stabellini" <stefano.stabellini@eu.citrix.com>,
"Luis R. Rodriguez" <mcgrof@suse.com>,
"Jan Rękorajski" <baggins@pld-linux.org>,
"Ian Jackson" <ian.jackson@eu.citrix.com>,
"Jacek Konieczny" <jajcus@jajcus.net>,
"M A Young" <m.a.young@durham.ac.uk>
Subject: [PATCH v2 7/7] systemd: add support initial xen systemd service files
Date: Wed, 19 Mar 2014 13:58:53 -0700 [thread overview]
Message-ID: <1395262733-11885-8-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1395262733-11885-1-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@suse.com>
These are originally based on the Fedora systemd files.
Changes made:
* allow for xenstored configuration through *either* of these
configuration files:
- /etc/sysconfig/xenstored
- /etc/default/xenstored
The /etc/default/xenstored will let debian based systems do
the same, while SUSE/OpenSUSE/Fedora/RedHat can keep on chugging
with sysconfig
* generalized path meta @VARIABLES@ which are configuration specific
* uses new xenstore-read -l 30 -s prior to doing letting things rip
* defines systemd socket for xenstored
* ensures we create the run directory as most systems will likely
be using a tmpfs for run dirs for the pid files
* Some systems define the selinux context in the systemd Option for the
/var/lib/xenstored tmpfs:
Options=mode=755,context="system_u:object_r:xenstored_var_lib_t:s0"
For the upstream version we remove that and let systems specify the
context on their system /etc/default/xenstored or /etc/sysconfig/xenstored
$XENSTORED_MOUNT_CTX variable
* defines a modules-load.d for us
* takes advantage of the shared xendomains helper for the xendomains
service
* Add the new dom0 that gets kicked off for disk backend access into
its own systemd service associated to xen
We end up with these systemd files:
General requirements:
* proc-xen.mount
* var-lib-xenstored.mount
xenstored:
* xenstored.socket
* oxenstored.service
* xenconsoled.service
* xen-qemu-dom0-disk-backend.service.in
Optional:
* xendomains.service
* xen-watchdog.service
As for integration with xen, we house keep all the systemd files
under a new directory tools/hotplug/Linux/systemd/ and will be targetted
by default when building on Linux systems (CONFIG_Linux) given the low
overhead of only having to only sed the meta @VARIABLES@. The systemd
files will be sanitized for meta @VARIABLES@ upon the all make target by
default, and installed upon the install target. Systems that do not use
systemd will still have these files installed but can still just use the
old LSB init scripts; if they happen to get systemd they can easily
switch to it. The changes above only apply to systems that use systemd.
If you don't specify a prefix you will end up with the services
files under /usr/local/lib/systemd/system/ by default, and systemd
modules-load.d conf files under /usr/local/lib/modules-load.d/ which
systemd does look for (although it seems this is not documented).
Distributions are expected to provide their /usr/ prefix to end up in
the more generic location upon distribution install at
/usr/lib/systemd/system/ and /usr/lib/modules-load.d/ respectively.
Since we have a systemd socket defined for xenstored we may be able to
eventually remove our sanity check of tesing access to xenstored with
'xenstore-read -l 30 -s' but we keep it for now.
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
.gitignore | 5 ++
Config.mk | 9 ++-
Makefile | 11 +++-
config/StdGNU.mk | 4 ++
tools/hotplug/Linux/Makefile | 9 ++-
tools/hotplug/Linux/systemd/Makefile | 72 ++++++++++++++++++++++
tools/hotplug/Linux/systemd/oxenstored.service.in | 23 +++++++
tools/hotplug/Linux/systemd/proc-xen.mount.in | 9 +++
.../Linux/systemd/var-lib-xenstored.mount.in | 13 ++++
.../systemd/xen-qemu-dom0-disk-backend.service.in | 22 +++++++
.../hotplug/Linux/systemd/xen-watchdog.service.in | 13 ++++
.../Linux/systemd/xen.conf.modules-load.d.in | 16 +++++
tools/hotplug/Linux/systemd/xenconsoled.service.in | 20 ++++++
tools/hotplug/Linux/systemd/xendomains.service.in | 16 +++++
tools/hotplug/Linux/systemd/xenstored.service.in | 24 ++++++++
tools/hotplug/Linux/systemd/xenstored.socket.in | 9 +++
16 files changed, 270 insertions(+), 5 deletions(-)
create mode 100644 tools/hotplug/Linux/systemd/Makefile
create mode 100644 tools/hotplug/Linux/systemd/oxenstored.service.in
create mode 100644 tools/hotplug/Linux/systemd/proc-xen.mount.in
create mode 100644 tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
create mode 100644 tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
create mode 100644 tools/hotplug/Linux/systemd/xen-watchdog.service.in
create mode 100644 tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in
create mode 100644 tools/hotplug/Linux/systemd/xenconsoled.service.in
create mode 100644 tools/hotplug/Linux/systemd/xendomains.service.in
create mode 100644 tools/hotplug/Linux/systemd/xenstored.service.in
create mode 100644 tools/hotplug/Linux/systemd/xenstored.socket.in
diff --git a/.gitignore b/.gitignore
index db3b083..4d77d16 100644
--- a/.gitignore
+++ b/.gitignore
@@ -400,3 +400,8 @@ tools/xenstore/xenstore-watch
docs/txt/misc/*.txt
docs/txt/man/*.txt
docs/figs/*.png
+
+tools/hotplug/Linux/systemd/*.conf
+tools/hotplug/Linux/systemd/*.mount
+tools/hotplug/Linux/systemd/*.socket
+tools/hotplug/Linux/systemd/*.service
diff --git a/Config.mk b/Config.mk
index 84c558b..24f9463 100644
--- a/Config.mk
+++ b/Config.mk
@@ -153,7 +153,12 @@ endef
define buildmakevars2shellvars
export PREFIX="$(PREFIX)"; \
export XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \
- export XEN_ROOT="$(XEN_ROOT)"
+ export XEN_SYSTEMD_DIR="$(XEN_SYSTEMD_DIR)"; \
+ export XEN_SYSTEMD_MODULES_LOAD="$(XEN_SYSTEMD_MODULES_LOAD=)"; \
+ export XEN_ROOT="$(XEN_ROOT)"; \
+ export XEN_RUN_DIR="$(XEN_RUN_DIR)"; \
+ export XEN_LOG_DIR="$(XEN_LOG_DIR)"; \
+ export XEN_LIB_STORED="$(XEN_LIB_STORED)"
endef
#
@@ -174,6 +179,8 @@ define buildmakevars2file-closure
$(foreach var, \
SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \
XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
+ XEN_SYSTEMD_MODULES_LOAD \
+ XEN_SYSTEMD_DIR XEN_LOG_DIR XEN_LIB_STORED \
XEN_RUN_DIR XEN_PAGING_DIR, \
echo "$(var)=\"$($(var))\"" >>$(1).tmp;) \
$(call move-if-changed,$(1).tmp,$(1))
diff --git a/Makefile b/Makefile
index 4e48457..8f6d479 100644
--- a/Makefile
+++ b/Makefile
@@ -243,8 +243,17 @@ uninstall:
rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xen-backend.rules
rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules
rm -f $(D)$(SYSCONFIG_DIR)/xendomains
+ rm -f $(D)$(SBINDIR)/xendomains
rm -f $(D)$(SYSCONFIG_DIR)/xencommons
- rm -rf $(D)/var/run/xen* $(D)/var/lib/xen*
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/xenconsoled.service
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/xendomains.service
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/xenstored.service
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/oxenstored.service
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/xen-watchdog.service
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/proc-xen.mount
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/var-lib-xenstored.mount
+ rm -f $(D)$(XEN_SYSTEMD_MODULES_LOAD)/xen.conf
+ rm -rf $(D)${XEN_RUN_DIR}* $(D)/var/lib/xen*
make -C tools uninstall
rm -rf $(D)/boot/tboot*
diff --git a/config/StdGNU.mk b/config/StdGNU.mk
index 25fc594..70e1a40 100644
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -44,12 +44,16 @@ PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
CONFIG_DIR = /etc
XEN_LOCK_DIR = /var/lock
XEN_RUN_DIR = /var/run/xen
+XEN_LOG_DIR = /var/log/xen
+XEN_LIB_STORED = /var/lib/xenstored
XEN_PAGING_DIR = /var/lib/xen/xenpaging
SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
+XEN_SYSTEMD_DIR = $(PREFIX)/lib/systemd/system/
+XEN_SYSTEMD_MODULES_LOAD = $(PREFIX)/lib/modules-load.d/
SOCKET_LIBS =
UTIL_LIBS = -lutil
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 0be2e8a..99eb33f 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -26,6 +26,8 @@ XEN_SCRIPTS += vscsi
XEN_SCRIPTS += block-iscsi
XEN_SCRIPTS += $(XEN_SCRIPTS-y)
+SUBDIRS-y += systemd
+
XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
XEN_SCRIPT_DATA += block-common.sh
@@ -35,13 +37,13 @@ UDEV_RULES-$(CONFIG_XEND) = xend.rules
UDEV_RULES = xen-backend.rules $(UDEV_RULES-y)
.PHONY: all
-all:
+all: subdirs-all
.PHONY: build
build:
.PHONY: install
-install: all install-initd install-scripts install-udev
+install: all install-initd install-scripts install-udev subdirs-install
# See docs/misc/distro_mapping.txt for INITD_DIR location
.PHONY: install-initd
@@ -54,6 +56,7 @@ endif
$(INSTALL_PROG) $(XENDOMAINS_SBIN) $(DESTDIR)$(SBINDIR)
$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
+ ln -sf $(XENDOMAINS_SYSCONFIG) $(SBINDIR)/xendomains
$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
$(INSTALL_DATA) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
$(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)
@@ -81,4 +84,4 @@ install-udev:
done
.PHONY: clean
-clean:
+clean: subdirs-clean
diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile
new file mode 100644
index 0000000..cf898d5
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/Makefile
@@ -0,0 +1,72 @@
+XEN_ROOT = $(CURDIR)/../../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+XEN_SYSTEMD_MODULES = xen.conf
+
+XEN_SYSTEMD_MOUNT = proc-xen.mount
+XEN_SYSTEMD_MOUNT += var-lib-xenstored.mount
+
+XEN_SYSTEMD_SOCKET += xenstored.socket
+
+XEN_SYSTEMD_SERVICE = xenstored.service
+XEN_SYSTEMD_SERVICE += oxenstored.service
+XEN_SYSTEMD_SERVICE += xenconsoled.service
+XEN_SYSTEMD_SERVICE += xen-qemu-dom0-disk-backend.service
+XEN_SYSTEMD_SERVICE += xendomains.service
+XEN_SYSTEMD_SERVICE += xen-watchdog.service
+
+ALL_XEN_SYSTEMD = $(XEN_SYSTEMD_MODULES) \
+ $(XEN_SYSTEMD_MOUNT) \
+ $(XEN_SYSTEMD_SOCKET) \
+ $(XEN_SYSTEMD_SERVICE)
+
+.PHONY: all
+all: $(ALL_XEN_SYSTEMD)
+
+.PHONY: clean
+clean:
+ rm -f *.service *.mount *.conf
+
+.PHONY: install
+install: $(ALL_XEN_SYSTEMD)
+ [ -d $(DESTDIR)$(XEN_SYSTEMD_DIR) ] || \
+ $(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
+ [ -d $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD) ] || \
+ $(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
+ $(INSTALL_DATA) *.socket $(DESTDIR)$(XEN_SYSTEMD_DIR)
+ $(INSTALL_DATA) *.service $(DESTDIR)$(XEN_SYSTEMD_DIR)
+ $(INSTALL_DATA) *.mount $(DESTDIR)$(XEN_SYSTEMD_DIR)
+ $(INSTALL_DATA) *.conf $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
+
+%.socket: %.socket.in
+ cp $< $@
+ @sed -i -e 's|\@SBINDIR\@|$(SBINDIR)|g' $@
+ @sed -i -e 's|\@BINDIR\@|$(BINDIR)|g' $@
+ @sed -i -e 's|\@XEN_RUN_DIR\@|$(XEN_RUN_DIR)|g' $@
+ @sed -i -e 's|\@XEN_LOG_DIR\@|$(XEN_LOG_DIR)|g' $@
+ @sed -i -e 's|\@XEN_LIB_STORED\@|$(XEN_LIB_STORED)|g' $@
+ @sed -i -e 's|\@LIBEXEC\@|$(LIBEXEC)|g' $@
+
+%.service: %.service.in
+ cp $< $@
+ @sed -i -e 's|\@SBINDIR\@|$(SBINDIR)|g' $@
+ @sed -i -e 's|\@BINDIR\@|$(BINDIR)|g' $@
+ @sed -i -e 's|\@XEN_RUN_DIR\@|$(XEN_RUN_DIR)|g' $@
+ @sed -i -e 's|\@XEN_LOG_DIR\@|$(XEN_LOG_DIR)|g' $@
+ @sed -i -e 's|\@XEN_LIB_STORED\@|$(XEN_LIB_STORED)|g' $@
+ @sed -i -e 's|\@LIBEXEC\@|$(LIBEXEC)|g' $@
+
+%.mount: %.mount.in
+ cp $< $@
+ @sed -i -e 's|\@SBINDIR\@|$(SBINDIR)|g' $@
+ @sed -i -e 's|\@BINDIR\@|$(BINDIR)|g' $@
+ @sed -i -e 's|\@XEN_RUN_DIR\@|$(XEN_RUN_DIR)|g' $@
+ @sed -i -e 's|\@XEN_LOG_DIR\@|$(XEN_LOG_DIR)|g' $@
+ @sed -i -e 's|\@XEN_LIB_STORED\@|$(XEN_LIB_STORED)|g' $@
+ @sed -i -e 's|\@LIBEXEC\@|$(LIBEXEC)|g' $@
+
+%.conf: %.conf.modules-load.d.in
+ cp $< $@
+
+.PHONY: clean
+clean:
diff --git a/tools/hotplug/Linux/systemd/oxenstored.service.in b/tools/hotplug/Linux/systemd/oxenstored.service.in
new file mode 100644
index 0000000..f9bd272
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/oxenstored.service.in
@@ -0,0 +1,23 @@
+[Unit]
+Description=Oxenstored - ocaml version of daemon managing xenstore file system
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=proc-xen.mount var-lib-xenstored.mount
+Before=libvirtd.service libvirt-guests.service
+Conflicts=xenstored.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+Environment=XENSTORED_ARGS=
+EnvironmentFile=-/etc/default/xenstored
+EnvironmentFile=-/etc/sysconfig/xenstored
+PIDFile=@XEN_RUN_DIR@/xenstored.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
+ExecStart=@SBINDIR@/oxenstored --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
+ExecStartPost=@BINDIR@/xenstore-read -l 30 -s /
+ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/proc-xen.mount.in b/tools/hotplug/Linux/systemd/proc-xen.mount.in
new file mode 100644
index 0000000..6eb61b2
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/proc-xen.mount.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount /proc/xen files
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+What=xenfs
+Where=/proc/xen
+Type=xenfs
diff --git a/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
new file mode 100644
index 0000000..a393b06
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=mount xenstore file system
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+Environment=XENSTORED_MOUNT_CTX=
+EnvironmentFile=-/etc/sysconfig/xenstored
+EnvironmentFile=-/etc/default/xenstored
+What=xenstore
+Where=@XEN_LIB_STORED@
+Type=tmpfs
+Options=mode=755,context="$XENSTORED_MOUNT_CTX"
diff --git a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
new file mode 100644
index 0000000..39a82bc
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
@@ -0,0 +1,22 @@
+[Unit]
+Description=qemu for xen dom0 disk backend
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=proc-xen.mount xenstored.service oxenstored.service xenconsoled.service
+Before=xendomains.service libvirtd.service libvirt-guests.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+EnvironmentFile=-/etc/default/xenstored
+EnvironmentFile=-/etc/sysconfig/xenstored
+PIDFile=@XEN_RUN_DIR@/qemu-dom0.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p /var/run/xen
+ExecStart=@LIBEXEC@/qemu-system-i386 -xen-domid 0 \
+ -xen-attach -name dom0 -nographic -M xenpv -daemonize \
+ -monitor /dev/null -serial /dev/null -parallel /dev/null \
+ -pidfile @XEN_RUN_DIR@/qemu-dom0.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/xen-watchdog.service.in b/tools/hotplug/Linux/systemd/xen-watchdog.service.in
new file mode 100644
index 0000000..063fefb
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xen-watchdog.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=Xen-watchdog - run xen watchdog daemon
+Requires=proc-xen.mount
+After=proc-xen.mount xend.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/xenwatchdogd 30 15
+KillSignal=USR1
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in b/tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in
new file mode 100644
index 0000000..3fbd59b
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in
@@ -0,0 +1,16 @@
+xen-evtchn
+xen-gntdev
+xen-gntalloc
+xen-blkback
+xen-netback
+xen-pciback
+evtchn
+gntdev
+netbk
+blkbk
+xen-scsibk
+usbbk
+pciback
+xen-acpi-processor
+blktap2
+blktap
diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in
new file mode 100644
index 0000000..77c3965
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in
@@ -0,0 +1,20 @@
+[Unit]
+Description=Xenconsoled - handles logging from guest consoles and hypervisor
+Requires=proc-xen.mount
+After=proc-xen.mount xenstored.service oxenstored.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=simple
+Environment=XENCONSOLED_ARGS=
+Environment=XENCONSOLED_LOG=none
+Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console
+EnvironmentFile=-/etc/default/xenconsoled
+EnvironmentFile=-/etc/sysconfig/xenconsoled
+PIDFile=@XEN_RUN_DIR@/xenconsoled.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
+ExecStart=@SBINDIR@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/xendomains.service.in b/tools/hotplug/Linux/systemd/xendomains.service.in
new file mode 100644
index 0000000..35beeaf
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xendomains.service.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=Xendomains - start and stop guests on boot and shutdown
+Requires=proc-xen.mount
+After=proc-xen.mount xenstored.service xenconsoled.service oxenstored.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStart=-@SBINDIR@/xendomains start
+ExecStop=@SBINDIR@/xendomains stop
+ExecReload=@SBINDIR@/xendomains restart
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
new file mode 100644
index 0000000..6a45020
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xenstored.service.in
@@ -0,0 +1,24 @@
+[Unit]
+Description=Xenstored - daemon managing xenstore file system
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=proc-xen.mount var-lib-xenstored.mount
+Before=libvirtd.service libvirt-guests.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+Environment=XENSTORED_ARGS=
+Environment=XENSTORED_ROOTDIR=@XEN_LIB_STORED@
+EnvironmentFile=-/etc/default/xenstored
+EnvironmentFile=-/etc/sysconfig/xenstored
+PIDFile=@XEN_RUN_DIR@/xenstored.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb*
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
+ExecStart=@SBINDIR@/xenstored --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
+ExecStartPost=@BINDIR@/xenstore-read -l 30 -s /
+ExecStartPost=@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/xenstored.socket.in b/tools/hotplug/Linux/systemd/xenstored.socket.in
new file mode 100644
index 0000000..2091b82
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xenstored.socket.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=Xen xenstored / oxenstored Activation Socket
+
+[Socket]
+ListenStream=@XEN_LIB_STORED@/socket
+ListenStream=@XEN_LIB_STORED@/socket_ro
+
+[Install]
+WantedBy=sockets.target
--
1.9.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-03-19 20:59 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
2014-03-19 20:58 ` [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored Luis R. Rodriguez
2014-03-21 15:21 ` Ian Campbell
2014-03-21 15:22 ` Ian Jackson
2014-03-22 1:36 ` Luis R. Rodriguez
2014-03-22 1:33 ` Luis R. Rodriguez
2014-03-24 9:57 ` Ian Campbell
2014-03-21 15:40 ` David Vrabel
2014-03-21 16:01 ` Ian Campbell
2014-03-22 1:43 ` Luis R. Rodriguez
2014-03-24 10:01 ` Ian Campbell
2014-03-22 1:41 ` Luis R. Rodriguez
2014-03-19 20:58 ` [PATCH v2 2/7] xencommons: use the retry limit instead of implementing our own timeout Luis R. Rodriguez
2014-03-21 15:24 ` Ian Campbell
2014-03-19 20:58 ` [PATCH v2 3/7] tools/xendomains: make xl the default Luis R. Rodriguez
2014-03-21 15:26 ` Ian Campbell
2014-03-19 20:58 ` [PATCH v2 4/7] tools/xendomains: remove old redhat check Luis R. Rodriguez
2014-03-21 15:28 ` Ian Campbell
2014-03-22 1:56 ` Luis R. Rodriguez
2014-03-19 20:58 ` [PATCH v2 5/7] tools/xendomains: do space cleanups Luis R. Rodriguez
2014-03-21 15:29 ` Ian Campbell
2014-03-19 20:58 ` [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper Luis R. Rodriguez
2014-03-19 22:03 ` Olaf Hering
2014-03-22 2:00 ` Luis R. Rodriguez
2014-03-21 15:34 ` Ian Campbell
2014-03-22 2:17 ` Luis R. Rodriguez
2014-03-24 10:09 ` Ian Campbell
2014-04-28 5:11 ` Luis R. Rodriguez
2014-04-28 9:15 ` Ian Campbell
2014-04-28 10:47 ` Luis R. Rodriguez
2014-03-19 20:58 ` Luis R. Rodriguez [this message]
2014-03-19 21:05 ` [PATCH v2 7/7] systemd: add support initial xen systemd service files Luis R. Rodriguez
2014-03-21 10:08 ` Ian Campbell
2014-03-22 2:26 ` Luis R. Rodriguez
2014-03-24 10:11 ` Ian Campbell
2014-03-24 16:36 ` Luis R. Rodriguez
2014-04-28 5:12 ` Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395262733-11885-8-git-send-email-mcgrof@do-not-panic.com \
--to=mcgrof@do-not-panic.com \
--cc=baggins@pld-linux.org \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jajcus@jajcus.net \
--cc=m.a.young@durham.ac.uk \
--cc=mcgrof@suse.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).