Bug#796625: [PATCH] clvm: ship native systemd units in debian package

Andreas Henriksson andreas at fatal.se
Mon Jun 13 11:31:49 UTC 2016


Control: tags -1 + patch

Hello!

The attached patch updates the packaging to ship (modified versions of)
the upstream/redhat native systemd units in the clvm package.
I don't have possibility to test this myself, so hopefully this is
good enough result. I've compared checks in the init script but
they seem pretty obsolete. eg. the check for /etc/cluster/cluster.conf
which the lvm2 sources doesn't have any references to (anymore?).
Given this I opted to NOT enable/start the new
lvm2-cluster-activation.service by default. This creates a problem
on upgrades where people will manually need to enable it, thus
I also added a debian/NEWS entry to mention that.

In essence, clvm init script is masked replaced by two new services:
lvm2-cluster-activation.service and lvm2-clvmd.service
The lvm2-clvmd.service is not something you can manually handle at all
so all admin tasks should be against lvm2-cluster-activation.service
(which will start/stop lvm2-clvmd.service).

Hope this helps. Would be much appreciated if we could resolve this
bug report (very) soon. I'd like to avoid NMUing this package but
if progress is blocked on this bug report I'll go ahead if there's
no feedback by then.

Ulf Norberg it would be very appreciated if you could test building
a package with the patch attached and report back on status.

