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

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