Change public addresses output format from make_public_addresses()
authorAmitay Isaacs <amitay@gmail.com>
Mon, 5 Mar 2012 02:19:04 +0000 (13:19 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 5 Mar 2012 04:21:07 +0000 (15:21 +1100)
@@@PUBLIC_ADDRESSES@@@ will be replaced with

firstip,num_ips,iface firstip,num_ips,iface ...

autocluster
base/all/root/scripts/gpfs-nas.conf
config.d/00base.defconf

index 411fcd5ce16fac3688684514cc229bf36bc9430a..113950e7fe30b18fe8d6dba24a95f4d28cde17f0 100755 (executable)
@@ -1087,7 +1087,7 @@ has_public_addresses_DEFAULT ()
 # * 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 () {
+make_public_addresses_old () {
     local firstip="${1:-$(($FIRSTIP + $PUBLIC_IP_OFFSET))}"
     local excluded_nodes="$2" 
     local num_addrs="${3:-${NUMNODES}}"
@@ -1123,6 +1123,21 @@ make_public_addresses () {
     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
+               die "make_public_addresses: last octet > 254 - change PUBLIC_IP_OFFSET"
+       fi
+
+       local e
+       for e in $IPNET0 $IPNET1 $IPNET2 ; do
+               echo -ne "${IPBASE}.${e}.${firstip},${num_addrs},eth${e} "
+       done
+       echo
+}
+
 ######################################################################
 
 post_config_hooks=
index 773d877160db88323f91ee63c4706fa37a3da7c4..a4ca28ec5c69434b2731ebf2768a6d606fc016d9 100644 (file)
@@ -20,6 +20,7 @@ comment = An example share
 
 [package:ctdb]
 deterministic_ips = 0
+public_addresses = @@@PUBLIC_ADDRESSES@@@
 
 [package:vsftpd]
 chroot_dir = %(chroot_parent)s/ftp
index ff4557103878b813cf355fc1e6df217ff3cfe128..ca1061155dea9fa32e4a45677e0a1644bf6f846e 100644 (file)
@@ -256,7 +256,7 @@ defconf PUBLIC_IP_OFFSET 100 \
        "<n>" "offset from FIRSTIP of public IP addresses"
 
 defconf PUBLIC_ADDRESSES "|make_public_addresses" \
-       "<cmd>" "template for public address entries in conf.base-SoFS"
+       "<cmd>" "template for public address entry in gpfs-nas.conf"
 
 # a caching web proxy that can get to the install server from the
 # nodes. If you don't have one on the local network then look in