From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: xen-devel@lists.xenproject.org
Cc: "Luis R. Rodriguez" <mcgrof@suse.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH] systemd: add support initial systemd service files
Date: Tue, 11 Mar 2014 17:03:13 -0700 [thread overview]
Message-ID: <1394582593-8910-1-git-send-email-mcgrof@do-not-panic.com> (raw)
From: "Luis R. Rodriguez" <mcgrof@suse.com>
I've tested these on an OpenSUSE Tumbleweed source install.
They are based on the ones from OpenSUSE but slightly modified.
In particular the xencommons systemd service file was changed
to not require the capability file to exist prior to
initialization as the xencommons service is the one that
provides it by mounting xenfs for you.
If you don't specify a prefix you will end up with the services
files under /usr/local/lib/systemd/system/ by default, which
systemd does look for. Distributions are expected to provide their
/usr/ prefix to end up in the more generic location upon distribution
install at /usr/lib/systemd/system/.
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
Config.mk | 3 ++-
Makefile | 5 ++++-
config/StdGNU.mk | 1 +
tools/hotplug/Linux/Makefile | 16 +++++++++++++++-
tools/hotplug/Linux/xen-watchdog.service | 12 ++++++++++++
tools/hotplug/Linux/xencommons.service | 12 ++++++++++++
tools/hotplug/Linux/xend.service | 14 ++++++++++++++
tools/hotplug/Linux/xendomains.service | 14 ++++++++++++++
8 files changed, 74 insertions(+), 3 deletions(-)
create mode 100644 tools/hotplug/Linux/xen-watchdog.service
create mode 100644 tools/hotplug/Linux/xencommons.service
create mode 100644 tools/hotplug/Linux/xend.service
create mode 100644 tools/hotplug/Linux/xendomains.service
diff --git a/Config.mk b/Config.mk
index 84c558b..1affbde 100644
--- a/Config.mk
+++ b/Config.mk
@@ -153,6 +153,7 @@ endef
define buildmakevars2shellvars
export PREFIX="$(PREFIX)"; \
export XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \
+ export XEN_SYSTEMD_DIR="$(XEN_SYSTEMD_DIR)"; \
export XEN_ROOT="$(XEN_ROOT)"
endef
@@ -174,7 +175,7 @@ define buildmakevars2file-closure
$(foreach var, \
SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \
XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
- XEN_RUN_DIR XEN_PAGING_DIR, \
+ XEN_SYSTEMD_DIR XEN_RUN_DIR XEN_PAGING_DIR, \
echo "$(var)=\"$($(var))\"" >>$(1).tmp;) \
$(call move-if-changed,$(1).tmp,$(1))
endef
diff --git a/Makefile b/Makefile
index 4e48457..9b5568a 100644
--- a/Makefile
+++ b/Makefile
@@ -243,7 +243,10 @@ 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)$(SYSCONFIG_DIR)/xencommons
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/xencommons.service
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/xend.service
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/xendomains.service
+ rm -f $(D)$(XEN_SYSTEMD_DIR)/xen-watchdog.service
rm -rf $(D)/var/run/xen* $(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..14b432d 100644
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -50,6 +50,7 @@ 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/
SOCKET_LIBS =
UTIL_LIBS = -lutil
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 47655f6..b2fcc2e 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -25,6 +25,11 @@ XEN_SCRIPTS += vscsi
XEN_SCRIPTS += block-iscsi
XEN_SCRIPTS += $(XEN_SCRIPTS-y)
+XEN_SYSTEMD_FILES = xend.service
+XEN_SYSTEMD_FILES += xencommons.service
+XEN_SYSTEMD_FILES += xendomains.service
+XEN_SYSTEMD_FILES += xen-watchdog.service
+
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
@@ -40,7 +45,7 @@ all:
build:
.PHONY: install
-install: all install-initd install-scripts install-udev
+install: all install-initd install-scripts install-udev install-systemd
# See docs/misc/distro_mapping.txt for INITD_DIR location
.PHONY: install-initd
@@ -69,6 +74,15 @@ install-scripts:
$(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
done
+.PHONY: install-systemd
+install-systemd:
+ [ -d $(DESTDIR)$(XEN_SYSTEMD_DIR) ] || \
+ $(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
+ set -e; for i in $(XEN_SYSTEMD_FILES); \
+ do \
+ $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SYSTEMD_DIR); \
+ done
+
.PHONY: install-udev
install-udev:
[ -d $(DESTDIR)$(UDEV_RULES_DIR) ] || \
diff --git a/tools/hotplug/Linux/xen-watchdog.service b/tools/hotplug/Linux/xen-watchdog.service
new file mode 100644
index 0000000..964a399
--- /dev/null
+++ b/tools/hotplug/Linux/xen-watchdog.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Xen-watchdog - run xen watchdog daemon
+After=xencommons.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+ExecStart=/usr/local/sbin/xenwatchdogd 30 15
+KillSignal=USR1
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/xencommons.service b/tools/hotplug/Linux/xencommons.service
new file mode 100644
index 0000000..8042b24
--- /dev/null
+++ b/tools/hotplug/Linux/xencommons.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Xencommons - Script to start and stop xenstored and xenconsoled
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=-/etc/init.d/xencommons start
+ExecStop=/etc/init.d/xencommons stop
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/xend.service b/tools/hotplug/Linux/xend.service
new file mode 100644
index 0000000..97cee20
--- /dev/null
+++ b/tools/hotplug/Linux/xend.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Xend - Starts and stops the Xen management daemon
+Before=libvirtd.service libvirt-guests.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+PIDFile=/var/run/xend.pid
+Environment=HOME=/root
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStart=/usr/sbin/xend start
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/xendomains.service b/tools/hotplug/Linux/xendomains.service
new file mode 100644
index 0000000..03158bd
--- /dev/null
+++ b/tools/hotplug/Linux/xendomains.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Xendomains - start and stop Xen VMs on boot and shutdown
+After=xencommons.service network.target
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStart=-/etc/init.d/xendomains start
+ExecStop=/etc/init.d/xendomains stop
+
+[Install]
+WantedBy=multi-user.target
--
1.9.0
next reply other threads:[~2014-03-12 0:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-12 0:03 Luis R. Rodriguez [this message]
2014-03-12 8:16 ` [PATCH] systemd: add support initial systemd service files Jacek Konieczny
2014-03-12 8:35 ` Luis R. Rodriguez
2014-03-12 9:07 ` Jacek Konieczny
2014-03-12 9:19 ` Luis R. Rodriguez
2014-03-12 11:24 ` Jan Rękorajski
2014-03-12 11:22 ` Ian Campbell
2014-03-12 19:44 ` M A Young
2014-03-12 23:43 ` Luis R. Rodriguez
2014-03-13 0:37 ` M A Young
2014-03-12 23:53 ` Luis R. Rodriguez
2014-03-13 0:01 ` M A Young
2014-03-13 0:06 ` Luis R. Rodriguez
2014-03-13 8:03 ` Jacek Konieczny
2014-03-13 9:52 ` Ian Campbell
2014-03-13 9:55 ` Jacek Konieczny
2014-03-12 11:14 ` Ian Jackson
2014-03-12 11:25 ` Ian Campbell
2014-03-12 11:42 ` Andrew Cooper
2014-03-12 18:35 ` 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=1394582593-8910-1-git-send-email-mcgrof@do-not-panic.com \
--to=mcgrof@do-not-panic.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--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).