|
|
e65fa3 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
e65fa3 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
e65fa3 |
Date: Thu, 3 Feb 2022 13:26:18 -0600
|
|
|
e65fa3 |
Subject: [PATCH] RH: add support to mpathconf for setting recheck_wwid
|
|
|
e65fa3 |
|
|
|
e65fa3 |
mpathconf now supports --recheck_wwid <y|n> for setthing the
|
|
|
e65fa3 |
recheck_wwid option
|
|
|
e65fa3 |
|
|
|
e65fa3 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
e65fa3 |
---
|
|
|
e65fa3 |
multipath/mpathconf | 48 ++++++++++++++++++++++++++++++++++++++++---
|
|
|
e65fa3 |
multipath/mpathconf.8 | 9 ++++++++
|
|
|
e65fa3 |
2 files changed, 54 insertions(+), 3 deletions(-)
|
|
|
e65fa3 |
|
|
|
e65fa3 |
diff --git a/multipath/mpathconf b/multipath/mpathconf
|
|
|
e65fa3 |
index 6e33fb99..319664b1 100644
|
|
|
e65fa3 |
--- a/multipath/mpathconf
|
|
|
e65fa3 |
+++ b/multipath/mpathconf
|
|
|
e65fa3 |
@@ -17,7 +17,7 @@
|
|
|
e65fa3 |
# This program was largely ripped off from lvmconf
|
|
|
e65fa3 |
#
|
|
|
e65fa3 |
|
|
|
e65fa3 |
-unset ENABLE FIND FRIENDLY PROPERTY FOREIGN MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_PROPERTY HAVE_FOREIGN HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST HAVE_OPTION OPTION_NAME OPTION_VALUE
|
|
|
e65fa3 |
+unset ENABLE FIND FRIENDLY PROPERTY FOREIGN MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_PROPERTY HAVE_FOREIGN HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST HAVE_OPTION OPTION_NAME OPTION_VALUE HAVE_RECHECK_WWID RECHECK_WWID
|
|
|
e65fa3 |
|
|
|
e65fa3 |
DEFAULT_CONFIG="# device-mapper-multipath configuration file
|
|
|
e65fa3 |
|
|
|
e65fa3 |
@@ -52,6 +52,7 @@ function usage
|
|
|
e65fa3 |
echo "Set find_multipaths (Default y): --find_multipaths <yes|no|strict|greedy|smart>"
|
|
|
e65fa3 |
echo "Set default property blacklist (Default n): --property_blacklist <y|n>"
|
|
|
e65fa3 |
echo "Set enable_foreign to show foreign devices (Default n): --enable_foreign <y|n>"
|
|
|
e65fa3 |
+ echo "Set recheck_wwid (Defaut n): --recheck_wwid <y|n>"
|
|
|
e65fa3 |
echo "Add/Change/Remove option in defaults section: --option <option_name>:<value>"
|
|
|
e65fa3 |
echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
|
|
|
e65fa3 |
echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
|
|
|
e65fa3 |
@@ -145,6 +146,15 @@ function parse_args
|
|
|
e65fa3 |
exit 1
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
;;
|
|
|
e65fa3 |
+ --recheck_wwid)
|
|
|
e65fa3 |
+ if [ -n "$2" ]; then
|
|
|
e65fa3 |
+ RECHECK_WWID=$2
|
|
|
e65fa3 |
+ shift 2
|
|
|
e65fa3 |
+ else
|
|
|
e65fa3 |
+ usage
|
|
|
e65fa3 |
+ exit 1
|
|
|
e65fa3 |
+ fi
|
|
|
e65fa3 |
+ ;;
|
|
|
e65fa3 |
--find_multipaths)
|
|
|
e65fa3 |
if [ -n "$2" ]; then
|
|
|
e65fa3 |
FIND=$2
|
|
|
e65fa3 |
@@ -223,7 +233,7 @@ function parse_args
|
|
|
e65fa3 |
|
|
|
e65fa3 |
function validate_args
|
|
|
e65fa3 |
{
|
|
|
e65fa3 |
- if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$PROPERTY" -o -n "$MODULE" -o -n "$FOREIGN" -o -n "$OPTION_NAME" ]; then
|
|
|
e65fa3 |
+ if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$PROPERTY" -o -n "$MODULE" -o -n "$FOREIGN" -o -n "$OPTION_NAME" -o -n "$RECHECK_WWID" ]; then
|
|
|
e65fa3 |
echo "ignoring extra parameters on disable"
|
|
|
e65fa3 |
FRIENDLY=""
|
|
|
e65fa3 |
FIND=""
|
|
|
e65fa3 |
@@ -232,11 +242,16 @@ function validate_args
|
|
|
e65fa3 |
FOREIGN=""
|
|
|
e65fa3 |
OPTION_NAME=""
|
|
|
e65fa3 |
OPTION_VALUE=""
|
|
|
e65fa3 |
+ RECHECK_WWID=""
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then
|
|
|
e65fa3 |
echo "--user_friendly_names must be either 'y' or 'n'"
|
|
|
e65fa3 |
exit 1
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
+ if [ -n "$RECHECK_WWID" ] && [ "$RECHECK_WWID" != "y" -a "$RECHECK_WWID" != "n" ]; then
|
|
|
e65fa3 |
+ echo "--recheck_wwid must be either 'y' or 'n'"
|
|
|
e65fa3 |
+ exit 1
|
|
|
e65fa3 |
+ fi
|
|
|
e65fa3 |
if [ "$FIND" = "y" ]; then
|
|
|
e65fa3 |
FIND="yes"
|
|
|
e65fa3 |
elif [ "$FIND" = "n" ]; then
|
|
|
e65fa3 |
@@ -265,7 +280,7 @@ function validate_args
|
|
|
e65fa3 |
OPTION_VALUE=\"$OPTION_VALUE\"
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
- if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" -a -z "$FOREIGN" -a -z "$OPTION_NAME" ]; then
|
|
|
e65fa3 |
+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" -a -z "$FOREIGN" -a -z "$OPTION_NAME" -a -z "$RECHECK_WWID" ]; then
|
|
|
e65fa3 |
SHOW_STATUS=1
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
|
|
|
e65fa3 |
@@ -367,6 +382,11 @@ if [ "$HAVE_DEFAULTS" = "1" ]; then
|
|
|
e65fa3 |
elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(no\|0\)" ; then
|
|
|
e65fa3 |
HAVE_FRIENDLY=0
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(yes\|1\)" ; then
|
|
|
e65fa3 |
+ HAVE_RECHECK_WWID=1
|
|
|
e65fa3 |
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(no\|0\)" ; then
|
|
|
e65fa3 |
+ HAVE_RECHECK_WWID=0
|
|
|
e65fa3 |
+ fi
|
|
|
e65fa3 |
if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*enable_foreign" ; then
|
|
|
e65fa3 |
HAVE_FOREIGN=0
|
|
|
e65fa3 |
elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"\.\*\"" ; then
|
|
|
e65fa3 |
@@ -411,6 +431,11 @@ if [ -n "$SHOW_STATUS" ]; then
|
|
|
e65fa3 |
else
|
|
|
e65fa3 |
echo "user_friendly_names is enabled"
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
+ if [ -z "$HAVE_RECHECK_WWID" -o "$HAVE_RECHECK_WWID" = 0 ]; then
|
|
|
e65fa3 |
+ echo "recheck_wwid is disabled"
|
|
|
e65fa3 |
+ else
|
|
|
e65fa3 |
+ echo "recheck_wwid is enabled"
|
|
|
e65fa3 |
+ fi
|
|
|
e65fa3 |
if [ -z "$HAVE_PROPERTY" -o "$HAVE_PROPERTY" = 0 ]; then
|
|
|
e65fa3 |
echo "default property blacklist is disabled"
|
|
|
e65fa3 |
else
|
|
|
e65fa3 |
@@ -527,6 +552,23 @@ elif [ "$FRIENDLY" = "y" ]; then
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
fi
|
|
|
e65fa3 |
|
|
|
e65fa3 |
+if [ "$RECHECK_WWID" = "n" ]; then
|
|
|
e65fa3 |
+ if [ "$HAVE_RECHECK_WWID" = 1 ]; then
|
|
|
e65fa3 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(yes\|1\)/ recheck_wwid no/' $TMPFILE
|
|
|
e65fa3 |
+ CHANGED_CONFIG=1
|
|
|
e65fa3 |
+ fi
|
|
|
e65fa3 |
+elif [ "$RECHECK_WWID" = "y" ]; then
|
|
|
e65fa3 |
+ if [ -z "$HAVE_RECHECK_WWID" ]; then
|
|
|
e65fa3 |
+ sed -i '/^defaults[[:space:]]*{/ a\
|
|
|
e65fa3 |
+ recheck_wwid yes
|
|
|
e65fa3 |
+' $TMPFILE
|
|
|
e65fa3 |
+ CHANGED_CONFIG=1
|
|
|
e65fa3 |
+ elif [ "$HAVE_RECHECK_WWID" = 0 ]; then
|
|
|
e65fa3 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(no\|0\)/ recheck_wwid yes/' $TMPFILE
|
|
|
e65fa3 |
+ CHANGED_CONFIG=1
|
|
|
e65fa3 |
+ fi
|
|
|
e65fa3 |
+fi
|
|
|
e65fa3 |
+
|
|
|
e65fa3 |
if [ "$PROPERTY" = "n" ]; then
|
|
|
e65fa3 |
if [ "$HAVE_PROPERTY" = 1 ]; then
|
|
|
e65fa3 |
sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/# property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
|
|
|
e65fa3 |
diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8
|
|
|
e65fa3 |
index 496383b7..9c2fb835 100644
|
|
|
e65fa3 |
--- a/multipath/mpathconf.8
|
|
|
e65fa3 |
+++ b/multipath/mpathconf.8
|
|
|
e65fa3 |
@@ -77,6 +77,15 @@ to the
|
|
|
e65fa3 |
defaults section. If set to \fBn\fP, this removes the line, if present. This
|
|
|
e65fa3 |
command can be used along with any other command.
|
|
|
e65fa3 |
.TP
|
|
|
e65fa3 |
+.B --recheck_wwid \fP { \fBy\fP | \fBn\fP }
|
|
|
e65fa3 |
+If set to \fBy\fP, this adds the line
|
|
|
e65fa3 |
+.B recheck_wwid yes
|
|
|
e65fa3 |
+to the
|
|
|
e65fa3 |
+.B /etc/multipath.conf
|
|
|
e65fa3 |
+defaults section, or sets an existing line to \fByes\fP. If set to \fBn\fP, this
|
|
|
e65fa3 |
+sets an existing \fBrecheck_wwid\fP line to \fBno\fP. This command can be used
|
|
|
e65fa3 |
+along with any other command.
|
|
|
e65fa3 |
+.TP
|
|
|
e65fa3 |
.B --find_multipaths\fP { \fByes\fP | \fBno\fP | \fBstrict\fP | \fBgreedy\fP | \fBsmart\fP }
|
|
|
e65fa3 |
If set to \fB<value>\fP, this adds the line
|
|
|
e65fa3 |
.B find_multipaths <value>
|