Skip to contentSkip to conversation

systemd: add support initial xen systemd service files

PATCH In review Luis R. Rodriguez 5 participants 14 messages Mar 19, 2014 – Apr 28, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v3 7/7 systemd: add support initial xen systemd service files

From: "Luis R. Rodriguez" <[email protected]>

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 <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Jan Rękorajski <[email protected]>
Cc M A Young <[email protected]>
Cc Jacek Konieczny <[email protected]>
---
 .gitignore                                         |  5 ++
 Config.mk                                          |  9 ++-
 Makefile                                           | 11 +++-
 config/StdGNU.mk                                   |  4 ++
 tools/hotplug/Linux/Makefile                       |  8 ++-
 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, 269 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
.gitignore +5 -0
index db3b083..4d77d16 100644
@@ -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
Config.mk +8 -1
index 84c558b..24f9463 100644
@@ -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))
Makefile +10 -1
index 4e48457..8f6d479 100644
@@ -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*
 
config/StdGNU.mk +4 -0
index 25fc594..70e1a40 100644
@@ -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
tools/hotplug/Linux/Makefile +5 -3
index 0be2e8a..c62cbd1 100644
@@ -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
@@ -81,4 +83,4 @@ install-udev:
 	done
 
 .PHONY: clean
-clean:
+clean: subdirs-clean
tools/hotplug/Linux/systemd/Makefile new file +72 -0

72 lines not on this page · raw message

tools/hotplug/Linux/systemd/oxenstored.service.in new file +23 -0
new file mode 100644
index 0000000..f9bd272
@@ -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
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +9 -0
new file mode 100644
index 0000000..6eb61b2
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount /proc/xen files
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+What=xenfs
+Where=/proc/xen
+Type=xenfs
tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in new file +13 -0
new file mode 100644
index 0000000..a393b06
@@ -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"
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in new file +22 -0
new file mode 100644
index 0000000..39a82bc
@@ -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
tools/hotplug/Linux/systemd/xen-watchdog.service.in new file +13 -0
new file mode 100644
index 0000000..063fefb
@@ -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
tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in new file +16 -0
new file mode 100644
index 0000000..3fbd59b
@@ -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
tools/hotplug/Linux/systemd/xenconsoled.service.in new file +20 -0
new file mode 100644
index 0000000..77c3965
@@ -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
tools/hotplug/Linux/systemd/xendomains.service.in new file +16 -0
new file mode 100644
index 0000000..35beeaf
@@ -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
tools/hotplug/Linux/systemd/xenstored.service.in new file +24 -0
new file mode 100644
index 0000000..6a45020
@@ -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
tools/hotplug/Linux/systemd/xenstored.socket.in new file +9 -0
new file mode 100644
index 0000000..2091b82
@@ -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
Signature · 7 lines
1.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw

I have not read through this fully, but xenstored.service and oxenstored.service need an additional line like ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/domid" 0
for xen 4.4 and later.

Michael Young

#2 lore raw
Quoted 4 lines · M A Young

I have not read through this fully, but xenstored.service and oxenstored.service need an additional line like ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/domid" 0 for xen 4.4 and later.

It was there for both, but now that I look at it I had only made this optional to fail on oxenstore. The init script lets it fail so I suppose letting it fail on both is OK, but perhaps its a good time to think about if we want to allow that to fail.

While doing some more testing another thing I noticed was that the trick I was expecting to work of having xen-qemu-dom0-disk-backend.service.in to Require xenstored.socket instead of either xenstored.service or oxenstored.service doesn't cut it, even if we explicitly claim the socket within the store services. Let me know if anyone sees a away to use logic within systemd to make a service exclusively through sockets for services that provide their own ExecStart but just don't see it now. If we can't find a way that may mean we either have to write our own wrapper C program to check for both or have this configurable upon build. As for the later I at least don't get oxenstored being built by default, even though it seems I probably should as that is the way of the future, so we'd have to just lave the C xenstored as the default for now I guess.

Luis

#3 lore raw
Quoted 10 lines · Luis R. Rodriguez
Quoted 4 lines · M A Young

