Blame SOURCES/0138-RHBZ-1288660-fix-mpathconf-allow.patch

4ae388
---
4ae388
 multipath/mpathconf |   37 ++++++++++++++++++++++++++-----------
4ae388
 1 file changed, 26 insertions(+), 11 deletions(-)
4ae388
4ae388
Index: multipath-tools-130222/multipath/mpathconf
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipath/mpathconf
4ae388
+++ multipath-tools-130222/multipath/mpathconf
4ae388
@@ -42,6 +42,19 @@ function usage
4ae388
 	echo ""
4ae388
 }
4ae388
 
4ae388
+function add_wwid
4ae388
+{
4ae388
+	INDEX=0
4ae388
+	while [ "$INDEX" -lt "$WWIDS" ] ; do
4ae388
+		if [ "$1" = "${WWID_LIST[$INDEX]}" ] ; then
4ae388
+			return
4ae388
+		fi
4ae388
+		((INDEX++))
4ae388
+	done
4ae388
+	WWID_LIST[$WWIDS]="$1"
4ae388
+	((WWIDS++))
4ae388
+}
4ae388
+
4ae388
 function get_dm_deps
4ae388
 {
4ae388
 	shift 3
4ae388
@@ -59,11 +72,9 @@ function get_dm_deps
4ae388
 function set_dm_wwid
4ae388
 {
4ae388
 	if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then
4ae388
-		WWID_LIST[$WWIDS]="${1##part*-mpath-}"
4ae388
-		((WWIDS++))
4ae388
+		add_wwid "${1##part*-mpath-}"
4ae388
 	elif [[ "$1" =~ ^mpath- ]] ; then
4ae388
-		WWID_LIST[$WWIDS]="${1##mpath-}"
4ae388
-		((WWIDS++))
4ae388
+		add_wwid "${1##mpath-}"
4ae388
 	else
4ae388
 		get_dm_deps `dmsetup deps -u $1`
4ae388
 	fi
4ae388
@@ -82,8 +93,7 @@ function set_wwid
4ae388
 	if [ -n "$UUID" ] ; then
4ae388
 		set_dm_wwid $UUID
4ae388
 	else
4ae388
-		WWID_LIST[$WWIDS]="$1"
4ae388
-		((WWIDS++))
4ae388
+		add_wwid "$1"
4ae388
 	fi
4ae388
 }
4ae388
 
4ae388
@@ -198,13 +208,13 @@ function validate_args
4ae388
 
4ae388
 function add_blacklist_exceptions
4ae388
 {
4ae388
-	echo "blacklist_exceptions {" >> $TMPFILE
4ae388
 	INDEX=0
4ae388
 	while [ "$INDEX" -lt "$WWIDS" ] ; do
4ae388
-		echo "	wwid \"${WWID_LIST[$INDEX]}\"" >> $TMPFILE
4ae388
+		sed -i '/^blacklist_exceptions[[:space:]]*{/ a\
4ae388
+	wwid '"\"${WWID_LIST[$INDEX]}\""'
4ae388
+' $TMPFILE
4ae388
 		((INDEX++))
4ae388
 	done
4ae388
-	echo "}" >> $TMPFILE
4ae388
 }
4ae388
 
4ae388
 umask 0077
4ae388
@@ -350,9 +360,14 @@ if [ "$ENABLE" = 2 ]; then
4ae388
 		sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/	wwid ".*"/' $TMPFILE
4ae388
 	fi
4ae388
 	if [ "$HAVE_EXCEPTIONS" = 1 ]; then
4ae388
-		sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/d' $TMPFILE
4ae388
+		sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE
4ae388
+	else
4ae388
+		cat >> $TMPFILE <<- _EOF_
4ae388
+
4ae388
+blacklist_exceptions {
4ae388
+}
4ae388
+_EOF_
4ae388
 	fi
4ae388
-	echo $HAVE_WWID_DISABLE
4ae388
 	add_blacklist_exceptions
4ae388
 elif [ "$ENABLE" = 1 ]; then
4ae388
 	if [ "$HAVE_DISABLE" = 1 ]; then