Blame SOURCES/0144-RHBZ-1299652-alua-pref-arg.patch

4728c8
---
4728c8
 libmultipath/prioritizers/alua.c |   20 +++++++++++++++++++-
4728c8
 libmultipath/propsel.c           |   18 ++++++++++--------
4728c8
 multipath/multipath.conf.5       |   19 ++++++++++++++++---
4728c8
 3 files changed, 45 insertions(+), 12 deletions(-)
4728c8
4728c8
Index: multipath-tools-130222/libmultipath/prioritizers/alua.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c
4728c8
+++ multipath-tools-130222/libmultipath/prioritizers/alua.c
4728c8
@@ -86,15 +86,33 @@ get_alua_info(int fd, struct alua_contex
4728c8
 	return rc;
4728c8
 }
4728c8
 
4728c8
+int get_exclusive_perf_arg(char *args)
4728c8
+{
4728c8
+	char *ptr;
4728c8
+
4728c8
+	if (args == NULL)
4728c8
+		return 0;
4728c8
+	ptr = strstr(args, "exclusive_pref_bit");
4728c8
+	if (!ptr)
4728c8
+		return 0;
4728c8
+	if (ptr[18] != '\0' && ptr[18] != ' ' && ptr[18] != '\t')
4728c8
+		return 0;
4728c8
+	if (ptr != args && ptr[-1] != ' ' && ptr[-1] != '\t')
4728c8
+		return 0;
4728c8
+	return 1;
4728c8
+}
4728c8
+
4728c8
 int getprio (struct path * pp, char * args)
4728c8
 {
4728c8
 	int rc;
4728c8
 	int aas;
4728c8
 	int priopath;
4728c8
+	int exclusive_perf;
4728c8
 
4728c8
 	if (pp->fd < 0)
4728c8
 		return -ALUA_PRIO_NO_INFORMATION;
4728c8
 
4728c8
+	exclusive_perf = get_exclusive_perf_arg(args);
4728c8
 	rc = get_alua_info(pp->fd, pp->prio.context);
4728c8
 	if (rc >= 0) {
4728c8
 		aas = (rc & 0x0f);
4728c8
@@ -115,7 +133,7 @@ int getprio (struct path * pp, char * ar
4728c8
 			default:
4728c8
 				rc = 0;
4728c8
 		}
4728c8
-		if (priopath && aas != AAS_OPTIMIZED)
4728c8
+		if (priopath && (aas != AAS_OPTIMIZED || exclusive_perf))
4728c8
 			rc += 80;
4728c8
 	} else {
4728c8
 		switch(-rc) {
4728c8
Index: multipath-tools-130222/libmultipath/propsel.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/propsel.c
4728c8
+++ multipath-tools-130222/libmultipath/propsel.c
4728c8
@@ -420,17 +420,19 @@ select_prio (struct path * pp)
4728c8
 		if (prio_selected(p)) {
4728c8
 			condlog(3, "%s: prio = %s (detected setting)",
4728c8
 				pp->dev, prio_name(p));
4728c8
+			condlog(3, "%s: prio args = %s (detected setting)",
4728c8
+				pp->dev, prio_args(p));
4728c8
 			return 0;
4728c8
 		}
4728c8
 	}
4728c8
 
4728c8
-	if ((mpe = find_mpe(pp->wwid))) {
4728c8
-		if (mpe->prio_name) {
4728c8
-			prio_get(p, mpe->prio_name, mpe->prio_args);
4728c8
-			condlog(3, "%s: prio = %s (LUN setting)",
4728c8
-				pp->dev, prio_name(p));
4728c8
-			return 0;
4728c8
-		}
4728c8
+	if ((mpe = find_mpe(pp->wwid)) && mpe->prio_name) {
4728c8
+		prio_get(p, mpe->prio_name, mpe->prio_args);
4728c8
+		condlog(3, "%s: prio = %s (LUN setting)",
4728c8
+			pp->dev, prio_name(p));
4728c8
+		condlog(3, "%s: prio args = %s (LUN setting)",
4728c8
+			pp->dev, prio_args(p));
4728c8
+		return 0;
4728c8
 	}
4728c8
 
4728c8
 	if (pp->hwe && pp->hwe->prio_name) {
4728c8
@@ -452,7 +454,7 @@ select_prio (struct path * pp)
4728c8
 	prio_get(p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS);
4728c8
 	condlog(3, "%s: prio = %s (internal default)",
4728c8
 		pp->dev, DEFAULT_PRIO);
4728c8
-	condlog(3, "%s: prio = %s (internal default)",
4728c8
+	condlog(3, "%s: prio args = %s (internal default)",
4728c8
 		pp->dev, DEFAULT_PRIO_ARGS);
4728c8
 	return 0;
4728c8
 }
4728c8
Index: multipath-tools-130222/multipath/multipath.conf.5
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipath/multipath.conf.5
4728c8
+++ multipath-tools-130222/multipath/multipath.conf.5
4728c8
@@ -182,7 +182,9 @@ Return a constant priority of \fI1\fR.
4728c8
 Generate the path priority for EMC arrays.
4728c8
 .TP
4728c8
 .B alua
4728c8
-Generate the path priority based on the SCSI-3 ALUA settings.
4728c8
+Generate the path priority based on the SCSI-3 ALUA settings. This prioritizer
4728c8
+accepts the optional prio_arg
4728c8
+.I exclusive_pref_bit
4728c8
 .TP
4728c8
 .B ontap
4728c8
 Generate the path priority for NetApp arrays.
4728c8
@@ -208,14 +210,25 @@ Default value is \fBconst\fR.
4728c8
 .RE
4728c8
 .TP
4728c8
 .B prio_args
4728c8
-Arguments to pass to to the prio function.  Currently only used with
4728c8
-.I weighted, which needs a value of the form
4728c8
+Arguments to pass to to the prio function. This only applies to certain
4728c8
+prioritizers
4728c8
+.RS
4728c8
+.TP 12
4728c8
+.B weighted
4728c8
+Needs a value of the form
4728c8
 .I "<hbtl|devname> <regex1> <prio1> <regex2> <prio2> ..."
4728c8
 .I hbtl
4728c8
 regex can be of SCSI H:B:T:L format  Ex: 1:0:.:. , *:0:0:.
4728c8
 .I devname
4728c8
 regex can be of device name format  Ex: sda , sd.e
4728c8
 .TP
4728c8
+.B alua
4728c8
+If
4728c8
+.I exclusive_pref_bit
4728c8
+is set, paths with the TPGS pref bit set will always be in their own path
4728c8
+group.
4728c8
+.RE
4728c8
+.TP
4728c8
 .B features
4728c8
 Specify any device-mapper features to be used. Syntax is
4728c8
 .I num list