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