Create IPv4 and IPv6 nodes files
authorAmitay Isaacs <amitay@gmail.com>
Mon, 24 Nov 2014 08:39:04 +0000 (19:39 +1100)
committerMartin Schwenke <martin@meltin.net>
Tue, 25 Nov 2014 00:25:54 +0000 (11:25 +1100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
autocluster

index 0ae0f1221589336c7394f2a6758a40c6cb6ab48e..60d2e97cd621ddb090e3d3165a43c1631a7eba67 100755 (executable)
@@ -489,6 +489,17 @@ cluster_nodelist_hacking ()
     local num_nodes=0
     hack_all_nodes_with ctdb_nodes_line >$nodes_file
 
+    # Build /etc/ctdb/nodes.ipv6
+    ctdb_nodes_line_ipv6 ()
+    {
+       [ "$ctdb_node" = 1 ] || return 0
+       echo "fc00:${NETWORK_PRIVATE_PREFIX//./:}::$(($FIRSTIP + $ip_offset))"
+       num_nodes=$(($num_nodes + 1))
+    }
+    nodes_file_ipv6="tmp/nodes.$CLUSTER.ipv6"
+    local num_nodes=0
+    hack_all_nodes_with ctdb_nodes_line_ipv6 >$nodes_file_ipv6
+
     # Build UUID map
     uuid_map="tmp/uuid_map.$CLUSTER"
     uuid_map_line ()
@@ -991,7 +1002,17 @@ setup_network()
 
     echo "Setting up /etc/ctdb/nodes"
     diskimage mkdir_p "/etc/ctdb"
-    diskimage put "$nodes_file" "/etc/ctdb/nodes"
+    if [ "$NETWORK_STACK" = "ipv4" ] ; then
+       diskimage put "$nodes_file" "/etc/ctdb/nodes"
+    elif [ "$NETWORK_STACK" = "ipv6" ] ; then
+       diskimage put "$nodes_file_ipv6" "/etc/ctdb/nodes"
+    elif [ "$NETWORK_STACK" = "dual" ] ; then
+       diskimage put "$nodes_file" "/etc/ctdb/nodes.ipv4"
+       diskimage put "$nodes_file_ipv6" "/etc/ctdb/nodes.ipv6"
+       diskimage put "$nodes_file" "/etc/ctdb/nodes"
+    else
+       die "Error: Invalid NETWORK_STACK value \"$NETWORK_STACK\"."
+    fi
 
     [ "$WEBPROXY" = "" ] || {
        diskimage append_text "export http_proxy=$WEBPROXY" "/etc/bashrc"