|
|
184fb6 |
From 79fb4b2d3d862f4e83b1df72107b6322b420ea34 Mon Sep 17 00:00:00 2001
|
|
|
184fb6 |
From: Reid Wahl <nrwahl@protonmail.com>
|
|
|
184fb6 |
Date: Sat, 28 Nov 2020 18:10:03 -0800
|
|
|
184fb6 |
Subject: [PATCH] LVM-activate: Stop before blk-availability.service
|
|
|
184fb6 |
|
|
|
184fb6 |
If storage services (e.g., iscsi-shutdown.service) stop before an
|
|
|
184fb6 |
LVM-activate resource stops, the managed VG may become unavailable. Then
|
|
|
184fb6 |
the LVM-activate resource may fail to deactivate the volume group and
|
|
|
184fb6 |
thus fail its stop operation.
|
|
|
184fb6 |
|
|
|
184fb6 |
This commit adds a systemd drop-in "After=blk-availability.service"
|
|
|
184fb6 |
directive for resource-agents-deps.target during the LVM-activate start
|
|
|
184fb6 |
op. blk-availability includes "After=" directives for other storage
|
|
|
184fb6 |
services and thus serves as a convenient wrapper.
|
|
|
184fb6 |
|
|
|
184fb6 |
blk-availability is not enabled by default, and a "Wants=" drop-in
|
|
|
184fb6 |
that's created after Pacemaker starts would not be able to start
|
|
|
184fb6 |
blk-availability automatically. So here we also start blk-availability
|
|
|
184fb6 |
during LVM_start().
|
|
|
184fb6 |
|
|
|
184fb6 |
Resolves RHBZ#1902208
|
|
|
184fb6 |
|
|
|
184fb6 |
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
|
|
184fb6 |
---
|
|
|
184fb6 |
heartbeat/LVM-activate | 22 ++++++++++++++++++++++
|
|
|
184fb6 |
1 file changed, 22 insertions(+)
|
|
|
184fb6 |
|
|
|
184fb6 |
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
|
|
|
184fb6 |
index 94f9e5813..b8abd7579 100755
|
|
|
184fb6 |
--- a/heartbeat/LVM-activate
|
|
|
184fb6 |
+++ b/heartbeat/LVM-activate
|
|
|
184fb6 |
@@ -830,6 +830,28 @@ lvm_start() {
|
|
|
184fb6 |
local rc
|
|
|
184fb6 |
local vol
|
|
|
184fb6 |
|
|
|
184fb6 |
+ if systemd_is_running ; then
|
|
|
184fb6 |
+ # Create drop-in to deactivate VG before stopping
|
|
|
184fb6 |
+ # storage services during shutdown/reboot.
|
|
|
184fb6 |
+ after=$(systemctl show resource-agents-deps.target.d \
|
|
|
184fb6 |
+ --property=After | cut -d'=' -f2)
|
|
|
184fb6 |
+
|
|
|
184fb6 |
+ case "$after" in
|
|
|
184fb6 |
+ *" blk-availability.service "*)
|
|
|
184fb6 |
+ ;;
|
|
|
184fb6 |
+ *)
|
|
|
184fb6 |
+ systemd_drop_in "99-LVM-activate" "After" \
|
|
|
184fb6 |
+ "blk-availability.service"
|
|
|
184fb6 |
+ ;;
|
|
|
184fb6 |
+ esac
|
|
|
184fb6 |
+
|
|
|
184fb6 |
+ # If blk-availability isn't started, the "After="
|
|
|
184fb6 |
+ # directive has no effect.
|
|
|
184fb6 |
+ if ! systemctl is-active blk-availability.service ; then
|
|
|
184fb6 |
+ systemctl start blk-availability.service
|
|
|
184fb6 |
+ fi
|
|
|
184fb6 |
+ fi
|
|
|
184fb6 |
+
|
|
|
184fb6 |
if lvm_status ; then
|
|
|
184fb6 |
ocf_log info "${vol}: is already active."
|
|
|
184fb6 |
return $OCF_SUCCESS
|