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

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