summaryrefslogtreecommitdiffstats
path: root/base/root
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2009-07-24 14:59:08 +1000
committerMartin Schwenke <martin@meltin.net>2009-07-24 14:59:08 +1000
commit89d86e938c79308ecf760caca67bfa3c4e4050e7 (patch)
tree5856baa632f7b4b2184ece6c65b5057ca87708e0 /base/root
parent6e792eb3039a381faffb020a8e10553c6c25d29a (diff)
parent9d424e19d7235eb6162605ef888b4b5f36230f4a (diff)
Merge branch 'master' into merged_kickstart
Diffstat (limited to 'base/root')
-rwxr-xr-xbase/root/scripts/mknsd.sh16
-rw-r--r--base/root/scripts/nsd_server_common.bash18
-rwxr-xr-xbase/root/scripts/setup_gpfs.sh48
3 files changed, 58 insertions, 24 deletions
diff --git a/base/root/scripts/mknsd.sh b/base/root/scripts/mknsd.sh
index 304225e..f2cfb11 100755
--- a/base/root/scripts/mknsd.sh
+++ b/base/root/scripts/mknsd.sh
@@ -1,12 +1,18 @@
-#!/bin/sh
+#!/bin/bash
set -e
-disks=`/var/mmfs/etc/nsddevices | awk '{print $1}'`
+# $nsd_servers is setup in here
+. $(dirname $0)/nsd_server_common.bash
+
+echo
+echo "Setting up NSDs"
+nsdfile=/tmp/nsd.$$
+disks=$(/var/mmfs/etc/nsddevices | awk '{print $1}')
(
for d in $disks; do
- echo $d::::::
+ echo $d:${nsd_servers}:::::
done
-) > /tmp/nsdfile.$$
-mmcrnsd -F /tmp/nsdfile.$$
+) > $nsdfile
+mmcrnsd -F $nsdfile
mmlsnsd -m
diff --git a/base/root/scripts/nsd_server_common.bash b/base/root/scripts/nsd_server_common.bash
new file mode 100644
index 0000000..d665c59
--- /dev/null
+++ b/base/root/scripts/nsd_server_common.bash
@@ -0,0 +1,18 @@
+# If there are sofs_storage nodes in the cluster (meaning that other
+# sofs_* nodes will not have direct-attached storage) then scripts
+# that include this snippet must be run on one of the storage nodes.
+# Therefore, in the case, this snippet tries to determine if it is
+# running on the 1st NSD server and, if not, attempts to run the
+# script there.
+
+nsd_servers="@@NSD_SERVERS@@"
+
+if [ -n "$nsd_servers" -a \
+ "${HOSTNAME%%.*}" != "${nsd_servers%%[.,]*}" ] ; then
+ if [ "${0#/}" != "$0" ] ; then
+ script="$0"
+ else
+ script="${PWD}/${0}"
+ fi
+ exec ssh "${nsd_servers%%[.,]*}" "$script" "$@"
+fi
diff --git a/base/root/scripts/setup_gpfs.sh b/base/root/scripts/setup_gpfs.sh
index 8ddae32..69af32c 100755
--- a/base/root/scripts/setup_gpfs.sh
+++ b/base/root/scripts/setup_gpfs.sh
@@ -1,12 +1,32 @@
-#!/bin/sh
-# this sets up GPFS without using the GUI. It is meant as a quick way to get setup
-# with an autocluster system
+#!/bin/bash
+
+# Automatically setup GPFS. This is a quick way to get setup with an
+# autocluster system. It finds NSDs, does various pieces of GPFS
+# configuration, creates a filesystem and mounts it.
set -e
-domain=`dnsdomainname`
-nodes=`onnode all hostname | grep -i $domain | tr A-Z a-z`
-node1=`onnode 0 hostname | grep -i $domain | tr A-Z a-z`
-node2=`onnode 1 hostname | grep -i $domain | tr A-Z a-z`
+
+# $nsd_servers is setup in here
+. $(dirname $0)/nsd_server_common.bash
+
+domain=$(dnsdomainname)
+nodes=$(onnode all hostname | grep -i $domain | tr A-Z a-z)
+primary=$(onnode 0 hostname | grep -i $domain | tr A-Z a-z)
+secondary=$(onnode 1 hostname | grep -i $domain | tr A-Z a-z)
+
+if [ -n "$nsd_servers" ] ; then
+ nodes="${nodes} ${nsd_servers//,/ }"
+
+ # Determine secondary GPFS server. Is there a 2nd NSD server? If
+ # not then use node 0 of the CTDB cluster.
+ secondary="${nsd_servers#*,}"
+ secondary="${secondary%%,*}"
+ [ -n "$secondary" -a "$secondary" != "${nsd_servers%%,*}" ] || \
+ secondary="$primary"
+
+ # Primary is just the 1st NSD server.
+ primary="${nsd_servers%%,*}"
+fi
nodefile=/tmp/nodes.$$
for n in $nodes; do
@@ -14,19 +34,9 @@ for n in $nodes; do
done
echo "Creating cluster"
-mmcrcluster -N $nodefile -p $node1 -s $node2 -r /usr/bin/ssh -R /usr/bin/scp -C @@CLUSTER@@.$domain
+mmcrcluster -N $nodefile -p $primary -s $secondary -r /usr/bin/ssh -R /usr/bin/scp -C m1.$domain
-echo
-echo "Setting up NSDs"
-nsdfile=/tmp/nsd.$$
-disks=`/var/mmfs/etc/nsddevices | awk '{print $1}'`
-(
-for d in $disks; do
- echo $d::::::
-done
-) > $nsdfile
-mmcrnsd -F $nsdfile
-mmlsnsd -m
+. $(dirname $0)/mknsd.sh
echo
echo "Generating auth key"