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