File 0020-Medium-Raid1-Handle-case-when-mddev-is-a-symlink.patch of Package resource-agents.11561
From a2c60be4004a8a4a6e3aeb173958bb57fe887cf0 Mon Sep 17 00:00:00 2001
From: Zhilong Liu <zlliu@suse.com>
Date: Thu, 13 Jul 2017 02:51:10 -0500
Subject: [PATCH 20/21] Medium: Raid1: Handle case when mddev is a symlink
For the mddev name, the function raid1_monitor_one()
should parse whether or not the $mddev is a symlink,
because the symlink name wouldn't show in /proc/mdstat
and result in "raid1_monitor_one()" returns failure.
---
heartbeat/Raid1 | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/heartbeat/Raid1 b/heartbeat/Raid1
index 7cf658b5..859eaa88 100755
--- a/heartbeat/Raid1
+++ b/heartbeat/Raid1
@@ -353,16 +353,22 @@ raid1_stop() {
#
raid1_monitor_one() {
local mddev=$1
- local md=`echo $mddev | sed 's,/dev/,,'`
+ local md=
local rc
local TRY_READD=0
local pbsize
# check if the md device exists first
# but not if we are in the stop operation
# device existence is important only for the running arrays
- if [ "$__OCF_ACTION" != "stop" -a ! -b $mddev ]; then
- ocf_log info "$mddev is not a block device"
- return $OCF_NOT_RUNNING
+ if [ "$__OCF_ACTION" != "stop" ]; then
+ if [ -h "$mddev" ]; then
+ md=$(ls $mddev -l | awk -F'/' '{print $NF}')
+ elif [ -b "$mddev" ]; then
+ md=$(echo $mddev | sed 's,/dev/,,')
+ else
+ ocf_log info "$mddev is not a block device"
+ return $OCF_NOT_RUNNING
+ fi
fi
if ! grep -e "^$md[ \t:]" /proc/mdstat >/dev/null ; then
ocf_log info "$md not found in /proc/mdstat"
--
2.14.1