I have not read through this fully, but xenstored.service and oxenstored.service need an additional line like ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/domid" 0 for xen 4.4 and later.

It was there for both, but now that I look at it I had only made this optional to fail on oxenstore. The init script lets it fail so I suppose letting it fail on both is OK, but perhaps its a good time to think about if we want to allow that to fail.

I think you missed my point. For xen 4.3, which is I am guessing is the version of the Fedora package you took the systemd files from, you have

ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"

For xen 4.4 and later you need

ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/domid" 0

as well.

Michael Young

#4 lore raw
Quoted 1 line · M A Young

I think you missed my point.

Indeed.

Quoted 1 line

For xen 4.3, which is I am guessing is the version of the Fedora package you took the systemd files from

I snatched what I could from git://pkgs.fedoraproject.org/xen.git

Quoted 9 lines

you have

ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"

For xen 4.4 and later you need

ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/domid" 0

as well.

As well as in both? If not then I would prefer to deal only with what is required for upstream and let packages deal with this for their own versions.

Luis

#5 lore raw
Quoted 15 lines · Luis R. Rodriguez
Quoted 1 line · M A Young

I think you missed my point.

Indeed.

Quoted 1 line

For xen 4.3, which is I am guessing is the version of the Fedora package you took the systemd files from

I snatched what I could from git://pkgs.fedoraproject.org/xen.git

Quoted 6 lines

you have

ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"

For xen 4.4 and later you need

Quoted 7 lines
Quoted 3 lines

ExecStartPost=-/usr/bin/xenstore-write "/local/domain/0/domid" 0

as well.

As well as in both? If not then I would prefer to deal only with what is required for upstream and let packages deal with this for their own versions.

You need both lines in both xenstored.service and oxenstored.service. This reflects this commit
http://xenbits.xenproject.org/gitweb/?p=xen.git;a=commit;h=02ebea7768fe723deaa56c2cfcb860874544b47d
adding the second line to the xencommons init.d scripts between xen 4.3 and xen 4.4 . I know from testing that you can have trouble starting guests with xl if you leave the second line out.

Michael Young

#6 lore raw
Quoted 6 lines · M A Young

You need both lines in both xenstored.service and oxenstored.service. This reflects this commit
http://xenbits.xenproject.org/gitweb/?p=xen.git;a=commit;h=02ebea7768fe723deaa56c2cfcb860874544b47d
adding the second line to the xencommons init.d scripts between xen 4.3 and xen 4.4 . I know from testing that you can have trouble starting guests with xl if you leave the second line out.

Ok thanks for the clarification, will respin and add both, with - prefix.

Luis

#7 lore raw

Luis R. Rodriguez writes ("Re: [PATCH v3 7/7] systemd: add support initial xen systemd service files"):

Quoted 10 lines · M A Young
Quoted 6 lines

You need both lines in both xenstored.service and oxenstored.service. This reflects this commit
http://xenbits.xenproject.org/gitweb/?p=xen.git;a=commit;h=02ebea7768fe723deaa56c2cfcb860874544b47d
adding the second line to the xencommons init.d scripts between xen 4.3 and xen 4.4 . I know from testing that you can have trouble starting guests with xl if you leave the second line out.

Ok thanks for the clarification, will respin and add both, with - prefix.

Surely this code should appear exactly once in the tree.

Ian.

#8 lore raw
Quoted 10 lines · Ian Jackson

Luis R. Rodriguez writes ("Re: [PATCH v3 7/7] systemd: add support initial xen systemd service files"):

Quoted 9 lines · M A Young
Quoted 6 lines

You need both lines in both xenstored.service and oxenstored.service. This reflects this commit
http://xenbits.xenproject.org/gitweb/?p=xen.git;a=commit;h=02ebea7768fe723deaa56c2cfcb860874544b47d
adding the second line to the xencommons init.d scripts between xen 4.3 and xen 4.4 . I know from testing that you can have trouble starting guests with xl if you leave the second line out.

Quoted 3 lines
Quoted 1 line

Ok thanks for the clarification, will respin and add both, with - prefix.

Surely this code should appear exactly once in the tree.

