diff options
author | Martin Schwenke <martin@meltin.net> | 2013-03-05 11:36:16 +1100 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2013-03-05 15:07:36 +1100 |
commit | 0a6d897bdaf009f6e441dd8cb282624c3e05a975 (patch) | |
tree | afa9e2a6cf8b1b397d1000c8372cdf5fd24eadcb /autocluster | |
parent | a5f51d7274c8ce32905b05a4ff99f810f768e1c0 (diff) | |
download | autocluster-0a6d897bdaf009f6e441dd8cb282624c3e05a975.tar.gz autocluster-0a6d897bdaf009f6e441dd8cb282624c3e05a975.tar.xz autocluster-0a6d897bdaf009f6e441dd8cb282624c3e05a975.zip |
New configuration variable NETWORKS - IPBASE, IPNET* no longer used
Much more flexible network configuration.
Replace canned host_setup/etc/libvirt/qemu/networks/*.xml with
setup_networks.sh script.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'autocluster')
-rwxr-xr-x | autocluster | 65 |
1 files changed, 19 insertions, 46 deletions
diff --git a/autocluster b/autocluster index 8f9fa30..ec4cbdf 100755 --- a/autocluster +++ b/autocluster @@ -240,8 +240,6 @@ create_node_COMMON () die "Error: unknown SYSTEM_DISK_FORMAT=\"${SYSTEM_DISK_FORMAT}\"." esac - set_macaddrs $CLUSTER $ip_offset - # Pull the UUID for this node out of the map. UUID=$(awk "\$1 == $ip_offset {print \$2}" $uuid_map) @@ -365,7 +363,7 @@ common_nodelist_hacking () local sname="" local hosts_line - local ip_addr="$IPBASE.$IPNET0.$(($FIRSTIP + $ip_offset))" + local ip_addr="${NETWORK_PRIVATE_PREFIX}.$(($FIRSTIP + $ip_offset))" if [ "$ctdb_node" = 1 ] ; then num_ctdb_nodes=$(($num_ctdb_nodes + 1)) @@ -404,7 +402,7 @@ common_nodelist_hacking () ctdb_nodes_line () { [ "$ctdb_node" = 1 ] || return 0 - echo "$IPBASE.$IPNET0.$(($FIRSTIP + $ip_offset))" + echo "${NETWORK_PRIVATE_PREFIX}.$(($FIRSTIP + $ip_offset))" num_nodes=$(($num_nodes + 1)) } nodes_file="tmp/nodes.$CLUSTER" @@ -627,28 +625,6 @@ boot_base() { ###################################################################### -# various functions... - -# Set some MAC address variables based on a hash of the cluster name -# plus the node number and each adapter number. -set_macaddrs () { - local cname="$1" - local ip_offset="$2" - - local md5=$(echo $cname | md5sum) - local nh=$(printf "%02x" $ip_offset) - local mac_prefix="02:${md5:0:2}:${md5:2:2}:00:${nh}:" - - MAC1="${mac_prefix}01" - MAC2="${mac_prefix}02" - MAC3="${mac_prefix}03" - MAC4="${mac_prefix}04" - MAC5="${mac_prefix}05" - MAC6="${mac_prefix}06" -} - -###################################################################### - # Updating a disk image... diskimage () @@ -761,6 +737,23 @@ setup_network() echo '@@@YUM_TEMPLATE@@@' | diskimage substitute_vars - "/etc/yum.repos.d/autocluster.repo" diskimage rm_rf "/etc/udev/rules.d/70-persistent-net.rules" + + echo "Setting up network interfaces: " + local n + for n in $NETWORKS ; do + local dev="${n#*,}" # Strip address, comma + dev="${dev%,*}" # Strip comma, interface + echo " $dev" + cat <<EOF | \ + diskimage substitute_vars \ + - "/etc/sysconfig/network-scripts/ifcfg-${dev}" +DEVICE=$dev +ONBOOT=yes +TYPE=Ethernet +IPADDR=${n%.*}.@@IPNUM@@ +NETMASK=255.255.255.0 +EOF + done } register_hook setup_base_hooks setup_network @@ -1085,26 +1078,6 @@ list_releases () { echo "\"$releases\"" } -has_public_addresses_DEFAULT () -{ - false -} - -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 $IPNET1 $IPNET2 ; do - echo -ne "${IPBASE}.${e}.${firstip},${num_addrs},eth${e} " - done - echo -} - ###################################################################### post_config_hooks= |