xen: add systemd support
v9 cover xen: add systemd support
From: "Luis R. Rodriguez" <[email protected]>
This is the rebase set of patches with the one hunk merged to address the xencommons script generation.
Luis R. Rodriguez (3):
xencommons: move module list into a generic place
autoconf: xen: enable explicit preference option for xenstored
preference
systemd: add xen systemd service and module files
.gitignore | 5 + Makefile | 6 +- README | 60 ++++++++ config/Linux.modules | 20 +++ config/Tools.mk.in | 6 + m4/README.source | 8 + m4/systemd.m4 | 123 +++++++++++++++ m4/xenstored.m4 | 56 +++++++ tools/configure.ac | 30 +++- tools/hotplug/Linux/Makefile | 19 ++- tools/hotplug/Linux/init.d/sysconfig.xencommons | 33 ---- tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 42 ++++++ tools/hotplug/Linux/init.d/xencommons | 167 --------------------- tools/hotplug/Linux/init.d/xencommons.in.in | 149 ++++++++++++++++++ tools/hotplug/Linux/systemd/Makefile | 67 +++++++++ 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 ++ tools/hotplug/Linux/systemd/xenconsoled.service.in | 20 +++ tools/hotplug/Linux/systemd/xendomains.service.in | 16 ++ tools/hotplug/Linux/systemd/xenstored.service.in | 27 ++++ tools/hotplug/Linux/systemd/xenstored.socket.in | 11 ++ tools/hotplug/Linux/systemd/xenstored_ro.socket.in | 11 ++ tools/hotplug/Linux/update-modules.sh | 30 ++++ tools/ocaml/xenstored/Makefile | 5 + tools/xenstore/Makefile | 6 + 27 files changed, 763 insertions(+), 211 deletions(-) create mode 100644 config/Linux.modules create mode 100644 m4/systemd.m4 create mode 100644 m4/xenstored.m4 delete mode 100644 tools/hotplug/Linux/init.d/sysconfig.xencommons create mode 100644 tools/hotplug/Linux/init.d/sysconfig.xencommons.in delete mode 100644 tools/hotplug/Linux/init.d/xencommons create mode 100644 tools/hotplug/Linux/init.d/xencommons.in.in create mode 100644 tools/hotplug/Linux/systemd/Makefile 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/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 create mode 100644 tools/hotplug/Linux/systemd/xenstored_ro.socket.in create mode 100755 tools/hotplug/Linux/update-modules.sh
Signature · 1 line
2.0.1
PATCH v9 1/3 xencommons: move module list into a generic place
From: "Luis R. Rodriguez" <[email protected]>
This will allow us to share the same module list with systemd, and lets us upkeep it in one place. Document this while at it on the top level README and expand on the wiki:
http://wiki.xen.org/wiki/Category:Host_Configuration#Kernel_modules
In order to upkeep parallelism builds be explicit about the requirement to complete all actions before any installation targets.
--- README | 12 +++ config/Linux.modules | 20 ++++ tools/hotplug/Linux/Makefile | 13 ++- tools/hotplug/Linux/init.d/xencommons | 167 ------------------------------- tools/hotplug/Linux/init.d/xencommons.in | 153 ++++++++++++++++++++++++++++ tools/hotplug/Linux/update-modules.sh | 30 ++++++ 6 files changed, 223 insertions(+), 172 deletions(-) create mode 100644 config/Linux.modules delete mode 100644 tools/hotplug/Linux/init.d/xencommons create mode 100644 tools/hotplug/Linux/init.d/xencommons.in create mode 100755 tools/hotplug/Linux/update-modules.sh
README +12 -0
@@ -183,3 +183,15 @@ There are optional targets as part of Xen's top-level makefile that will download and build tboot: install-tboot, build-tboot, dist-tboot, clean-tboot. These will download the latest tar file from the SourceForge site using wget, then build/install/dist according to Xen's settings. + +Required Kernel modules +====================== + +Xen has a set of Kernel modules which the init scripts ensure to load before +before starting Xen guests. The list of modules are maintained in one place: + + * config/$(XEN_OS).modules + +For more details refer to: + +http://wiki.xen.org/wiki/Category:Host_Configuration#Kernel_modules
config/Linux.modules new file +20 -0
@@ -0,0 +1,20 @@ +# The file supports a simple language, comments are ignored, and if you there +# are module replacements this can be listed by using a pipe to show preference +# for the first module, followed by the older module. + +xen-evtchn +xen-gntdev +xen-gntalloc +xen-blkback +xen-netback +xen-pciback +evtchn +gntdev +netbk +blkbk +xen-scsibk +usbbk +pciback +xen-acpi-processor +# Prefer to load blktap2 if found, otherwise load blktap +blktap2|blktap
tools/hotplug/Linux/Makefile +8 -5
@@ -6,7 +6,7 @@ XENDOMAINS_INITD = init.d/xendomains XENDOMAINS_LIBEXEC = xendomains XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains -XENCOMMONS_INITD = init.d/xencommons +export XENCOMMONS_INITD = init.d/xencommons XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons # Xen script dir and scripts to go there.
@@ -33,17 +33,20 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev UDEV_RULES = xen-backend.rules $(UDEV_RULES-y) .PHONY: all -all: +all: $(XENCOMMONS_INITD) + +$(XENCOMMONS_INITD): $(XEN_ROOT)/config/$(XEN_OS).modules $(XENCOMMONS_INITD).in + $(XEN_ROOT)/tools/hotplug/Linux/update-modules.sh > $@ .PHONY: build -build: +build: all .PHONY: install install: all install-initd install-scripts install-udev # See docs/misc/distro_mapping.txt for INITD_DIR location .PHONY: install-initd -install-initd: +install-initd: all [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR) [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR) [ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
@@ -55,7 +58,7 @@ install-initd: $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR) .PHONY: install-scripts -install-scripts: +install-scripts: all [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \ $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) set -e; for i in $(XEN_SCRIPTS); \
tools/hotplug/Linux/init.d/xencommons deleted +0 -167
167 lines not on this page · raw message
tools/hotplug/Linux/init.d/xencommons.in new file +153 -0
153 lines not on this page · raw message
tools/hotplug/Linux/update-modules.sh new file +30 -0
@@ -0,0 +1,30 @@ +#!/bin/bash + +set -e +IFS='' +cat $XEN_ROOT/config/${XEN_OS}.modules | ( + while read l ; do + if echo $l | egrep -q "^#" ; then + continue + fi + if echo "$l" | egrep -q "\|" ; then + m1=${l%%|*} + m2=${l#*|} + echo " modprobe $m1 2>/dev/null || modprobe $m2 2>/dev/null" + else + echo " modprobe $l 2>/dev/null" + fi + done +) > ${XENCOMMONS_INITD}.modules + +cat ${XENCOMMONS_INITD}.in | ( + while read l ; do + if echo "$l" | egrep -q "@LOAD_MODULES@" ; then + cat ${XENCOMMONS_INITD}.modules + else + echo $l + fi + done +) + +rm -f ${XENCOMMONS_INITD}.modules
Signature · 1 line
2.0.1
PATCH v9 2/3 autoconf: xen: enable explicit preference option for xenstored preference
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
As it stands oxenstored will be used by default if ocaml tools are found, the init system will also try to use oxenstored first if its found otherwise the cxenstored will be used. Lets simplify the init script and let users be explicit about the preference through configure.
This adds support to let you be explicit about the xenstored preference, you can only use one of these two options:
./configure --with-xenstored=xenstored
./configure --with-xenstored=oxenstored
We continue with the old behaviour and default oxenstored will be used but only if you have ocaml dependencies. Since the xenstored preference is explicit now and since we require configure substitutions for it we make use of the AX_XEN_EXPAND_CONFIG() helpers as otherwise substitution for SBINDIR is not propagated from the top level configuration.
All this allows us to simplify the init script to use the configured xenstore from the start. We update the sysconfig/default xencommons file with the paths for the different options though, this can be used by users to override the default xenstored, this follows the old behaviour but we now just explicitly provide the full configured paths for users.
As before, changing the xenstore requires a reboot.
In order to help with documentation we update the README with some details on configure usage refer to the wiki [0] [1] [2] for more elaborate details.
Since we are now parsing an entry within Paths.mk.in on tools we let the move the parsing of the file to be the tool's configure.
[0] http://wiki.xen.org/wiki/Xenstored
[1] http://wiki.xen.org/wiki/XenStore
[2] http://wiki.xen.org/wiki/XenStoreReference
--- README | 32 +++++ m4/xenstored.m4 | 56 ++++++++ tools/configure.ac | 19 ++- tools/hotplug/Linux/init.d/sysconfig.xencommons | 33 ----- tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 42 ++++++ tools/hotplug/Linux/init.d/xencommons.in | 153 --------------------- tools/hotplug/Linux/init.d/xencommons.in.in | 149 ++++++++++++++++++++ 7 files changed, 295 insertions(+), 189 deletions(-) create mode 100644 m4/xenstored.m4 delete mode 100644 tools/hotplug/Linux/init.d/sysconfig.xencommons create mode 100644 tools/hotplug/Linux/init.d/sysconfig.xencommons.in delete mode 100644 tools/hotplug/Linux/init.d/xencommons.in create mode 100644 tools/hotplug/Linux/init.d/xencommons.in.in
README +32 -0
@@ -129,6 +129,38 @@ performed with root privileges.] versions of those scripts, so that you can copy the dist directory to another machine and install from that distribution. +xenstore: xenstored and oxenstored +==================================== + +Xen uses a configuration database called xenstore [0] to maintain configuration +and status information shared between domains. A daemon is implemented as part +of xenstore to act as an interface for access to the database for dom0 and +guests. Two xenstored daemons are supported, one written in C which we refer +to as the xenstored (sometimes referred to as cxenstored), and another written +in Ocaml called oxenstored. Details for xenstore and the different +implementations can be found on the wiki's xenstore reference guide [1] and +the xenstored [2] page. You can choose which xenstore you want to enable as +default on a system through configure: + + ./configure --with-xenstored=xenstored + ./configure --with-xenstored=oxenstored + +By default oxenstored will be used if the ocaml development tools are found. +If you enable oxenstored the xenstored will still be built and installed, +the xenstored used can be changed through the configuration file: + +/etc/sysconfig/xencommons +or +/etc/default/xencommons + +You can change the preferred xenstored you want to use in the configuration +but since we cannot stop the daemon a reboot will be required to make the +change take effect. + +[0] http://wiki.xen.org/wiki/XenStore +[1] http://wiki.xen.org/wiki/XenStoreReference +[2] http://wiki.xen.org/wiki/Xenstored + Python Runtime Libraries ========================
m4/xenstored.m4 new file +56 -0
56 lines not on this page · raw message
tools/configure.ac +16 -3
@@ -5,7 +5,11 @@ AC_PREREQ([2.67]) AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]), [[email protected]], [xen], [http://www.xen.org/]) AC_CONFIG_SRCDIR([libxl/libxl.c]) -AC_CONFIG_FILES([../config/Tools.mk]) +AC_CONFIG_FILES([ +../config/Tools.mk +hotplug/Linux/init.d/xencommons.in +hotplug/Linux/init.d/sysconfig.xencommons +]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([../])
@@ -53,6 +57,10 @@ m4_include([../m4/ptyfuncs.m4]) m4_include([../m4/extfs.m4]) m4_include([../m4/fetcher.m4]) m4_include([../m4/ax_compare_version.m4]) +m4_include([../m4/paths.m4]) +m4_include([../m4/xenstored.m4]) + +AX_XEN_EXPAND_CONFIG() # Enable/disable options AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -203,9 +211,14 @@ AC_PROG_INSTALL AC_PATH_PROG([BISON], [bison]) AC_PATH_PROG([FLEX], [flex]) AX_PATH_PROG_OR_FAIL([PERL], [perl]) + +AC_PROG_OCAML +AC_PROG_FINDLIB + +AX_XENSTORE_OPTIONS +AX_XENSTORE_SET + AS_IF([test "x$ocamltools" = "xy"], [ - AC_PROG_OCAML - AC_PROG_FINDLIB AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [ AS_IF([test "x$enable_ocamltools" = "xyes"], [ AC_MSG_ERROR([Ocaml tools enabled, but unable to find Ocaml])])
tools/hotplug/Linux/init.d/sysconfig.xencommons deleted +0 -33
@@ -1,33 +0,0 @@ -## Path: System/Virtualization -## Type: string -## Default: "none" -# -# Log xenconsoled messages (cf xl dmesg) -#XENCONSOLED_TRACE=[none|guest|hv|all] - -## Type: string -## Default: xenstored -# -# Select xenstored implementation -#XENSTORED=[oxenstored|xenstored] - -## Type: string -## Default: Not defined, tracing off -# -# Log xenstored messages -#XENSTORED_TRACE=[yes|on|1] - -## Type: string -## Default: "/var/lib/xenstored" -# -# Running xenstored on XENSTORED_ROOTDIR -#XENSTORED_ROOTDIR=/var/lib/xenstored - -## Type: string -## Default: Not defined, xenbackendd debug mode off -# -# Running xenbackendd in debug mode -#XENBACKENDD_DEBUG=[yes|on|1] - -# qemu path -#QEMU_XEN=/usr/lib/xen/bin/qemu-system-i386
tools/hotplug/Linux/init.d/sysconfig.xencommons.in new file +42 -0
42 lines not on this page · raw message
tools/hotplug/Linux/init.d/xencommons.in deleted +0 -153
153 lines not on this page · raw message
tools/hotplug/Linux/init.d/xencommons.in.in new file +149 -0
149 lines not on this page · raw message
Signature · 1 line
2.0.1
PATCH v9 3/3 systemd: add xen systemd service and module files
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This adds the systemd xen service / module files and integrates support into the build system.
This goes in with AX_AVAILABLE_SYSTEMD() which will enable systemd if development libraries have been found on your build system. If you don't have systemd on target systems for binaries built with systemd then the binary will not work, you must explicitly disable systemd support if you do not want to build systemd support.
When systemd libraries are present only systems that have booted into systemd go through the systemd initialization, otherwise the SysVinit is used.
These are originally based on the Fedora systemd files.
Changes made from Fedora's systemd files:
* split sockets into two files to claim different permissions
* Use /bin/sh -c exec to for a simple launcher implementation
* enables systemd socket activation for C xenstored and Ocaml oxenstored
* use sd_notify(), so change the service to Type=notify, because of this we remove the PIDFile specification as we don't care for it, and let systemd do its magic for us, this also means we don't have to fork so we use --no-fork with systemd
* defines a modules-load.d, its original source file will be shared between systemd and old init systems
* simplify service files with ConditionVirtualization=xen which uses the built in systemd virtualization backend detection, these service files will not be available to start on systems that do not boot with xen as a hypervisor
* use autoconf to replace @variable@ paths for us which piggy backs on top of the latest autoconf changes to xen
* removes oxenstored service file in favor of a system variable which controls which which xentored to use at run time, we avoid multiple service files this way.
* simplifies startup to not require polling on the sockets
as initial socket management is handled by systemd, we just take on the socket later once anything pokes at it, a simple nc -U (as root) on any of the sockets files can activate the service for example. Anything queued up will be sent to us once we start. Socket activation should in theory also let us dynamically switch between xenstores but more importantly we could upgrade xenstored while keeping all active socket communication queued up, but in order to take advantage of this we eventually would need to remove the requirement of not being able to bring down the xenstored. Even though active sockets are supported since most libxl communication doesn't triggger a check on the unix socket first administrators are encouraged to enable the xenstored.service to triggger an initialization of the xenstored upon bring up. Some systems also never use unix sockets for communication with the xenstored and as such active sockets will not be used there.
* 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. We leave these files all commented out by default though given that for systemd we want to encourage not using them.
* 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, with a default to none.
* 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.service
* xenstored.socket
* xenstored_ro.socket
* 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 targeted by default when building on Linux systems if systemd development libraries are present at build time.
The systemd files will be sanitized for meta @VARIABLES@ upon configuration and installed upon the install target. Systems that do not use systemd can still get systemd service unit files installed if the build system enabled systemd support, this however does not mandate a requirement of having systemd libraries present. Old init scripts are always installed.
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.
--- .gitignore | 5 + Makefile | 6 +- README | 16 +++ config/Tools.mk.in | 6 + m4/README.source | 8 ++ m4/systemd.m4 | 123 +++++++++++++++++++++ tools/configure.ac | 11 ++ tools/hotplug/Linux/Makefile | 8 +- tools/hotplug/Linux/systemd/Makefile | 67 +++++++++++ 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 +++ tools/hotplug/Linux/systemd/xenconsoled.service.in | 20 ++++ tools/hotplug/Linux/systemd/xendomains.service.in | 16 +++ tools/hotplug/Linux/systemd/xenstored.service.in | 27 +++++ tools/hotplug/Linux/systemd/xenstored.socket.in | 11 ++ tools/hotplug/Linux/systemd/xenstored_ro.socket.in | 11 ++ tools/ocaml/xenstored/Makefile | 5 + tools/xenstore/Makefile | 6 + 20 files changed, 399 insertions(+), 4 deletions(-) create mode 100644 m4/systemd.m4 create mode 100644 tools/hotplug/Linux/systemd/Makefile 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/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 create mode 100644 tools/hotplug/Linux/systemd/xenstored_ro.socket.in
.gitignore +5 -0
@@ -353,3 +353,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
Makefile +5 -1
@@ -216,8 +216,12 @@ 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)/*.service + rm -f $(D)$(XEN_SYSTEMD_DIR)/*.mount + rm -f $(D)$(XEN_SYSTEMD_MODULES_LOAD)/*.conf + rm -rf $(D)$(XEN_RUN_DIR)* $(D)/var/lib/xen* make -C tools uninstall rm -rf $(D)/boot/tboot*
README +16 -0
@@ -72,6 +72,7 @@ disabled at compile time: * cmake (if building vtpm stub domains) * markdown * figlet (for generating the traditional Xen start of day banner) + * systemd daemon development files Second, you need to acquire a suitable kernel for use in domain 0. If possible you should use a kernel provided by your OS distributor. If
@@ -161,6 +162,21 @@ change take effect. [1] http://wiki.xen.org/wiki/XenStoreReference [2] http://wiki.xen.org/wiki/Xenstored +Systemd support +=============== + +If you have systemd development packages installed you can build binaries +with systemd support. Systemd support is enabled by default if you have +systemd development libraries present. If you want to force enable systemd to +ensure you build binaries with systemd support you can use the --enable-systemd +flag. Likewise if you want to force disable systemd you can use: + + ./configure --disable-systemd + +For more details refer to the xen xenstored systemd wiki page [3]. + +[3] http://wiki.xen.org/wiki/Xenstored#xenstored_systemd_support + Python Runtime Libraries ========================
config/Tools.mk.in +6 -0
@@ -63,6 +63,12 @@ CONFIG_BLKTAP2 := @blktap2@ CONFIG_VTPM := @vtpm@ CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@ +CONFIG_SYSTEMD := @systemd@ +SYSTEMD_CFLAGS := @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS := @SYSTEMD_LIBS@ +XEN_SYSTEMD_DIR := @SYSTEMD_DIR@ +XEN_SYSTEMD_MODULES_LOAD := @SYSTEMD_MODULES_LOAD@ + #System options ZLIB := @zlib@ CONFIG_LIBICONV := @libiconv@
m4/README.source +8 -0
@@ -26,3 +26,11 @@ Date: Mon Feb 3 15:59:18 2014 -0800 With the newly added glib.mk, some of the noinst_* variables need to use += in the evaluation to avoid multiple definition warnings from automake. + +systemd.m4 +========== + +systemd.m4 was contributed to by Luis R. Rodriguez <[email protected]>, +its current home project can be found at: + +https://github.com/mcgrof/funk-systemd
m4/systemd.m4 new file +123 -0
123 lines not on this page · raw message
tools/configure.ac +11 -0
@@ -9,6 +9,15 @@ AC_CONFIG_FILES([ ../config/Tools.mk hotplug/Linux/init.d/xencommons.in hotplug/Linux/init.d/sysconfig.xencommons +hotplug/Linux/systemd/proc-xen.mount +hotplug/Linux/systemd/var-lib-xenstored.mount +hotplug/Linux/systemd/xenstored.socket +hotplug/Linux/systemd/xenstored_ro.socket +hotplug/Linux/systemd/xenstored.service +hotplug/Linux/systemd/xenconsoled.service +hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service +hotplug/Linux/systemd/xendomains.service +hotplug/Linux/systemd/xen-watchdog.service ]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([../])
@@ -59,6 +68,7 @@ m4_include([../m4/fetcher.m4]) m4_include([../m4/ax_compare_version.m4]) m4_include([../m4/paths.m4]) m4_include([../m4/xenstored.m4]) +m4_include([../m4/systemd.m4]) AX_XEN_EXPAND_CONFIG()
@@ -310,5 +320,6 @@ AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h]) fi # ! $rump +AX_AVAILABLE_SYSTEMD() AC_OUTPUT()
tools/hotplug/Linux/Makefile +5 -3
@@ -25,6 +25,8 @@ XEN_SCRIPTS += vscsi XEN_SCRIPTS += block-iscsi XEN_SCRIPTS += $(XEN_SCRIPTS-y) +SUBDIRS-$(CONFIG_SYSTEMD) += 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
@@ -33,7 +35,7 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev UDEV_RULES = xen-backend.rules $(UDEV_RULES-y) .PHONY: all -all: $(XENCOMMONS_INITD) +all: $(XENCOMMONS_INITD) subdirs-all $(XENCOMMONS_INITD): $(XEN_ROOT)/config/$(XEN_OS).modules $(XENCOMMONS_INITD).in $(XEN_ROOT)/tools/hotplug/Linux/update-modules.sh > $@
@@ -42,7 +44,7 @@ $(XENCOMMONS_INITD): $(XEN_ROOT)/config/$(XEN_OS).modules $(XENCOMMONS_INITD).in build: all .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
@@ -80,4 +82,4 @@ install-udev: done .PHONY: clean -clean: +clean: subdirs-clean
tools/hotplug/Linux/systemd/Makefile new file +67 -0
67 lines not on this page · raw message
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +9 -0
@@ -0,0 +1,9 @@ +[Unit] +Description=Mount /proc/xen files +ConditionVirtualization=xen +RefuseManualStop=true + +[Mount] +What=xenfs +Where=/proc/xen +Type=xenfs
tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in new file +13 -0
@@ -0,0 +1,13 @@ +[Unit] +Description=mount xenstore file system +ConditionVirtualization=xen +RefuseManualStop=true + +[Mount] +Environment=XENSTORED_MOUNT_CTX=none +EnvironmentFile=-/etc/sysconfig/xenstored +EnvironmentFile=-/etc/default/xenstored +What=xenstore +Where=@XEN_LIB_STORED@ +Type=tmpfs +Options=mode=755,context="$XENSTORED_MOUNT_CTX"
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in new file +22 -0
@@ -0,0 +1,22 @@ +[Unit] +Description=qemu for xen dom0 disk backend +Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket +After=xenstored.service xenconsoled.service +Before=xendomains.service libvirtd.service libvirt-guests.service +RefuseManualStop=true +ConditionVirtualization=xen + +[Service] +Type=simple +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
tools/hotplug/Linux/systemd/xen-watchdog.service.in new file +13 -0
@@ -0,0 +1,13 @@ +[Unit] +Description=Xen-watchdog - run xen watchdog daemon +Requires=proc-xen.mount +After=proc-xen.mount xendomains.service +ConditionVirtualization=xen + +[Service] +Type=forking +ExecStart=@SBINDIR@/xenwatchdogd 30 15 +KillSignal=USR1 + +[Install] +WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xenconsoled.service.in new file +20 -0
@@ -0,0 +1,20 @@ +[Unit] +Description=Xenconsoled - handles logging from guest consoles and hypervisor +Requires=xenstored.socket +After=xenstored.service +ConditionVirtualization=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 ${XENCONSOLED_LOG_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
tools/hotplug/Linux/systemd/xendomains.service.in new file +16 -0
@@ -0,0 +1,16 @@ +[Unit] +Description=Xendomains - start and stop guests on boot and shutdown +Requires=xenstored.socket +After=xenstored.service xenconsoled.service +ConditionVirtualization=xen + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities +ExecStart=-@LIBEXEC@/xendomains start +ExecStop=@LIBEXEC@/xendomains stop +ExecReload=@LIBEXEC@/xendomains restart + +[Install] +WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xenstored.service.in new file +27 -0
@@ -0,0 +1,27 @@ +[Unit] +Description=The Xen xenstore +Requires=xenstored_ro.socket xenstored.socket proc-xen.mount var-lib-xenstored.mount +After=proc-xen.mount var-lib-xenstored.mount +Before=libvirtd.service libvirt-guests.service +RefuseManualStop=true +ConditionVirtualization=xen + +[Service] +Type=notify +Environment=XENSTORED_ARGS= +Environment=XENSTORED_ROOTDIR=@XEN_LIB_STORED@ +Environment=XENSTORED=@XENSTORED@ +EnvironmentFile=-/etc/default/xencommons +EnvironmentFile=-/etc/sysconfig/xencommons +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=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0" +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/domid" 0 + +[Install] +WantedBy=multi-user.target +Also=xenstored_ro.socket xenstored.socket +Also=proc-xen.mount +Also=var-lib-xenstored.mount
tools/hotplug/Linux/systemd/xenstored.socket.in new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=xenstore socket +ConditionVirtualization=xen + +[Socket] +ListenStream=/var/run/xenstored/socket +SocketMode=0600 +Service=xenstored.service + +[Install] +WantedBy=sockets.target
tools/hotplug/Linux/systemd/xenstored_ro.socket.in new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=xenstore ro socket +ConditionVirtualization=xen + +[Socket] +ListenStream=/var/run/xenstored/socket_ro +SocketMode=0660 +Service=xenstored.service + +[Install] +WantedBy=sockets.target
tools/ocaml/xenstored/Makefile +5 -0
@@ -3,6 +3,11 @@ OCAML_TOPLEVEL = $(CURDIR)/.. include $(OCAML_TOPLEVEL)/common.make CFLAGS += -I$(XEN_ROOT)/tools/ +CFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_CFLAGS) +LDFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_LIBS) + +CFLAGS += $(CFLAGS-y) +LDFLAGS += $(LDFLAGS-y) OCAMLINCLUDE += \ -I $(OCAML_TOPLEVEL)/libs/xb \
tools/xenstore/Makefile +6 -0
@@ -9,6 +9,12 @@ CFLAGS += -I. CFLAGS += -I$(XEN_ROOT)/tools/ CFLAGS += $(CFLAGS_libxenctrl) +CFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_CFLAGS) +LDFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_LIBS) + +CFLAGS += $(CFLAGS-y) +LDFLAGS += $(LDFLAGS-y) + CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod CLIENTS += xenstore-write xenstore-ls xenstore-watch
Signature · 7 lines
2.0.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 10 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
This is the rebase set of patches with the one hunk merged to address the xencommons script generation.
Luis R. Rodriguez (3):
xencommons: move module list into a generic place
autoconf: xen: enable explicit preference option for xenstored
preference
systemd: add xen systemd service and module files
Sorry I didn't use -M here... will send a v10 just in case... Sorry for the noise.
Luis