SHA256
1
0
forked from pool/lvm2
lvm2/autoactivate-lvmetad-with-generator.patch
Marcus Meissner 85d08c8609 Accepting request 222055 from home:arvidjaar:bnc:862076:Factory
- add autoactivate-lvmetad-with-generator.patch - if use_lvmetad=1,
  automatically activate lvm2-lvmetad.socket to ensure lvmetad is
  started when required (bnc#862076)

OBS-URL: https://build.opensuse.org/request/show/222055
OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=79
2014-02-12 16:13:14 +00:00

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");