41 lines
1.5 KiB
Diff
41 lines
1.5 KiB
Diff
|
From: Andrey Borzenkov <arvidjaar@gmail.com>
|
||
|
Subject: [PATCH] activate lvmetad in generator if use_lvmetad=1
|
||
|
|
||
|
This avoids unbootable system if user changes use_lvmetad but forgets
|
||
|
to enable lvmetad.
|
||
|
|
||
|
Ref: https://bugzilla.novell.com/show_bug.cgi?id=862076
|
||
|
|
||
|
Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
|
||
|
|
||
|
---
|
||
|
scripts/lvm2_activation_generator_systemd_red_hat.c | 9 ++++-----
|
||
|
1 file changed, 4 insertions(+), 5 deletions(-)
|
||
|
|
||
|
Index: LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
|
||
|
===================================================================
|
||
|
--- LVM2.2.02.98.orig/scripts/lvm2_activation_generator_systemd_red_hat.c
|
||
|
+++ LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
|
||
|
@@ -153,15 +153,15 @@ int main(int argc, char *argv[])
|
||
|
r = EXIT_FAILURE; goto out;
|
||
|
}
|
||
|
|
||
|
+ dir = argc > 1 ? argv[1] : DEFAULT_UNIT_DIR;
|
||
|
+
|
||
|
/* If lvmetad used, rely on autoactivation instead of direct activation. */
|
||
|
if (lvm_uses_lvmetad()) {
|
||
|
kmsg("LVM: Logical Volume autoactivation enabled.\n");
|
||
|
- goto out;
|
||
|
- }
|
||
|
-
|
||
|
- dir = argc > 1 ? argv[1] : DEFAULT_UNIT_DIR;
|
||
|
-
|
||
|
- if (!generate_unit(dir, 1) || !generate_unit(dir, 0))
|
||
|
+ if (dm_snprintf(unit_path, PATH_MAX, "%s/%s", "/usr/lib/systemd/system", "lvm2-lvmetad.socket") < 0 ||
|
||
|
+ !register_unit_with_target (dir, "lvm2-lvmetad.socket", "sockets.target"))
|
||
|
+ r = EXIT_FAILURE;
|
||
|
+ } else if (!generate_unit(dir, 1) || !generate_unit(dir, 0))
|
||
|
r = EXIT_FAILURE;
|
||
|
out:
|
||
|
kmsg("LVM: Activation generator %s.\n", r ? "failed" : "successfully completed");
|