[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 7/7] systemd: add support initial xen systemd service files



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>

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@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Jan RÄkorajski <baggins@xxxxxxxxxxxxx>
Cc: M A Young <m.a.young@xxxxxxxxxxxx>
Cc: Jacek Konieczny <jajcus@xxxxxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx>
---
 .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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.