Update public address generation function make_public_addresses()
authorMartin Schwenke <martin@meltin.net>
Wed, 9 May 2012 03:38:12 +0000 (13:38 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 9 May 2012 03:38:12 +0000 (13:38 +1000)
* 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>
autocluster

index cec09e4e08afb3add5be5fd926e68f0b4c38bd83..45151a1db572f824945725c95f3ecbffe6c97883 100755 (executable)
@@ -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