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