|
|
4ae388 |
---
|
|
|
4ae388 |
libmultipath/config.c | 1
|
|
|
4ae388 |
multipath/Makefile | 5
|
|
|
4ae388 |
multipath/main.c | 4
|
|
|
4ae388 |
multipath/mpathconf | 312 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
4ae388 |
multipath/mpathconf.8 | 103 ++++++++++++++++
|
|
|
4ae388 |
5 files changed, 423 insertions(+), 2 deletions(-)
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/config.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/config.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/config.c
|
|
|
4ae388 |
@@ -589,6 +589,7 @@ load_config (char * file)
|
|
|
4ae388 |
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
|
|
|
4ae388 |
condlog(0, "A default multipath.conf file is located at");
|
|
|
4ae388 |
condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE));
|
|
|
4ae388 |
+ condlog(0, "You can run /sbin/mpathconf to create or modify /etc/multipath.conf");
|
|
|
4ae388 |
if (conf->blist_devnode == NULL) {
|
|
|
4ae388 |
conf->blist_devnode = vector_alloc();
|
|
|
4ae388 |
if (!conf->blist_devnode) {
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/Makefile
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipath/Makefile
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/Makefile
|
|
|
4ae388 |
@@ -17,22 +17,27 @@ $(EXEC): $(OBJS)
|
|
|
4ae388 |
$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS)
|
|
|
4ae388 |
$(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
|
|
4ae388 |
$(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz
|
|
|
4ae388 |
+ $(GZIP) mpathconf.8 > mpathconf.8.gz
|
|
|
4ae388 |
|
|
|
4ae388 |
install:
|
|
|
4ae388 |
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
|
|
|
4ae388 |
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
|
|
4ae388 |
+ $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
|
|
|
4ae388 |
$(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d
|
|
|
4ae388 |
$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
|
|
|
4ae388 |
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
|
|
|
4ae388 |
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
|
|
4ae388 |
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
|
|
|
4ae388 |
$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
|
|
|
4ae388 |
+ $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir)
|
|
|
4ae388 |
|
|
|
4ae388 |
uninstall:
|
|
|
4ae388 |
rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
|
|
|
4ae388 |
rm $(DESTDIR)$(bindir)/$(EXEC)
|
|
|
4ae388 |
+ rm $(DESTDIR)$(bindir)/mpathconf
|
|
|
4ae388 |
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
|
|
4ae388 |
rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
|
|
|
4ae388 |
+ rm $(DESTDIR)$(mandir)/mpathconf.8.gz
|
|
|
4ae388 |
|
|
|
4ae388 |
clean:
|
|
|
4ae388 |
rm -f core *.o $(EXEC) *.gz
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipath/main.c
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
@@ -433,10 +433,10 @@ main (int argc, char *argv[])
|
|
|
4ae388 |
exit(1);
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (dm_prereq())
|
|
|
4ae388 |
+ if (load_config(DEFAULT_CONFIGFILE))
|
|
|
4ae388 |
exit(1);
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (load_config(DEFAULT_CONFIGFILE))
|
|
|
4ae388 |
+ if (dm_prereq())
|
|
|
4ae388 |
exit(1);
|
|
|
4ae388 |
|
|
|
4ae388 |
while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/mpathconf
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- /dev/null
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/mpathconf
|
|
|
4ae388 |
@@ -0,0 +1,312 @@
|
|
|
4ae388 |
+#!/bin/sh
|
|
|
4ae388 |
+#
|
|
|
4ae388 |
+# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
|
|
|
4ae388 |
+#
|
|
|
4ae388 |
+# This file is part of the device-mapper-multipath package.
|
|
|
4ae388 |
+#
|
|
|
4ae388 |
+# This copyrighted material is made available to anyone wishing to use,
|
|
|
4ae388 |
+# modify, copy, or redistribute it subject to the terms and conditions
|
|
|
4ae388 |
+# of the GNU General Public License v.2.
|
|
|
4ae388 |
+#
|
|
|
4ae388 |
+# You should have received a copy of the GNU General Public License
|
|
|
4ae388 |
+# along with this program; if not, write to the Free Software Foundation,
|
|
|
4ae388 |
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+#
|
|
|
4ae388 |
+# Simple editting of /etc/multipath.conf
|
|
|
4ae388 |
+# This program was largely ripped off from lvmconf
|
|
|
4ae388 |
+#
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE SHOW_STATUS CHANGED_CONFIG
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+DEFAULT_CONFIGFILE="/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf"
|
|
|
4ae388 |
+CONFIGFILE="/etc/multipath.conf"
|
|
|
4ae388 |
+MULTIPATHDIR="/etc/multipath"
|
|
|
4ae388 |
+TMPFILE=/etc/multipath/.multipath.conf.tmp
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+function usage
|
|
|
4ae388 |
+{
|
|
|
4ae388 |
+ echo "usage: $0 <command>"
|
|
|
4ae388 |
+ echo ""
|
|
|
4ae388 |
+ echo "Commands:"
|
|
|
4ae388 |
+ echo "Enable: --enable "
|
|
|
4ae388 |
+ echo "Disable: --disable"
|
|
|
4ae388 |
+ echo "Set user_friendly_names (Default n): --user_friendly_names <y|n>"
|
|
|
4ae388 |
+ echo "Set find_multipaths (Default n): --find_multipaths <y|n>"
|
|
|
4ae388 |
+ echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
|
|
|
4ae388 |
+ echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
|
|
|
4ae388 |
+ echo ""
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+function parse_args
|
|
|
4ae388 |
+{
|
|
|
4ae388 |
+ while [ -n "$1" ]; do
|
|
|
4ae388 |
+ case $1 in
|
|
|
4ae388 |
+ --enable)
|
|
|
4ae388 |
+ ENABLE=1
|
|
|
4ae388 |
+ shift
|
|
|
4ae388 |
+ ;;
|
|
|
4ae388 |
+ --disable)
|
|
|
4ae388 |
+ ENABLE=0
|
|
|
4ae388 |
+ shift
|
|
|
4ae388 |
+ ;;
|
|
|
4ae388 |
+ --user_friendly_names)
|
|
|
4ae388 |
+ if [ -n "$2" ]; then
|
|
|
4ae388 |
+ FRIENDLY=$2
|
|
|
4ae388 |
+ shift 2
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ usage
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ ;;
|
|
|
4ae388 |
+ --find_multipaths)
|
|
|
4ae388 |
+ if [ -n "$2" ]; then
|
|
|
4ae388 |
+ FIND=$2
|
|
|
4ae388 |
+ shift 2
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ usage
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ ;;
|
|
|
4ae388 |
+ --with_module)
|
|
|
4ae388 |
+ if [ -n "$2" ]; then
|
|
|
4ae388 |
+ MODULE=$2
|
|
|
4ae388 |
+ shift 2
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ usage
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ ;;
|
|
|
4ae388 |
+ --with_multipathd)
|
|
|
4ae388 |
+ if [ -n "$2" ]; then
|
|
|
4ae388 |
+ MULTIPATHD=$2
|
|
|
4ae388 |
+ shift 2
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ usage
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ ;;
|
|
|
4ae388 |
+ *)
|
|
|
4ae388 |
+ usage
|
|
|
4ae388 |
+ exit
|
|
|
4ae388 |
+ esac
|
|
|
4ae388 |
+ done
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+function validate_args
|
|
|
4ae388 |
+{
|
|
|
4ae388 |
+ if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$MODULE" ]; then
|
|
|
4ae388 |
+ echo "ignoring extra parameters on disable"
|
|
|
4ae388 |
+ FRIENDLY=""
|
|
|
4ae388 |
+ FIND=""
|
|
|
4ae388 |
+ MODULE=""
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then
|
|
|
4ae388 |
+ echo "--user_friendly_names must be either 'y' or 'n'"
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -n "$FIND" ] && [ "$FIND" != "y" -a "$FIND" != "n" ]; then
|
|
|
4ae388 |
+ echo "--find_multipaths must be either 'y' or 'n'"
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" ]; then
|
|
|
4ae388 |
+ SHOW_STATUS=1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
|
|
|
4ae388 |
+ echo "--with_module must be either 'y' or 'n'"
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -n "$MULTIPATHD" ] && [ "$MULTIPATHD" != "y" -a "$MULTIPATHD" != "n" ]; then
|
|
|
4ae388 |
+ echo "--with_multipathd must be either 'y' or 'n'"
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+umask 0077
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+parse_args "$@"
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+validate_args
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ ! -d "$MULTIPATHDIR" ]; then
|
|
|
4ae388 |
+ echo "/etc/multipath/ does not exist. failing"
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+rm $TMPFILE 2> /dev/null
|
|
|
4ae388 |
+if [ -f "$CONFIGFILE" ]; then
|
|
|
4ae388 |
+ cp $CONFIGFILE $TMPFILE
|
|
|
4ae388 |
+elif [ -f "$DEFAULT_CONFIGFILE" ]; then
|
|
|
4ae388 |
+ cp $DEFAULT_CONFIGFILE $TMPFILE
|
|
|
4ae388 |
+else
|
|
|
4ae388 |
+ touch $TMPFILE
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if grep -q "^blacklist[[:space:]]*{" $TMPFILE ; then
|
|
|
4ae388 |
+ HAVE_BLACKLIST=1
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then
|
|
|
4ae388 |
+ HAVE_DEFAULTS=1
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ -z "$MODULE" -o "$MODULE" = "y" ]; then
|
|
|
4ae388 |
+ if lsmod | grep -q "dm_multipath" ; then
|
|
|
4ae388 |
+ HAVE_MODULE=1
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ HAVE_MODULE=0
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ "$MULTIPATHD" = "y" ]; then
|
|
|
4ae388 |
+ if service multipathd status > /dev/null ; then
|
|
|
4ae388 |
+ HAVE_MULTIPATHD=1
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ HAVE_MULTIPATHD=0
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ "$HAVE_BLACKLIST" = "1" ]; then
|
|
|
4ae388 |
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then
|
|
|
4ae388 |
+ HAVE_DISABLE=1
|
|
|
4ae388 |
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[#[:space:]]*devnode \"\.\?\*\"" ; then
|
|
|
4ae388 |
+ HAVE_DISABLE=0
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ "$HAVE_DEFAULTS" = "1" ]; then
|
|
|
4ae388 |
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)" ; then
|
|
|
4ae388 |
+ HAVE_FIND=1
|
|
|
4ae388 |
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)" ; then
|
|
|
4ae388 |
+ HAVE_FIND=0
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)" ; then
|
|
|
4ae388 |
+ HAVE_FRIENDLY=1
|
|
|
4ae388 |
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)" ; then
|
|
|
4ae388 |
+ HAVE_FRIENDLY=0
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ -n "$SHOW_STATUS" ]; then
|
|
|
4ae388 |
+ if [ -z "$HAVE_DISABLE" -o "$HAVE_DISABLE" = 0 ]; then
|
|
|
4ae388 |
+ echo "multipath is enabled"
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ echo "multipath is disabled"
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -z "$HAVE_FIND" -o "$HAVE_FIND" = 0 ]; then
|
|
|
4ae388 |
+ echo "find_multipaths is disabled"
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ echo "find_multipaths is enabled"
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -z "$HAVE_FRIENDLY" -o "$HAVE_FRIENDLY" = 0 ]; then
|
|
|
4ae388 |
+ echo "user_friendly_names is disabled"
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ echo "user_friendly_names is enabled"
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -n "$HAVE_MODULE" ]; then
|
|
|
4ae388 |
+ if [ "$HAVE_MODULE" = 1 ]; then
|
|
|
4ae388 |
+ echo "dm_multipath module is loaded"
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ echo "dm_multipath module is not loaded"
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ -n "$HAVE_MULTIPATHD" ]; then
|
|
|
4ae388 |
+ service multipathd status
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ exit 0
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ -z "$HAVE_BLACKLIST" ]; then
|
|
|
4ae388 |
+ cat >> $TMPFILE <<- _EOF_
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+blacklist {
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+_EOF_
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ -z "$HAVE_DEFAULTS" ]; then
|
|
|
4ae388 |
+ cat >> $TMPFILE <<- _EOF_
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+defaults {
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+_EOF_
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ "$ENABLE" = 1 ]; then
|
|
|
4ae388 |
+ if [ "$HAVE_DISABLE" = 1 ]; then
|
|
|
4ae388 |
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+elif [ "$ENABLE" = 0 ]; then
|
|
|
4ae388 |
+ if [ -z "$HAVE_DISABLE" ]; then
|
|
|
4ae388 |
+ sed -i '/^blacklist[[:space:]]*{/ a\
|
|
|
4ae388 |
+ devnode "*"
|
|
|
4ae388 |
+' $TMPFILE
|
|
|
4ae388 |
+ elif [ "$HAVE_DISABLE" = 0 ]; then
|
|
|
4ae388 |
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[#[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ "$FIND" = "n" ]; then
|
|
|
4ae388 |
+ if [ "$HAVE_FIND" = 1 ]; then
|
|
|
4ae388 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)/ find_multipaths no/' $TMPFILE
|
|
|
4ae388 |
+ CHANGED_CONFIG=1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+elif [ "$FIND" = "y" ]; then
|
|
|
4ae388 |
+ if [ -z "$HAVE_FIND" ]; then
|
|
|
4ae388 |
+ sed -i '/^defaults[[:space:]]*{/ a\
|
|
|
4ae388 |
+ find_multipaths yes
|
|
|
4ae388 |
+' $TMPFILE
|
|
|
4ae388 |
+ CHANGED_CONFIG=1
|
|
|
4ae388 |
+ elif [ "$HAVE_FIND" = 0 ]; then
|
|
|
4ae388 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)/ find_multipaths yes/' $TMPFILE
|
|
|
4ae388 |
+ CHANGED_CONFIG=1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ "$FRIENDLY" = "n" ]; then
|
|
|
4ae388 |
+ if [ "$HAVE_FRIENDLY" = 1 ]; then
|
|
|
4ae388 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE
|
|
|
4ae388 |
+ CHANGED_CONFIG=1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+elif [ "$FRIENDLY" = "y" ]; then
|
|
|
4ae388 |
+ if [ -z "$HAVE_FRIENDLY" ]; then
|
|
|
4ae388 |
+ sed -i '/^defaults[[:space:]]*{/ a\
|
|
|
4ae388 |
+ user_friendly_names yes
|
|
|
4ae388 |
+' $TMPFILE
|
|
|
4ae388 |
+ CHANGED_CONFIG=1
|
|
|
4ae388 |
+ elif [ "$HAVE_FRIENDLY" = 0 ]; then
|
|
|
4ae388 |
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE
|
|
|
4ae388 |
+ CHANGED_CONFIG=1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ -f "$CONFIGFILE" ]; then
|
|
|
4ae388 |
+ cp $CONFIGFILE $CONFIGFILE.old
|
|
|
4ae388 |
+ if [ $? != 0 ]; then
|
|
|
4ae388 |
+ echo "failed to backup old config file, $CONFIGFILE not updated"
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+cp $TMPFILE $CONFIGFILE
|
|
|
4ae388 |
+if [ $? != 0 ]; then
|
|
|
4ae388 |
+ echo "failed to copy new config file into place, check $CONFIGFILE is still OK"
|
|
|
4ae388 |
+ exit 1
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+rm -f $TMPFILE
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+if [ "$ENABLE" = 1 ]; then
|
|
|
4ae388 |
+ if [ "$HAVE_MODULE" = 0 ]; then
|
|
|
4ae388 |
+ modprobe dm_multipath
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+ if [ "$HAVE_MULTIPATHD" = 0 ]; then
|
|
|
4ae388 |
+ service multipathd start
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+elif [ "$ENABLE" = 0 ]; then
|
|
|
4ae388 |
+ if [ "$HAVE_MULTIPATHD" = 1 ]; then
|
|
|
4ae388 |
+ service multipathd stop
|
|
|
4ae388 |
+ fi
|
|
|
4ae388 |
+elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then
|
|
|
4ae388 |
+ service multipathd reload
|
|
|
4ae388 |
+fi
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/mpathconf.8
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- /dev/null
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/mpathconf.8
|
|
|
4ae388 |
@@ -0,0 +1,103 @@
|
|
|
4ae388 |
+.TH MPATHCONF 8 "June 2010" "" "Linux Administrator's Manual"
|
|
|
4ae388 |
+.SH NAME
|
|
|
4ae388 |
+mpathconf - A tool for configuring device-mapper-multipath
|
|
|
4ae388 |
+.SH SYNOPSIS
|
|
|
4ae388 |
+.B mpathconf
|
|
|
4ae388 |
+.RB [\| commands \|]
|
|
|
4ae388 |
+.RB [\| options \|]
|
|
|
4ae388 |
+.SH DESCRIPTION
|
|
|
4ae388 |
+.B mpathconf
|
|
|
4ae388 |
+is a utility that creates or modifies
|
|
|
4ae388 |
+.B /etc/multipath.conf.
|
|
|
4ae388 |
+It can enable or disable multipathing and configure some common options.
|
|
|
4ae388 |
+.B mpathconf
|
|
|
4ae388 |
+can also load the
|
|
|
4ae388 |
+.B dm_multipath
|
|
|
4ae388 |
+module, start and stop the
|
|
|
4ae388 |
+.B multipathd
|
|
|
4ae388 |
+daemon, and configure the
|
|
|
4ae388 |
+.B multipathd
|
|
|
4ae388 |
+service to start automatically or not. If
|
|
|
4ae388 |
+.B mpathconf
|
|
|
4ae388 |
+is called with no commands, it will display the current configuration.
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+The default options for mpathconf are
|
|
|
4ae388 |
+.B --with_module
|
|
|
4ae388 |
+The
|
|
|
4ae388 |
+.B --with_multipathd
|
|
|
4ae388 |
+option is not set by default. Enabling multipathing will load the
|
|
|
4ae388 |
+.B dm_multipath
|
|
|
4ae388 |
+module but it will not immediately start it. This is so
|
|
|
4ae388 |
+that users can manually edit their config file if necessary, before starting
|
|
|
4ae388 |
+.B multipathd.
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+If
|
|
|
4ae388 |
+.B /etc/multipath.conf
|
|
|
4ae388 |
+already exists, mpathconf will edit it. If it does not exist, mpathconf will
|
|
|
4ae388 |
+use
|
|
|
4ae388 |
+.B /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
|
|
|
4ae388 |
+as the starting file. This file has
|
|
|
4ae388 |
+.B user_friendly_names
|
|
|
4ae388 |
+set. If this file does not exist, mpathconf will create
|
|
|
4ae388 |
+.B /etc/multipath.conf
|
|
|
4ae388 |
+from scratch. For most users, this means that
|
|
|
4ae388 |
+.B user_friendly_names
|
|
|
4ae388 |
+will be set by default, unless they use the
|
|
|
4ae388 |
+.B --user_friendly_names n
|
|
|
4ae388 |
+command.
|
|
|
4ae388 |
+.SH COMMANDS
|
|
|
4ae388 |
+.TP
|
|
|
4ae388 |
+.B --enable
|
|
|
4ae388 |
+Removes any line that blacklists all device nodes from the
|
|
|
4ae388 |
+.B /etc/multipath.conf
|
|
|
4ae388 |
+blacklist section.
|
|
|
4ae388 |
+.TP
|
|
|
4ae388 |
+.B --disable
|
|
|
4ae388 |
+Adds a line that blacklists all device nodes to the
|
|
|
4ae388 |
+.B /etc/multipath.conf
|
|
|
4ae388 |
+blacklist section. If no blacklist section exists, it will create one.
|
|
|
4ae388 |
+.TP
|
|
|
4ae388 |
+.B --user_friendly_name \fP { \fBy\fP | \fBn\fP }
|
|
|
4ae388 |
+If set to \fBy\fP, this adds the line
|
|
|
4ae388 |
+.B user_friendly_names yes
|
|
|
4ae388 |
+to the
|
|
|
4ae388 |
+.B /etc/multipath.conf
|
|
|
4ae388 |
+defaults section. If set to \fBn\fP, this removes the line, if present. This
|
|
|
4ae388 |
+command can be used along with any other command.
|
|
|
4ae388 |
+.TP
|
|
|
4ae388 |
+.B --find_multipaths\fP { \fBy\fP | \fBn\fP }
|
|
|
4ae388 |
+If set to \fBy\fP, this adds the line
|
|
|
4ae388 |
+.B find_multipaths yes
|
|
|
4ae388 |
+to the
|
|
|
4ae388 |
+.B /etc/multipath.conf
|
|
|
4ae388 |
+defaults section. If set to \fBn\fP, this removes the line, if present. This
|
|
|
4ae388 |
+command can be used aldong with any other command.
|
|
|
4ae388 |
+.SH OPTIONS
|
|
|
4ae388 |
+.TP
|
|
|
4ae388 |
+.B --with_module\fP { \fBy\fP | \fBn\fP }
|
|
|
4ae388 |
+If set to \fBy\fP, this runs
|
|
|
4ae388 |
+.B modprobe dm_multipath
|
|
|
4ae388 |
+to install the multipath modules. This option only works with the
|
|
|
4ae388 |
+.B --enable
|
|
|
4ae388 |
+command. This option is set to \fBy\fP by default.
|
|
|
4ae388 |
+.TP
|
|
|
4ae388 |
+.B --with_multipathd { \fBy\fP | \fBn\fP }
|
|
|
4ae388 |
+If set to \fBy\fP, this runs
|
|
|
4ae388 |
+.B service multipathd start
|
|
|
4ae388 |
+to start the multipathd daemon on \fB--enable\fP,
|
|
|
4ae388 |
+.B service multipathd stop
|
|
|
4ae388 |
+to start the multipathd daemon on \fB--disable\fP, and
|
|
|
4ae388 |
+.B service multipathd reload
|
|
|
4ae388 |
+to reconfigure multipathd on \fB--user_frindly_names\fP and
|
|
|
4ae388 |
+\fB--find_multipaths\fP.
|
|
|
4ae388 |
+This option is set to \fBn\fP by default.
|
|
|
4ae388 |
+.SH FILES
|
|
|
4ae388 |
+.BR /etc/multipath.conf
|
|
|
4ae388 |
+.SH "SEE ALSO"
|
|
|
4ae388 |
+.BR multipath.conf (5),
|
|
|
4ae388 |
+.BR modprobe (8),
|
|
|
4ae388 |
+.BR multipath (8),
|
|
|
4ae388 |
+.BR multipathd (8),
|
|
|
4ae388 |
+.BR service (8),
|
|
|
4ae388 |
+.SH AUTHOR
|
|
|
4ae388 |
+Benjamin Marzinski <bmarzins@redhat.com>
|