Browse Source

Added /etc/default/aoetools and /etc/init.d/aoetools

David Martínez Moreno 17 years ago
parent
commit
4a6bb250bf
3 changed files with 158 additions and 0 deletions
  1. 30 0
      debian/README
  2. 9 0
      debian/aoetools.default
  3. 119 0
      debian/aoetools.init

+ 30 - 0
debian/README

@@ -0,0 +1,30 @@
+aoetools for Debian
+-------------------
+
+With aoetools it is shipped an init script that will mount any AoE volume
+properly configured in your /etc/fstab, that is, without option 'noauto'
+AND with an option '_netdev', if you want to avoid any error messages in
+the boot process.  In the following examples I am supposing that the rest
+of the mount options are simply 'defaults', but you can replace it with
+other parameters.
+
+Example of a correct line:
+
+/dev/etherd/e0.0p5  /mnt/aoe            xfs         defaults,_netdev            2   0
+
+
+This line will generate boot errors, as the early mount process will try to mount this
+volume, as it is not marked as network-dependant:
+
+/dev/etherd/e0.0p5  /mnt/aoe            xfs         defaults                    2   0
+
+
+This line will provoke that the /mnt/aoe volume won't simply get mounted while booting,
+or running /etc/init.d/aoetools start:
+
+/dev/etherd/e0.0p5  /mnt/aoe            xfs         defaults,noauto             2   0
+
+
+Important note: Please note that if your network is not properly configured or your
+AoE server is down, you can incur in big delays in the booting process.  If you fear so,
+mount volumes manually after you are sure that your AoE shelf is reachable.

+ 9 - 0
debian/aoetools.default

@@ -0,0 +1,9 @@
+# Configuration file for aoetools.
+
+# Enter the list of network interfaces to restrict the AoE discovery to, separated by spaces.
+# It can be blank, i.e., "".
+# If you do not want AoE discovery at all, enter "none" as the list of interfaces.
+#
+# If neither the aoe_iflist module load option nor this list of interfaces are used, the aoe driver
+# will use any network interface for AoE traffic.
+INTERFACES="none"

+ 119 - 0
debian/aoetools.init

@@ -0,0 +1,119 @@
+#! /bin/sh
+#
+#       Based on a example file to build /etc/init.d/ scripts,
+#		written by Miquel van Smoorenburg <miquels@cistron.nl>
+#		and later modified by Ian Murdock <imurdock@gnu.ai.mit.edu>.
+#
+#       Also based on init script mountnfs.sh from initscripts package.
+#
+#       Modified for aoetools by David Martínez Moreno <ender@debian.org>.
+#
+### BEGIN INIT INFO
+# Provides:          mountaoe
+# Required-Start:    $local_fs $network
+# Required-Stop:     $local_fs $network
+# Should-Start:      
+# Default-Start:     S
+# Default-Stop:      0 6
+# Short-Description: Begin AoE discovery and mount related filesystems.
+# Description:       Begin AoE discovery and mount filesystems residing.
+#                    on AoE volumes.
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+NAME=aoetools
+DESC="AoE devices discovery and mounting AoE filesystems"
+
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+. /lib/lsb/init-functions
+
+# Include aoetools defaults if available
+if [ -f /etc/default/aoetools ] ; then
+	. /etc/default/aoetools
+fi
+
+set -e
+
+do_start() {
+    if [ ! -c /dev/etherd/discover ]
+    then
+        echo "Missing devices under /dev/etherd/.  Please run" >&2
+        echo "  aoe-mkdevs /dev/etherd" >&2
+        echo "and try again."
+        exit 1
+    fi
+
+    # We exit if the user do not want us to try this.
+    if [ "$INTERFACES" = "none" ]
+    then
+        echo "not started."
+        exit 0
+    fi
+
+    # Try to set up interfaces for discovery, if any.
+    if [ ! -z "$INTERFACES" ]
+    then
+        aoe-interfaces $INTERFACES
+    fi
+
+    aoe-discover
+
+    [ -f /etc/fstab ] || return
+    #
+    # Read through fstab line by line. If it contains /dev/etherd, set the flag
+    # for mounting file systems over AoE. 
+    #
+
+    exec 9<&0 </etc/fstab
+
+    waitaoe=
+    while read DEV MTPT FSTYPE OPTS REST
+    do
+        case "$OPTS" in
+          noauto|*,noauto|noauto,*|*,noauto,*)
+            continue
+            ;;
+        esac
+        case "$DEV" in
+          ""|\#*)
+            continue
+            ;;
+          /dev/etherd/*)
+            waitaoe="$waitaoe $MTPT"
+        esac
+    done
+
+    exec 0<&9 9<&-
+
+    if [ ! -z "$waitaoe" ]
+    then
+        echo
+    fi
+
+    for mountpt in $waitaoe; do
+        echo "Mounting $mountpt..."
+        mount $mountpt
+        #log_action_begin_msg "Waiting for $mountpt"
+    done
+}
+
+case "$1" in
+  start|restart|reload|force-reload)
+	echo -n "Starting $DESC: "
+
+    do_start
+    
+	#echo "$NAME."
+	;;
+  stop)
+	#echo -n "Stopping $DESC: "
+	#echo "$NAME."
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0