1From 8f52504859704466667e042baf437c2b6272ffb9 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Mon, 26 Nov 2018 09:55:12 +0800
4Subject: [PATCH 05/12] RH: add mpathconf
5
6mpathconf is a program (largely based on lvmcomf) to help users
7configure /etc/multipath.conf and enable or disable multipathing.  It
8has a couple of built-in options that can be set directly from the
9command line.  But, mostly it is used to get a multipath.conf file
10with the OS defaults, and to enable and disable multipathing via
11a single command.
12
13Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
14
15Upstream-Status: Pending
16
17[OP: Rebase to 0.9.3]
18Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
19
20Rebase to 0.9.8
21Signed-off-by: Changqing Li <changqing.li@windriver.com>
22---
23 libmultipath/config.c |   1 +
24 multipath/Makefile    |   4 +
25 multipath/mpathconf   | 464 ++++++++++++++++++++++++++++++++++++++++++
26 multipath/mpathconf.8 | 101 +++++++++
27 4 files changed, 570 insertions(+)
28 create mode 100644 multipath/mpathconf
29 create mode 100644 multipath/mpathconf.8
30
31diff --git a/libmultipath/config.c b/libmultipath/config.c
32index 8a3a8f37..a40b41ab 100644
33--- a/libmultipath/config.c
34+++ b/libmultipath/config.c
35@@ -962,6 +962,7 @@ int _init_config (const char *file, struct config *conf)
36 		validate_pctable(conf->overrides, 0, file);
37 	} else {
38 		condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
39+		condlog(0, "You can run /sbin/mpathconf to create or modify /etc/multipath.conf");
40 		if (conf->blist_devnode == NULL) {
41 			conf->blist_devnode = vector_alloc();
42 			if (!conf->blist_devnode) {
43diff --git a/multipath/Makefile b/multipath/Makefile
44index 2ea9e528..6b1fa09e 100644
45--- a/multipath/Makefile
46+++ b/multipath/Makefile
47@@ -24,6 +24,7 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
48 install:
49 	$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
50 	$(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
51+	$(Q)$(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
52 	$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
53 	$(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
54 	$(Q)$(INSTALL_PROGRAM) -m 644 99-z-dm-mpath-late.rules $(DESTDIR)$(udevrulesdir)
55@@ -34,6 +35,7 @@ install:
56 	$(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
57 	$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5
58 	$(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5
59+	$(Q)$(INSTALL_PROGRAM) -m 644 mpathconf.8 $(DESTDIR)$(mandir)/man8
60 	$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir)
61 ifeq ($(MODPROBE_UNIT),)
62 	$(Q)$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
63@@ -51,8 +53,10 @@ uninstall:
64 	$(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
65 	$(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
66 	$(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
67+	$(Q)$(RM) $(DESTDIR)$(bindir)/mpathconf
68 	$(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
69 	$(Q)$(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
70+	$(Q)$(RM) $(DESTDIR)$(mandir)/man8/mpathconf.8
71 	$(Q)$(RM) $(DESTDIR)$(tmpfilesdir)/multipath.conf
72
73 clean: dep_clean
74diff --git a/multipath/mpathconf b/multipath/mpathconf
75new file mode 100644
76index 00000000..e8391347
77--- /dev/null
78+++ b/multipath/mpathconf
79@@ -0,0 +1,464 @@
80+#!/bin/bash
81+#
82+# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
83+#
84+# This file is part of the device-mapper-multipath package.
85+#
86+# This copyrighted material is made available to anyone wishing to use,
87+# modify, copy, or redistribute it subject to the terms and conditions
88+# of the GNU General Public License v.2.
89+#
90+# You should have received a copy of the GNU General Public License
91+# along with this program; if not, write to the Free Software Foundation,
92+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
93+
94+#
95+# Simple editting of /etc/multipath.conf
96+# This program was largely ripped off from lvmconf
97+#
98+
99+unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST
100+
101+DEFAULT_CONFIG="# device-mapper-multipath configuration file
102+
103+# For a complete list of the default configuration values, run either:
104+# # multipath -t
105+# or
106+# # multipathd show config
107+
108+# For a list of configuration options with descriptions, see the
109+# multipath.conf man page.
110+
111+defaults {
112+	user_friendly_names yes
113+	find_multipaths yes
114+}
115+
116+blacklist_exceptions {
117+        property \"(SCSI_IDENT_|ID_WWN)\"
118+}"
119+
120+CONFIGFILE="/etc/multipath.conf"
121+OUTPUTFILE="/etc/multipath.conf"
122+MULTIPATHDIR="/etc/multipath"
123+TMPFILE="/etc/multipath/.multipath.conf.tmp"
124+WWIDS=0
125+
126+function usage
127+{
128+	echo "usage: $0 <command>"
129+	echo ""
130+	echo "Commands:"
131+	echo "Enable: --enable "
132+	echo "Disable: --disable"
133+	echo "Only allow certain wwids (instead of enable): --allow <WWID>"
134+	echo "Set user_friendly_names (Default y): --user_friendly_names <y|n>"
135+	echo "Set find_multipaths (Default y): --find_multipaths <y|n>"
136+	echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
137+	echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
138+	echo "select output file (Default /etc/multipath.conf): --outfile <FILE>"
139+	echo ""
140+}
141+
142+function add_wwid
143+{
144+	INDEX=0
145+	while [ "$INDEX" -lt "$WWIDS" ] ; do
146+		if [ "$1" = "${WWID_LIST[$INDEX]}" ] ; then
147+			return
148+		fi
149+		((INDEX++))
150+	done
151+	WWID_LIST[$WWIDS]="$1"
152+	((WWIDS++))
153+}
154+
155+function get_dm_deps
156+{
157+	shift 3
158+	while [ -n "$1" -a -n "$2" ]; do
159+		MAJOR=$(echo $1 | tr -d '(,')
160+		MINOR=$(echo $2 | tr -d ')')
161+		UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR  2> /dev/null`
162+		if [ -n "$UUID" ] ; then
163+			set_dm_wwid $UUID
164+		fi
165+		shift 2
166+	done
167+}
168+
169+function set_dm_wwid
170+{
171+	if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then
172+		add_wwid "${1##part*-mpath-}"
173+	elif [[ "$1" =~ ^mpath- ]] ; then
174+		add_wwid "${1##mpath-}"
175+	else
176+		get_dm_deps `dmsetup deps -u $1`
177+	fi
178+}
179+
180+function set_wwid
181+{
182+	UUID=""
183+	if [[ "$1" =~ ^[[:digit:]]+:[[:digit:]]+$ ]] ; then
184+		MAJOR=${1%%:*}
185+		MINOR=${1##*:}
186+		UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR  2> /dev/null`
187+	else
188+		UUID=`dmsetup info -c --noheadings -o uuid $1 2> /dev/null`
189+	fi
190+	if [ -n "$UUID" ] ; then
191+		set_dm_wwid $UUID
192+	else
193+		add_wwid "$1"
194+	fi
195+}
196+
197+function parse_args
198+{
199+	while [ -n "$1" ]; do
200+		case $1 in
201+			--enable)
202+				ENABLE=1
203+				shift
204+				;;
205+			--disable)
206+				ENABLE=0
207+				shift
208+				;;
209+			--allow)
210+				ENABLE=2
211+				if [ -n "$2" ]; then
212+					set_wwid $2
213+					shift 2
214+				else
215+					usage
216+					exit 1
217+				fi
218+				;;
219+			--user_friendly_names)
220+				if [ -n "$2" ]; then
221+					FRIENDLY=$2
222+					shift 2
223+				else
224+					usage
225+					exit 1
226+				fi
227+				;;
228+			--find_multipaths)
229+				if [ -n "$2" ]; then
230+					FIND=$2
231+					shift 2
232+				else
233+					usage
234+					exit 1
235+				fi
236+				;;
237+			--with_module)
238+				if [ -n "$2" ]; then
239+					MODULE=$2
240+					shift 2
241+				else
242+					usage
243+					exit 1
244+				fi
245+				;;
246+			--with_multipathd)
247+				if [ -n "$2" ]; then
248+					MULTIPATHD=$2
249+					shift 2
250+				else
251+					usage
252+					exit 1
253+				fi
254+				;;
255+			--outfile)
256+				if [ -n "$2" ]; then
257+					OUTPUTFILE=$2
258+					HAVE_OUTFILE=1
259+					shift 2
260+				else
261+					usage
262+					exit 1
263+				fi
264+				;;
265+			*)
266+				usage
267+				exit
268+		esac
269+	done
270+}
271+
272+function validate_args
273+{
274+	if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$MODULE" ]; then
275+		echo "ignoring extra parameters on disable"
276+		FRIENDLY=""
277+		FIND=""
278+		MODULE=""
279+	fi
280+	if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then
281+		echo "--user_friendly_names must be either 'y' or 'n'"
282+		exit 1
283+	fi
284+	if [ -n "$FIND" ] && [ "$FIND" != "y" -a "$FIND" != "n" ]; then
285+		echo "--find_multipaths must be either 'y' or 'n'"
286+		exit 1
287+	fi
288+	if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" ]; then
289+		SHOW_STATUS=1
290+	fi
291+	if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
292+		echo "--with_module must be either 'y' or 'n'"
293+		exit 1
294+	fi
295+	if [ -n "$MULTIPATHD" ] && [ "$MULTIPATHD" != "y" -a "$MULTIPATHD" != "n" ]; then
296+		echo "--with_multipathd must be either 'y' or 'n'"
297+		exit 1
298+	fi
299+	if [ "$ENABLE" = 2 -a -z "$HAVE_OUTFILE" ]; then
300+		echo "Because --allow makes changes that cannot be automatically reversed,"
301+		echo "you must set --outfile when you set --allow"
302+		exit 1
303+	fi
304+}
305+
306+function add_blacklist_exceptions
307+{
308+	INDEX=0
309+	while [ "$INDEX" -lt "$WWIDS" ] ; do
310+		sed -i '/^blacklist_exceptions[[:space:]]*{/ a\
311+	wwid '"\"${WWID_LIST[$INDEX]}\""'
312+' $TMPFILE
313+		((INDEX++))
314+	done
315+}
316+
317+umask 0077
318+
319+parse_args "$@"
320+
321+validate_args
322+
323+if [ ! -d "$MULTIPATHDIR" ]; then
324+	echo "/etc/multipath/ does not exist. failing"
325+	exit 1
326+fi
327+
328+rm $TMPFILE 2> /dev/null
329+echo "$DEFAULT_CONFIG" > $TMPFILE
330+if [ -f "$CONFIGFILE" ]; then
331+	cp $CONFIGFILE $TMPFILE
332+fi
333+
334+if grep -q "^blacklist[[:space:]]*{" $TMPFILE ; then
335+	HAVE_BLACKLIST=1
336+fi
337+
338+if grep -q "^blacklist_exceptions[[:space:]]*{" $TMPFILE ; then
339+	HAVE_EXCEPTIONS=1
340+fi
341+
342+if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then
343+	HAVE_DEFAULTS=1
344+fi
345+
346+if [ -z "$MODULE" -o "$MODULE" = "y" ]; then
347+	if lsmod | grep -q "dm_multipath" ; then
348+		HAVE_MODULE=1
349+	else
350+		HAVE_MODULE=0
351+	fi
352+fi
353+
354+if [ "$MULTIPATHD" = "y" ]; then
355+	if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then
356+		HAVE_MULTIPATHD=1
357+	else
358+		HAVE_MULTIPATHD=0
359+	fi
360+fi
361+
362+if [ "$HAVE_BLACKLIST" = "1" ]; then
363+	if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then
364+		HAVE_DISABLE=1
365+	elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"" ; then
366+		HAVE_DISABLE=0
367+	fi
368+fi
369+
370+if [ "$HAVE_BLACKLIST" = "1" ]; then
371+	if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid \"\.\?\*\"" ; then
372+		HAVE_WWID_DISABLE=1
373+	elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"" ; then
374+		HAVE_WWID_DISABLE=0
375+	fi
376+fi
377+
378+if [ "$HAVE_DEFAULTS" = "1" ]; then
379+	if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)" ; then
380+		HAVE_FIND=1
381+	elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)" ; then
382+		HAVE_FIND=0
383+	fi
384+	if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)" ; then
385+		HAVE_FRIENDLY=1
386+	elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)" ; then
387+		HAVE_FRIENDLY=0
388+	fi
389+fi
390+
391+if [ -n "$SHOW_STATUS" ]; then
392+	if [ -z "$HAVE_DISABLE" -o "$HAVE_DISABLE" = 0 ]; then
393+		echo "multipath is enabled"
394+	else
395+		echo "multipath is disabled"
396+	fi
397+	if [ -z "$HAVE_FIND"  -o "$HAVE_FIND" = 0 ]; then
398+		echo "find_multipaths is disabled"
399+	else
400+		echo "find_multipaths is enabled"
401+	fi
402+	if [ -z "$HAVE_FRIENDLY" -o "$HAVE_FRIENDLY" = 0 ]; then
403+		echo "user_friendly_names is disabled"
404+	else
405+		echo "user_friendly_names is enabled"
406+	fi
407+	if [ -n "$HAVE_MODULE" ]; then
408+		if [ "$HAVE_MODULE" = 1 ]; then
409+			echo "dm_multipath module is loaded"
410+		else
411+			echo "dm_multipath module is not loaded"
412+		fi
413+	fi
414+	if [ -z "$HAVE_MULTIPATHD" ]; then
415+		if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then
416+			HAVE_MULTIPATHD=1
417+		else
418+			HAVE_MULTIPATHD=0
419+		fi
420+	fi
421+	if [ "$HAVE_MULTIPATHD" = 1 ]; then
422+		echo "multipathd is running"
423+	else
424+		echo "multipathd is not running"
425+	fi
426+	exit 0
427+fi
428+
429+if [ -z "$HAVE_BLACKLIST" ]; then
430+	cat >> $TMPFILE <<- _EOF_
431+
432+blacklist {
433+}
434+_EOF_
435+fi
436+
437+if [ -z "$HAVE_DEFAULTS" ]; then
438+	cat >> $TMPFILE <<- _EOF_
439+
440+defaults {
441+}
442+_EOF_
443+fi
444+
445+if [ "$ENABLE" = 2 ]; then
446+	if [ "$HAVE_DISABLE" = 1 ]; then
447+		sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/#	devnode ".*"/' $TMPFILE
448+	fi
449+	if [ -z "$HAVE_WWID_DISABLE" ]; then
450+		sed -i '/^blacklist[[:space:]]*{/ a\
451+	wwid ".*"
452+' $TMPFILE
453+	elif [ "$HAVE_WWID_DISABLE" = 0 ]; then
454+		sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/	wwid ".*"/' $TMPFILE
455+	fi
456+	if [ "$HAVE_EXCEPTIONS" = 1 ]; then
457+		sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE
458+	else
459+		cat >> $TMPFILE <<- _EOF_
460+
461+blacklist_exceptions {
462+}
463+_EOF_
464+	fi
465+	add_blacklist_exceptions
466+elif [ "$ENABLE" = 1 ]; then
467+	if [ "$HAVE_DISABLE" = 1 ]; then
468+		sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/#	devnode ".*"/' $TMPFILE
469+	fi
470+elif [ "$ENABLE" = 0 ]; then
471+	if [ -z "$HAVE_DISABLE" ]; then
472+		sed -i '/^blacklist[[:space:]]*{/ a\
473+	devnode ".*"
474+' $TMPFILE
475+	elif [ "$HAVE_DISABLE" = 0 ]; then
476+		sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"/	devnode ".*"/' $TMPFILE
477+	fi
478+fi
479+
480+if [ "$FIND" = "n" ]; then
481+	if [ "$HAVE_FIND" = 1 ]; then
482+		sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)/	find_multipaths no/' $TMPFILE
483+		CHANGED_CONFIG=1
484+	fi
485+elif [ "$FIND" = "y" ]; then
486+	if [ -z "$HAVE_FIND" ]; then
487+		sed -i '/^defaults[[:space:]]*{/ a\
488+	find_multipaths yes
489+' $TMPFILE
490+		CHANGED_CONFIG=1
491+	elif [ "$HAVE_FIND" = 0 ]; then
492+		sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)/	find_multipaths yes/' $TMPFILE
493+		CHANGED_CONFIG=1
494+	fi
495+fi
496+
497+if [ "$FRIENDLY" = "n" ]; then
498+	if [ "$HAVE_FRIENDLY" = 1 ]; then
499+		sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)/	user_friendly_names no/' $TMPFILE
500+		CHANGED_CONFIG=1
501+	fi
502+elif [ "$FRIENDLY" = "y" ]; then
503+	if [ -z "$HAVE_FRIENDLY" ]; then
504+		sed -i '/^defaults[[:space:]]*{/ a\
505+	user_friendly_names yes
506+' $TMPFILE
507+		CHANGED_CONFIG=1
508+	elif [ "$HAVE_FRIENDLY" = 0 ]; then
509+		sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)/	user_friendly_names yes/' $TMPFILE
510+		CHANGED_CONFIG=1
511+	fi
512+fi
513+
514+if [ -f "$OUTPUTFILE" ]; then
515+	cp $OUTPUTFILE $OUTPUTFILE.old
516+	if [ $? != 0 ]; then
517+		echo "failed to backup old config file, $OUTPUTFILE not updated"
518+		exit 1
519+	fi
520+fi
521+
522+cp $TMPFILE $OUTPUTFILE
523+if [ $? != 0 ]; then
524+	echo "failed to copy new config file into place, check $OUTPUTFILE is still OK"
525+	exit 1
526+fi
527+
528+rm -f $TMPFILE
529+
530+if [ "$ENABLE" = 1 ]; then
531+	if [ "$HAVE_MODULE" = 0 ]; then
532+		modprobe dm_multipath
533+	fi
534+	if [ "$HAVE_MULTIPATHD" = 0 ]; then
535+		systemctl start multipathd.service
536+	fi
537+elif [ "$ENABLE" = 0 ]; then
538+	if [ "$HAVE_MULTIPATHD" = 1 ]; then
539+		systemctl stop multipathd.service
540+	fi
541+elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then
542+	systemctl reload multipathd.service
543+fi
544diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8
545new file mode 100644
546index 00000000..4cd32672
547--- /dev/null
548+++ b/multipath/mpathconf.8
549@@ -0,0 +1,101 @@
550+.TH MPATHCONF 8 "June 2010" "" "Linux Administrator's Manual"
551+.SH NAME
552+mpathconf - A tool for configuring device-mapper-multipath
553+.SH SYNOPSIS
554+.B mpathconf
555+.RB [\| commands \|]
556+.RB [\| options \|]
557+.SH DESCRIPTION
558+.B mpathconf
559+is a utility that creates or modifies
560+.B /etc/multipath.conf.
561+It can enable or disable multipathing and configure some common options.
562+.B mpathconf
563+can also load the
564+.B dm_multipath
565+module, start and stop the
566+.B multipathd
567+daemon, and configure the
568+.B multipathd
569+service to start automatically or not. If
570+.B mpathconf
571+is called with no commands, it will display the current configuration.
572+
573+The default options for mpathconf are
574+.B --with_module
575+The
576+.B --with_multipathd
577+option is not set by default.  Enabling multipathing will load the
578+.B dm_multipath
579+module but it will not immediately start it. This is so
580+that users can manually edit their config file if necessary, before starting
581+.B multipathd.
582+
583+If
584+.B /etc/multipath.conf
585+already exists, mpathconf will edit it. If it does not exist, mpathconf will
586+create a default file with
587+.B user_friendly_names
588+and
589+.B find_multipaths
590+set. To disable these, use the
591+.B --user_friendly_names n
592+and
593+.B --find_multipaths n
594+options
595+.SH COMMANDS
596+.TP
597+.B --enable
598+Removes any line that blacklists all device nodes from the
599+.B /etc/multipath.conf
600+blacklist section.
601+.TP
602+.B --disable
603+Adds a line that blacklists all device nodes to the
604+.B /etc/multipath.conf
605+blacklist section. If no blacklist section exists, it will create one.
606+.TP
607+.B --user_friendly_name \fP { \fBy\fP | \fBn\fP }
608+If set to \fBy\fP, this adds the line
609+.B user_friendly_names yes
610+to the
611+.B /etc/multipath.conf
612+defaults section. If set to \fBn\fP, this removes the line, if present. This
613+command can be used along with any other command.
614+.TP
615+.B --find_multipaths\fP { \fBy\fP | \fBn\fP }
616+If set to \fBy\fP, this adds the line
617+.B find_multipaths yes
618+to the
619+.B /etc/multipath.conf
620+defaults section. If set to \fBn\fP, this removes the line, if present. This
621+command can be used aldong with any other command.
622+.SH OPTIONS
623+.TP
624+.B --with_module\fP { \fBy\fP | \fBn\fP }
625+If set to \fBy\fP, this runs
626+.B modprobe dm_multipath
627+to install the multipath modules. This option only works with the
628+.B --enable
629+command. This option is set to \fBy\fP by default.
630+.TP
631+.B --with_multipathd { \fBy\fP | \fBn\fP }
632+If set to \fBy\fP, this runs
633+.B service multipathd start
634+to start the multipathd daemon on \fB--enable\fP,
635+.B service multipathd stop
636+to stop the multipathd daemon on \fB--disable\fP, and
637+.B service multipathd reload
638+to reconfigure multipathd on \fB--user_frindly_names\fP and
639+\fB--find_multipaths\fP.
640+This option is set to \fBn\fP by default.
641+.SH FILES
642+.BR /etc/multipath.conf
643+.SH "SEE ALSO"
644+.BR multipath.conf (5),
645+.BR modprobe (8),
646+.BR multipath (8),
647+.BR multipathd (8),
648+.BR service (8),
649+.SH AUTHOR
650+Benjamin Marzinski <bmarzins@redhat.com>
651--
6522.25.1
653
654