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