Skip to contentSkip to conversation

multipath-tools ./Makefile ./multipath.conf.an ...

PATCH [email protected] 1 participant 1 message May 15, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: [email protected] 2009-05-15 21:01:27

Modified files:

	.              : Makefile multipath.conf.annotated 
	libmultipath   : callout.c config.c config.h dict.c propsel.c 
	multipath      : Makefile multipath.conf.5 
	multipathd     : multipathd.init.redhat 

Added files:
path_priority/pp_weighted: Makefile pp_weighted.c

Log message:
Fix for 437588. Added a new prio callout mpath_prio_weighted. This allows people to add priorities based on a device's devname or HTBL. However, this callout has problems. On reboots and driver reloads, the devname and HTBL can change. But if people really want to use this anyway, they can.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/Makefile.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.7.2.3&r2=1.7.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.12&r2=1.18.2.13
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/callout.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.2.1&r2=1.5.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.8&r2=1.19.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.7&r2=1.18.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.10&r2=1.17.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.2&r2=1.11.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/Makefile.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.2&r2=1.17.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/multipath.conf.5.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/multipathd.init.redhat.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.2.4.4&r2=1.2.4.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_weighted/Makefile.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_weighted/pp_weighted.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.1.2.1

Makefile +3 -2
@@ -22,13 +22,14 @@
 BUILDDIRS = multipath multipathd kpartx cciss_id path_priority/pp_alua \
 	    path_priority/pp_emc path_priority/pp_hds_modular \
 	    path_priority/pp_netapp path_priority/pp_rdac \
-	    path_priority/pp_tpc path_priority/pp_hp_sw
+	    path_priority/pp_tpc path_priority/pp_hp_sw \
+	    path_priority/pp_weighted
 
 ALLDIRS = multipath multipathd kpartx cciss_id path_priority/pp_alua \
 	  path_priority/pp_emc path_priority/pp_hds_modular \
 	  path_priority/pp_netapp path_priority/pp_rdac \
 	  path_priority/pp_hp_sw path_priority/pp_tpc \
-	  libmultipath libcheckers
+	  path_priority/pp_weighted libmultipath libcheckers
 
 VERSION = $(shell basename ${PWD} | cut -d'-' -f3)
 
multipath.conf.annotated +11 -0
@@ -302,6 +302,17 @@
 #		path_grouping_policy	multibus
 #
 #		#
+#		# name    : prio_callout
+#		# scope   : multipath
+#		# desc    : the program and args to callout to obtain a path
+#		#           weight. Weights are summed for each path group to
+#		#	    determine the next PG to use case of failure.
+#		#	    "none" is a valid value.
+#		# default : no callout, all paths equals
+#		#
+#		prio_callout          "/sbin/mpath_prio_balance_units %d"
+#
+#		#
 #		# name    : path_selector
 #		# desc    : the path selector algorithm to use for this mpath
 #		#           these algo are offered by the kernel mpath target
libmultipath/callout.c +12 -0
@@ -189,6 +189,18 @@
 		snprintf(p, len, "%s", pp->dev_t);
 		p += len - 1;
 		break;
+	case 'h':
+		if (pp->sg_id.host_no < 0)
+			len = snprintf(p, myfree, "#:#:#:#");
+		else
+			len = snprintf(p, myfree, "%d:%d:%d:%d",
+				       pp->sg_id.host_no, pp->sg_id.channel,
+				       pp->sg_id.scsi_id, pp->sg_id.lun);
+		myfree -= (len + 1);
+		if (myfree < 2)
+			return 1;
+		p += len;
+		break;
 	default:
 		break;
 	}
libmultipath/config.c +3 -0
@@ -219,6 +219,9 @@
 	if (mpe->alias)
 		FREE(mpe->alias);
 
+	if (mpe->getprio)
+		FREE(mpe->getprio);
+
 	FREE(mpe);
 }
 
libmultipath/config.h +1 -0
@@ -39,6 +39,7 @@
 	char * alias;
 	char * getuid;
 	char * selector;
+	char * getprio;
 
 	int pgpolicy;
 	int pgfailback;
libmultipath/dict.c +45 -2

77 lines not on this page · raw message

libmultipath/propsel.c +10 -0
@@ -259,6 +259,16 @@
 extern int
 select_getprio (struct path * pp)
 {
+	struct mpentry * mpe;
+
+	if ((mpe = find_mpe(pp->wwid))) {
+		if (mpe->getprio) {
+			pp->getprio = mpe->getprio;
+			condlog(3, "%s: getprio = %s (LUN setting)",
+				pp->dev, pp->getprio);
+			return 0;
+		}
+	}
 	if (pp->hwe && pp->hwe->getprio) {
 		pp->getprio = pp->hwe->getprio;
 		condlog(3, "%s: getprio = %s (controller setting)",
multipath/Makefile +1 -1
@@ -55,7 +55,7 @@
 	rm $(DESTDIR)$(bindir)/mpath_wait
 	rm $(DESTDIR)$(bindir)/mpath_ctl
 	rm $(DESTDIR)$(mandir)/$(EXEC).8
-	rm $(DESTDIR)$(mandir)/$(EXEC).conf.5
+	rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5
 
 clean:
 	$(MAKE) -C $(multipathdir) clean
multipath/Attic/multipath.conf.5 +14 -0
@@ -143,6 +143,18 @@
 .B mpath_prio_hds_modular %b
 Generate the path priority for Hitachi HDS Modular storage arrays.
 .TP
+.B mpath_prio_weighted %n|%h <regex1> <prio1> [<regex2> <prio2>] ...
+Generate a path priority based on the matching either the device name \fI%n\fR
+or the H:B:T:L \fI%h\fR of the devices against a series of regular expressions.
+\fIWARNING:\fR Both the device name and the H:B:T:L of a device can change when
+the node is rebooted, or the device driver is reloaded. If you use this callout
+it may be necessary to manually edit your regular expressions whenever either
+of these events occurs.
+\fINOTE:\fR The regular expression must match the complete device name or
+H:B:T:L. For instance a regular expression of \fIsda\fR will only match a
+device named sda, not sdaa, sdab, etc. To match all of them, you would need to
+use the regular expression \fIsda.*\fR
+.TP
 Default value is \fBnone\fR.
 .RE
 .TP
@@ -343,6 +355,8 @@
 .TP 18
 .B path_grouping_policy
 .TP
+.B prio_callout
+.TP
 .B path_selector
 .TP
 .B failback
multipathd/multipathd.init.redhat +2 -3
@@ -29,8 +29,7 @@
 
 teardown_slaves()
 {
-pwd=`pwd`
-cd $1; 
+pushd $1 > /dev/null
 if [ -d "slaves" ]; then
 for slave in slaves/*;
 do
@@ -55,7 +54,7 @@
 			exit 1
 		fi
 fi
-cd $pwd
+popd > /dev/null
 }
 
 #