Regards,
Andreas Henriksson
-------------- next part --------------
diff -Nru lvm2-2.02.153/debian/changelog lvm2-2.02.153/debian/changelog
--- lvm2-2.02.153/debian/changelog	2016-05-09 16:45:32.000000000 +0200
+++ lvm2-2.02.153/debian/changelog	2016-06-13 13:16:07.000000000 +0200
@@ -1,3 +1,25 @@
+lvm2 (2.02.153-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+    - This upload is targeted at and below changes closes: #796625
+  * Add debian/patches/clvm-systemd-unit-debian-adaptions.patch
+    - this among other things makes lvm2-cluster-activation.service
+      take the LVM_VGS from /etc/default/clvm into consideration, but
+      ignores other things like CLVMDTIMEOUT from the same file.
+      Use systemctl edit lvm2-cluster-activation.service to override
+      settings instead of the /etc/default/clvm file which should be
+      considered deprecated under systemd.
+      See patch header for more details.
+  * Add debian/clvm.links masking clvm init script under systemd
+    in favour of lvm2-{clvmd,cluster-activation}.service
+  * debian/rules: use systemd dh tools on lvm2-cluster-activation.service
+    - no start on installation. Use systemctl enable lvm2-cluster-activation
+      once the cluster has been configured!
+  * debian/NEWS: Add a note about enabling lvm2-cluster-activation.service
+    for people upgrading from previous versions.
+
+ -- Andreas Henriksson <andreas at fatal.se>  Fri, 10 Jun 2016 17:06:54 +0200
+
 lvm2 (2.02.153-1) unstable; urgency=medium
 
   * New upstream version.
diff -Nru lvm2-2.02.153/debian/clvm.links lvm2-2.02.153/debian/clvm.links
--- lvm2-2.02.153/debian/clvm.links	1970-01-01 01:00:00.000000000 +0100
+++ lvm2-2.02.153/debian/clvm.links	2016-06-10 17:07:30.000000000 +0200
@@ -0,0 +1 @@
+dev/null lib/systemd/system/clvm.service
diff -Nru lvm2-2.02.153/debian/NEWS lvm2-2.02.153/debian/NEWS
--- lvm2-2.02.153/debian/NEWS	1970-01-01 01:00:00.000000000 +0100
+++ lvm2-2.02.153/debian/NEWS	2016-06-13 13:11:39.000000000 +0200
@@ -0,0 +1,9 @@
+lvm2 (2.02.153-1.1) UNRELEASED; urgency=medium
+
+  * This version introduces native systemd units to replace /etc/init.d/clvm
+    Please note that "lvm2-cluster-activation.service" is NOT enabled by
+    default as local system administrator will need to configure the
+    cluster first. Use "systemctl enable lvm2-cluster-activation.service"
+    to have clvm enabled under systemd. (The old clvm init script is masked.)
+
+ -- Andreas Henriksson <andreas at fatal.se>  Mon, 13 Jun 2016 13:09:37 +0200
diff -Nru lvm2-2.02.153/debian/patches/clvm-systemd-unit-debian-adaptions.patch lvm2-2.02.153/debian/patches/clvm-systemd-unit-debian-adaptions.patch
--- lvm2-2.02.153/debian/patches/clvm-systemd-unit-debian-adaptions.patch	1970-01-01 01:00:00.000000000 +0100
+++ lvm2-2.02.153/debian/patches/clvm-systemd-unit-debian-adaptions.patch	2016-06-13 13:05:16.000000000 +0200
@@ -0,0 +1,54 @@
+From: Andreas Henriksson <andreas at fatal.se>
+Subject: Debian adaptions of upstream/redhat systemd units
+
+The following adaptions where made to make the upstream redhat-specific
+units work under Debian:
+ * Import environment file /etc/default/clvm instead of sysconfig/clvmd
+   - This makes LVM_VGS available to the activation script but ignores
+     the CLVMDTIMEOUT in /etc/default/clvm ... use systemctl edit
+     to override instead.
+   - replace dlm.service with cman.service in unit dependencies/ordering
+   - demote cman.service from Requires= to Wants= as it's only Recommends
+     (and not Depends) in the Debian package.
+   - use /usr/sbin/clvmd in unit file to match where upstream build system
+     and debian package ship the binary (note: using @usrsbindir@ instead
+     of @sbindir@ doesn't work because @usrsbindir@ is literally set to
+     ${prefix}/sbin and not the actual path).
+
+--- a/scripts/lvm2_cluster_activation_systemd_red_hat.service.in
++++ b/scripts/lvm2_cluster_activation_systemd_red_hat.service.in
+@@ -9,7 +9,7 @@
+ [Service]
+ Type=simple
+ RemainAfterExit=yes
+-EnvironmentFile=- at sysconfdir@/sysconfig/clvmd
++EnvironmentFile=-/etc/default/clvm
+ ExecStart=@systemdutildir@/lvm2-cluster-activation activate
+ ExecStop=@systemdutildir@/lvm2-cluster-activation deactivate
+ 
+--- a/scripts/lvm2_clvmd_systemd_red_hat.service.in
++++ b/scripts/lvm2_clvmd_systemd_red_hat.service.in
+@@ -1,9 +1,10 @@
+ [Unit]
+ Description=Clustered LVM daemon
+ Documentation=man:clvmd(8)
+-After=dlm.service corosync.service
++After=cman.service corosync.service
+ Before=remote-fs-pre.target
+-Requires=network.target dlm.service corosync.service
++Requires=network.target corosync.service
++Wants=cman.service
+ RefuseManualStart=true
+ RefuseManualStop=true
+ StopWhenUnneeded=true
+@@ -13,8 +14,8 @@
+ [Service]
+ Type=forking
+ Environment=CLVMD_OPTS=-T30
+-EnvironmentFile=- at sysconfdir@/sysconfig/clvmd
+-ExecStart=@sbindir@/clvmd $CLVMD_OPTS
++EnvironmentFile=-/etc/default/clvm
++ExecStart=/usr/sbin/clvmd $CLVMD_OPTS
+ SuccessExitStatus=5
+ TimeoutStartSec=30
+ TimeoutStopSec=10
diff -Nru lvm2-2.02.153/debian/patches/series lvm2-2.02.153/debian/patches/series
--- lvm2-2.02.153/debian/patches/series	2016-05-09 16:35:12.000000000 +0200
+++ lvm2-2.02.153/debian/patches/series	2016-06-10 17:04:31.000000000 +0200
@@ -9,3 +9,4 @@
 0009-clvmd-openais-format.patch
 udev-md.patch
 systemd-pvscan-background.patch
+clvm-systemd-unit-debian-adaptions.patch
diff -Nru lvm2-2.02.153/debian/rules lvm2-2.02.153/debian/rules
--- lvm2-2.02.153/debian/rules	2016-05-09 16:35:12.000000000 +0200
+++ lvm2-2.02.153/debian/rules	2016-06-13 13:08:28.000000000 +0200
@@ -198,7 +198,11 @@
 install_clvm: DIR = $(BUILD_DIR)/install_deb
 install_clvm: $(STAMPS_DIR)/install_deb
 	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
+	dh_systemd_enable --no-enable \
+		lvm2-cluster-activation.service
 	dh_installinit --no-start
+	dh_systemd_start --no-start --no-restart-after-upgrade \
+		lvm2-cluster-activation.service
 	+$(MAKE_SELF) install-base
 
 install_dmeventd: export DH_OPTIONS = -pdmeventd


More information about the pkg-lvm-maintainers mailing list