mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

Blame SOURCES/lvm2-2_03_03-scripts-lvm2-activation-generator-fix-lvmconfig-call.patch

146ac4
 WHATS_NEW                                           |  1 +
146ac4
 scripts/generator-internals.c                       |  3 ++-
146ac4
 scripts/lvm2_activation_generator_systemd_red_hat.c | 15 ++++++++++-----
146ac4
 3 files changed, 13 insertions(+), 6 deletions(-)
146ac4
146ac4
diff --git a/WHATS_NEW b/WHATS_NEW
146ac4
index 002b5a3..4b68dbd 100644
146ac4
--- a/WHATS_NEW
146ac4
+++ b/WHATS_NEW
146ac4
@@ -1,5 +1,6 @@
146ac4
 Version 2.03.03 - 
146ac4
 ====================================
146ac4
+  Fix generator querying config options missing from lvm.conf.
146ac4
   Restore missing man info lvcreate --zero for thin-pools.
146ac4
   Drop misleadning comment for metadata minimum_io_size for VDO segment.
146ac4
   Improve -lXXX%VG modifier which improves cache segment estimation.
146ac4
diff --git a/scripts/generator-internals.c b/scripts/generator-internals.c
146ac4
index 9619e8c..7bab4f9 100644
146ac4
--- a/scripts/generator-internals.c
146ac4
+++ b/scripts/generator-internals.c
146ac4
@@ -170,7 +170,8 @@ static bool _parse_line(const char *line, struct config *cfg)
146ac4
 static bool _get_config(struct config *cfg, const char *lvmconfig_path)
146ac4
 {
146ac4
 	static const char *_argv[] = {
146ac4
-		"lvmconfig", LVM_CONF_EVENT_ACTIVATION, LVM_CONF_USE_LVMPOLLD, NULL
146ac4
+		"lvmconfig", "--type", "full",
146ac4
+		LVM_CONF_EVENT_ACTIVATION, LVM_CONF_USE_LVMPOLLD, NULL
146ac4
 	};
146ac4
 
146ac4
 	bool r = true;
146ac4
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
146ac4
index 0e6c05a..99b5f22 100644
146ac4
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
146ac4
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
146ac4
@@ -213,12 +213,17 @@ static bool _run(int argc, const char **argv)
146ac4
 	if (!_parse_command_line(&gen, argc, argv))
146ac4
 		return false;
146ac4
 
146ac4
-	if (!_get_config(&gen.cfg, LVMCONFIG_PATH))
146ac4
-		return false;
146ac4
+	if (_get_config(&gen.cfg, LVMCONFIG_PATH)) {
146ac4
+		if (gen.cfg.event_activation)
146ac4
+			// If event_activation=1, pvscan --cache -aay does activation.
146ac4
+			return true;
146ac4
+	}
146ac4
 
146ac4
-	if (gen.cfg.event_activation)
146ac4
-		// If event_activation=1, pvscan --cache -aay does activation.
146ac4
-		return true;
146ac4
+	/*
146ac4
+	 *  Create the activation units if:
146ac4
+	 *    - _get_config succeeded and event_activation=0
146ac4
+	 *    - _get_config failed, then this is a failsafe fallback
146ac4
+	 */
146ac4
 
146ac4
 	/* mark lvm2-activation.*.service as world-accessible */
146ac4
 	old_mask = umask(0022);