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

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