Check for mount before demoting DRBD filesystem
This update enhances the DRBD OCF script to check whether a filesystem is mounted before attempting to demote it from Primary to Secondary. The demotion attempt will result in DRBD state change failures reported to the console if it is still in use. Change-Id: Ie5abe5d0858f75bd0d31ce8d8d1d04e7beb83132 Story: 2004520 Task: 29398 Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
parent
34bc8404f0
commit
a01bae238b
@ -1,4 +1,4 @@
|
||||
COPY_LIST="$FILES_BASE/* \
|
||||
$DISTRO/patches/* \
|
||||
$CGCS_BASE/downloads/drbd-8.4.3.tar.gz"
|
||||
TIS_PATCH_VER=6
|
||||
TIS_PATCH_VER=7
|
||||
|
@ -34,7 +34,7 @@ Source: http://oss.linbit.com/%{name}/8.3/%{name}-%{version}.tar.gz
|
||||
|
||||
Source1: drbd.service
|
||||
|
||||
# WRS
|
||||
# StarlingX
|
||||
Patch0001: 0001-skip_wait_con_int_on_simplex.patch
|
||||
Patch0002: 0002-drbd-conditional-crm-dependency.patch
|
||||
Patch0003: 0003-drbd_report_condition.patch
|
||||
@ -43,6 +43,7 @@ Patch0005: 0005-drbd_reconnect_standby_standalone.patch
|
||||
Patch0006: 0006-avoid-kernel-userspace-version-check.patch
|
||||
Patch0007: 0007-Update-OCF-to-attempt-connect-in-certain-states.patch
|
||||
Patch0008: 0008-Increase-short-cmd-timeout-to-15-secs.patch
|
||||
Patch0009: 0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch
|
||||
|
||||
License: GPLv2+
|
||||
ExclusiveOS: linux
|
||||
@ -271,6 +272,7 @@ management utility.
|
||||
%patch0006 -p1
|
||||
%patch0007 -p1
|
||||
%patch0008 -p1
|
||||
%patch0009 -p1
|
||||
|
||||
%build
|
||||
%configure \
|
||||
|
@ -0,0 +1,45 @@
|
||||
From 017157d21a56410811384a43d0b0cbba6444baeb Mon Sep 17 00:00:00 2001
|
||||
From: Don Penney <don.penney@windriver.com>
|
||||
Date: Wed, 6 Feb 2019 01:19:59 -0500
|
||||
Subject: [PATCH] Check for mounted device before demoting Primary DRBD
|
||||
resource
|
||||
|
||||
Update the OCF script to check for a mounted device when demoting
|
||||
a resource that's in the Primary state. The state change will fail
|
||||
if it is still in use, otherwise.
|
||||
|
||||
Signed-off-by: Don Penney <don.penney@windriver.com>
|
||||
---
|
||||
scripts/drbd.ocf | 16 +++++++++++++++-
|
||||
1 file changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
|
||||
index e03bf6d..95da11a 100644
|
||||
--- a/scripts/drbd.ocf
|
||||
+++ b/scripts/drbd.ocf
|
||||
@@ -720,7 +720,21 @@ drbd_stop() {
|
||||
;;
|
||||
$OCF_RUNNING_MASTER)
|
||||
ocf_log warn "$DRBD_RESOURCE still Primary, demoting."
|
||||
- do_drbdadm secondary $DRBD_RESOURCE
|
||||
+ found=no
|
||||
+ for dev in ${DRBD_DEVICES[@]} ""; do
|
||||
+ cat /proc/mounts | grep -q "^${dev} "
|
||||
+ if [ $? -eq 0 ]; then
|
||||
+ ocf_log warn "${DRBD_RESOURCE} is still mounted via $dev"
|
||||
+ found=yes
|
||||
+ break
|
||||
+ fi
|
||||
+ done
|
||||
+ if [ "${found}" = "yes" ]; then
|
||||
+ ocf_log warn "Waiting to drop $DRBD_RESOURCE"
|
||||
+ else
|
||||
+ ocf_log warn "Dropping $DRBD_RESOURCE to Secondary"
|
||||
+ do_drbdadm secondary $DRBD_RESOURCE
|
||||
+ fi
|
||||
esac
|
||||
$first_try || sleep 1
|
||||
first_try=false
|
||||
--
|
||||
1.8.3.1
|
||||
|
Loading…
Reference in New Issue
Block a user