Certainly exactly once in a given set of init system integration!

I don't want block the addition of such integration based on a plan to eventually have some sort of common meta initscript system, but in this particular case a common $libexec/xenstored script which the sysvinit scripts and systemd services (and any other initscript) can call seems like a reasonable thing to do.

Ian.

#9 lore raw
In reply to M A Young
Quoted 6 lines · M A Young

You need both lines in both xenstored.service and oxenstored.service. This reflects this commit
http://xenbits.xenproject.org/gitweb/?p=xen.git;a=commit;h=02ebea7768fe723deaa56c2cfcb860874544b47d
adding the second line to the xencommons init.d scripts between xen 4.3 and xen 4.4 . I know from testing that you can have trouble starting guests with xl if you leave the second line out.

Thanks for the feedback, I've rolled this into my series.

Luis

#10 lore raw
In reply to Luis R. Rodriguez
Quoted 5 lines · Luis R. Rodriguez

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@.

Could configure not generate these more easily than what you have below? It could still be conditional on Linux I'd have though, given a little bit of autofoo ninjutsu.

Quoted 16 lines

+%.socket: %.socket.in

tools/hotplug/Linux/systemd/Makefile new file +15 -0
+       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'  $@

tools/hotplug/Linux/systemd/Makefile line 66

Quoted 10 lines
tools/hotplug/Linux/systemd/Makefile new file +10 -0
+       @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'                $@ 

If you do keep this then itis crying out for a helper macro/make function.

I though we had one TBH.

#11 lore raw
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Luis R. Rodriguez

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@.

Could configure not generate these more easily than what you have below?

Not sure, I've dodged configure all my life.

Quoted 2 lines

It could still be conditional on Linux I'd have though, given a little bit of autofoo ninjutsu.

I'm autofoo dumb.

Quoted 21 lines
Quoted 21 lines

+%.socket: %.socket.in

tools/hotplug/Linux/systemd/Makefile new file +20 -0
+       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'                $@
Quoted 8 lines

tools/hotplug/Linux/systemd/Makefile line 48

Quoted 5 lines
tools/hotplug/Linux/systemd/Makefile new file +5 -0
+       @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'                $@ 

If you do keep this then itis crying out for a helper macro/make function.

Can we welcome this as an enhancement?

Quoted 1 line

I though we had one TBH.

I don't see one, but haven't looked under every rug.

Luis

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw
Quoted 8 lines · Luis R. Rodriguez
Quoted 7 lines · Ian Campbell
Quoted 5 lines · Luis R. Rodriguez

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@.

Quoted 8 lines
Quoted 1 line

Could configure not generate these more easily than what you have below?

Not sure, I've dodged configure all my life.

Quoted 2 lines

It could still be conditional on Linux I'd have though, given a little bit of autofoo ninjutsu.

I'm autofoo dumb.

For this case I think you just need to add the files to tools/configure.ac:AC_CONFIG_FILES

Quoted 30 lines
Quoted 21 lines
Quoted 21 lines

+%.socket: %.socket.in

tools/hotplug/Linux/systemd/Makefile new file +20 -0
+       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'                $@
Quoted 8 lines

tools/hotplug/Linux/systemd/Makefile line 48

Quoted 5 lines
tools/hotplug/Linux/systemd/Makefile new file +5 -0
+       @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'                $@ 

If you do keep this then itis crying out for a helper macro/make function.

Quoted 1 line

Can we welcome this as an enhancement?

If not the autoconf way then I'd like to at least see this collapsed into one instance with some make facitily or other please.

Ian.

#13 lore raw
Quoted 13 lines · Ian Campbell
Quoted 12 lines · Luis R. Rodriguez
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Luis R. Rodriguez

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@.

Could configure not generate these more easily than what you have below?

Not sure, I've dodged configure all my life.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It could still be conditional on Linux I'd have though, given a little bit of autofoo ninjutsu.

I'm autofoo dumb.

For this case I think you just need to add the files to tools/configure.ac:AC_CONFIG_FILES

It was a bit more work than that but I git it and do agree its nicer. Doing this begged for other changes to be made which I'll roll into the series.

Luis