summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2010-02-04 16:36:51 +1100
committerMartin Schwenke <martin@meltin.net>2010-02-04 16:36:51 +1100
commit0e5d435a4f968891e059330bc1cf18f838b59ff5 (patch)
tree8a2321fdf30daead0b8f55e68afdef811802d1e9 /base
parentb5ddd4d1900555a4c6098ef75874a0c40712cc24 (diff)
downloadautocluster-0e5d435a4f968891e059330bc1cf18f838b59ff5.tar.gz
autocluster-0e5d435a4f968891e059330bc1cf18f838b59ff5.tar.xz
autocluster-0e5d435a4f968891e059330bc1cf18f838b59ff5.zip
setup_gpfs.sh didn't work if there was only a single node.
The main problem was that $secondary was unset so mmcrcluster would generate a usage message because there would be no argument to -s. However, 'onnode 1 ...' was used and would generate a spurious warning while failing to set secondary. This version uses "onnode all ..." once and then manipulates the resulting list of hosts. Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'base')
-rwxr-xr-xbase/all/root/scripts/setup_gpfs.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/base/all/root/scripts/setup_gpfs.sh b/base/all/root/scripts/setup_gpfs.sh
index 2755a8c..3d4ec40 100755
--- a/base/all/root/scripts/setup_gpfs.sh
+++ b/base/all/root/scripts/setup_gpfs.sh
@@ -10,10 +10,16 @@ set -e
. $(dirname $0)/nsd_server_common.bash
domain=$(dnsdomainname)
-nodes=$(onnode all hostname | grep -i $domain | tr A-Z a-z)
-first=$(onnode 0 hostname | grep -i $domain | tr A-Z a-z)
+nodes=$(onnode -q all hostname | grep -i $domain | tr 'A-Z\012' 'a-z\040')
+first="${nodes%% *}"
primary="$first"
-secondary=$(onnode 1 hostname | grep -i $domain | tr A-Z a-z)
+if [ "$first" != "$nodes" ] ; then
+ # More than 1 node...
+ rest="${nodes#* }"
+ secondary="${rest%% *}"
+else
+ secondary=""
+fi
if [ -n "$nsd_servers" ] ; then
nodes="${nodes} ${nsd_servers//,/ }"
@@ -45,7 +51,7 @@ for n in $nodes; do
done > $nodefile
echo "Creating cluster"
-mmcrcluster -N $nodefile -p $primary -s $secondary -r /usr/bin/ssh -R /usr/bin/scp -C @@CLUSTER@@.$domain
+mmcrcluster -N $nodefile -p $primary ${secondary:+-s} $secondary -r /usr/bin/ssh -R /usr/bin/scp -C @@CLUSTER@@.$domain
# GPFS 3.3 needs this... and GPFS 3.2 doesn't have mmchlicense, so
# this seems like a good option for now.