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

Bug#728486: Current patch for resolving lvm/systemd compatibility



Hi Don,

Don Armstrong <don@debian.org> writes:
> Michael: can you go ahead and prepare the patch to fix #728486 which
> does not use generators so that once the CTTE has resolved the init
> system question we have a patch in front of us that we can rule on?
Of course!

Attached you can find a patch against the current lvm2 version in Debian
which adds two static service files that contain exactly the same
content as what the generator produces¹. The patch also enables
installation of the tmpfiles.d(5) configuration file and makes sure that
the service files are enabled according to best practices². I tested
this on the same test virtual machine that I used all along, and it has
the same effect as enabling the generator, i.e. it fixes the problem.

For convenience, I also attached lvm2.debdiff which shows the
differences in what files are installed, the package’s dependencies, and
how the control files are modified. Best viewed with:

  colordiff --difftype=debdiff < /tmp/lvm2.debdiff

Please let me know if the patch should be changed in any way to better
accomodate the CTTE in ruling on it.

① I removed the SourcePath= directory which is only reasonable in
  generated units. Furthermore I added an [Install] section with
  WantedBy=local-fs.target, which is normally done outside of the unit
  by the generator.

② See https://wiki.debian.org/Systemd/Packaging

-- 
Best regards,
Michael
>From 4eecd2d3168ceb30fc5cc4a9049dfe50e462a8f1 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <stapelberg@debian.org>
Date: Sat, 18 Jan 2014 11:07:03 +0100
Subject: [PATCH] systemd support

---
 debian/changelog                     |    7 +++++++
 debian/control                       |    2 +-
 debian/lvm2-activation-early.service |   22 ++++++++++++++++++++++
 debian/lvm2-activation.service       |   21 +++++++++++++++++++++
 debian/lvm2.install                  |    3 +++
 debian/rules                         |    3 +++
 6 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 debian/lvm2-activation-early.service
 create mode 100644 debian/lvm2-activation.service

diff --git a/debian/changelog b/debian/changelog
index 25245bb..c94b8c9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+lvm2 (2.02.98-6systemd1) unstable; urgency=low
+
+  * Add static systemd service files to fix lvm activation edge cases
+    (closes: #728486)
+
+ -- Michael Stapelberg <stapelberg@debian.org>  Sat, 18 Jan 2014 11:02:32 +0100
+
 lvm2 (2.02.98-6) unstable; urgency=low
 
   * Update init script:
diff --git a/debian/control b/debian/control
index a280da0..c4e9a7a 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: admin
 Priority: optional
 Maintainer: Debian LVM Team <pkg-lvm-maintainers@lists.alioth.debian.org>
 Uploaders: Bastian Blank <waldi@debian.org>
-Build-Depends: dpkg-dev (>= 1.16.1~), debhelper (>= 8.1.3~), automake, libcman-dev (>> 2), libcorosync-dev, libdlm-dev (>> 2), libreadline-gplv2-dev, libselinux1-dev, libudev-dev, openais-dev, pkg-config
+Build-Depends: dpkg-dev (>= 1.16.1~), debhelper (>= 8.1.3~), automake, libcman-dev (>> 2), libcorosync-dev, libdlm-dev (>> 2), libreadline-gplv2-dev, libselinux1-dev, libudev-dev, openais-dev, pkg-config, dh-systemd
 Standards-Version: 3.9.1
 Homepage: http://sources.redhat.com/lvm2/
 Vcs-Svn: svn://svn.debian.org/pkg-lvm/lvm2/trunk/
diff --git a/debian/lvm2-activation-early.service b/debian/lvm2-activation-early.service
new file mode 100644
index 0000000..21ba959
--- /dev/null
+++ b/debian/lvm2-activation-early.service
@@ -0,0 +1,22 @@
+# Automatically generated by lvm2-activation-generator.
+#
+# This unit is responsible for direct activation of LVM2 logical volumes
+# if lvmetad daemon is not used (global/use_lvmetad=0 lvm.conf setting),
+# hence volume autoactivation is not applicable.
+# Direct LVM2 activation requires udev to be settled!
+
+[Unit]
+Description=Activation of LVM2 logical volumes
+Documentation=man:lvm(8) man:vgchange(8)
+DefaultDependencies=no
+After=systemd-udev-settle.service
+Before=cryptsetup.target
+Before=local-fs.target shutdown.target
+Wants=systemd-udev-settle.service
+
+[Service]
+ExecStart=/sbin/lvm vgchange -aay --sysinit
+Type=oneshot
+
+[Install]
+WantedBy=local-fs.target
diff --git a/debian/lvm2-activation.service b/debian/lvm2-activation.service
new file mode 100644
index 0000000..9b273fd
--- /dev/null
+++ b/debian/lvm2-activation.service
@@ -0,0 +1,21 @@
+# Automatically generated by lvm2-activation-generator.
+#
+# This unit is responsible for direct activation of LVM2 logical volumes
+# if lvmetad daemon is not used (global/use_lvmetad=0 lvm.conf setting),
+# hence volume autoactivation is not applicable.
+# Direct LVM2 activation requires udev to be settled!
+
+[Unit]
+Description=Activation of LVM2 logical volumes
+Documentation=man:lvm(8) man:vgchange(8)
+DefaultDependencies=no
+After=lvm2-activation-early.service cryptsetup.target
+Before=local-fs.target shutdown.target
+Wants=systemd-udev-settle.service
+
+[Service]
+ExecStart=/sbin/lvm vgchange -aay --sysinit
+Type=oneshot
+
+[Install]
+WantedBy=local-fs.target
diff --git a/debian/lvm2.install b/debian/lvm2.install
index 81d0dc2..630f1a2 100644
--- a/debian/lvm2.install
+++ b/debian/lvm2.install
@@ -1,4 +1,6 @@
 ../../tree/lvm2/* /
+../../lvm2-activation-early.service /lib/systemd/system/
+../../lvm2-activation.service /lib/systemd/system/
 etc/lvm/lvm.conf
 sbin/fsadm
 sbin/lv*
@@ -8,3 +10,4 @@ usr/share/man/man8/lv*
 usr/share/man/man8/pv*
 usr/share/man/man8/vg*
 usr/share/man/man5
+usr/lib/tmpfiles.d/lvm2.conf
diff --git a/debian/rules b/debian/rules
index a99bd11..4878df8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -140,6 +140,7 @@ $(STAMPS_DIR)/install_%: $(STAMPS_DIR)/build_%
 	dh_testroot
 	rm -rf $(INSTALL_DIR)
 	+$(MAKE_REAL) -C $(DIR) install DESTDIR=$(CURDIR)/$(INSTALL_DIR) LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
+	+$(MAKE_REAL) -C $(DIR) install_tmpfiles_configuration DESTDIR=$(CURDIR)/$(INSTALL_DIR) LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
 	touch $@
 
 install-base-prep:
@@ -237,7 +238,9 @@ install_lvm2: export DH_OPTIONS = -plvm2
 install_lvm2: DIR = $(BUILD_DIR)/install_deb
 install_lvm2: $(STAMPS_DIR)/install_deb
 	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
+	dh_systemd_enable
 	dh_installinit --no-start -- start 26 S .
+	dh_systemd_start --no-start
 	+$(MAKE_SELF) install-base
 
 install_lvm2-udeb: export DH_OPTIONS = -plvm2-udeb
-- 
1.7.10.4

Attachment: lvm2.debdiff
Description: Binary data


Reply to: