summaryrefslogtreecommitdiffstats
path: root/autocluster
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-05-09 13:38:12 +1000
committerMartin Schwenke <martin@meltin.net>2012-05-09 13:38:12 +1000
commit81c8614933a8dbe679cec7e4eaf791ac305b673c (patch)
treefc37c129424f9d6f1e9d970227768d2b204af15c /autocluster
parent9066feee096b25a4c507bfa0ca8ba01ad3fef472 (diff)
downloadautocluster-81c8614933a8dbe679cec7e4eaf791ac305b673c.tar.gz
autocluster-81c8614933a8dbe679cec7e4eaf791ac305b673c.tar.xz
autocluster-81c8614933a8dbe679cec7e4eaf791ac305b673c.zip
Update public address generation function make_public_addresses()
* Don't generate public address config for eth0. * Change notation used for arithmetic expansion - $[ ... ] form is deprecated. * Delete make_public_addresses_old(). Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'autocluster')
-rwxr-xr-xautocluster45
1 files changed, 2 insertions, 43 deletions
diff --git a/autocluster b/autocluster
index cec09e4..45151a1 100755
--- a/autocluster
+++ b/autocluster
@@ -1098,57 +1098,16 @@ has_public_addresses_DEFAULT ()
false
}
-# Build public address configuration.
-# * 1st public IP: unless specified, last octet is $FIRSTIP + $PUBLIC_IP_OFFSET
-# * Excluded nodes: unless specified via comma-separated list of IP offsets,
-# nodes are excluded via their node types
-# * Number of public addresses per interface is either specified or $NUMNODES.
-make_public_addresses_old () {
- local firstip="${1:-$(($FIRSTIP + $PUBLIC_IP_OFFSET))}"
- local excluded_nodes="$2"
- local num_addrs="${3:-${NUMNODES}}"
-
- # For delimiting matches.
- excluded_nodes="${excluded_nodes:+,}${excluded_nodes}${excluded_nodes:+,}"
- # Avoid spaces
- excluded_nodes="${excluded_nodes// /}"
-
- make_public_addresses_for_node ()
- {
- [ "$ctdb_node" = 1 ] || return 0
-
- echo "[/etc/ctdb/public_addresses:${name}.${DOMAIN}]"
-
- if [ -n "$excluded_nodes" -a \
- "${excluded_nodes/,${ip_offset},}" = "$excluded_nodes" ] ||
- ([ -z "$excluded_nodes" ] &&
- call_func has_public_addresses "$node_type") ; then
-
- local e i
- for e in $IPNET1 $IPNET2 ; do
- for i in $(seq $firstip $(($firstip + $num_addrs - 1))) ; do
- if [ $i -gt 254 ] ; then
- die "make_public_addresses: octet > 254 - consider setting PUBLIC_IP_OFFSET"
- fi
- printf "\t${IPBASE}.${e}.${i}/24 eth${e}\n"
- done
- done
- fi
- echo
- }
- hack_all_nodes_with make_public_addresses_for_node
-}
-
make_public_addresses() {
local firstip="${1:-$[${FIRSTIP} + ${PUBLIC_IP_OFFSET}]}"
local num_addrs="${2:-${NUMNODES}}"
- if [ $[ $firstip + $num_addrs - 1 ] -gt 254 ]; then
+ if [ $(( $firstip + $num_addrs - 1 )) -gt 254 ]; then
die "make_public_addresses: last octet > 254 - change PUBLIC_IP_OFFSET"
fi
local e
- for e in $IPNET0 $IPNET1 $IPNET2 ; do
+ for e in $IPNET1 $IPNET2 ; do
echo -ne "${IPBASE}.${e}.${firstip},${num_addrs},eth${e} "
done
echo