Split hack_nodes_sofs()
authorMartin Schwenke <martin@meltin.net>
Mon, 30 Jun 2014 02:48:18 +0000 (12:48 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 2 Jul 2014 04:17:18 +0000 (14:17 +1000)
... into hack_nodes_sofs_front() and hack_nodes_sofs_storage().  This
allows 50.sofs.defconf to be split

Signed-off-by: Martin Schwenke <martin@meltin.net>
config.d/50sofs.defconf

index 29768486323af322c985153e7ddb5fde059f7a7b..d95197781f94d54edff816012077d3060b767997 100644 (file)
@@ -1,35 +1,21 @@
 # Hey Emacs, this is a -*- shell-script -*- !!!
 
-register_hook hack_nodes_functions hack_nodes_sofs
-
-NSD_SERVERS=
-
-hack_nodes_sofs ()
+hack_nodes_sofs_front ()
 {
-    if [ "${NODES/sofs_*:/}" != "$NODES" ] ; then
-       # We have sofs_* nodes so name and tag them.
-       local node_count_sofs_front=0
-       local node_count_sofs_storage=0
-       hack_filter ()
-       {
-           case "$node_type" in
-               sofs_front)
-                   node_count_sofs_front=$(($node_count_sofs_front + 1))
-                   name="${CLUSTER}front${node_count_sofs_front}"
-                   ctdb_node=1
-                   ;;
-               sofs_storage)
-                   node_count_sofs_storage=$(($node_count_sofs_storage + 1))
-                   name="${CLUSTER}storage${node_count_sofs_storage}"
-                   ctdb_node=0
-                   local ld=$(echo $DOMAIN | tr 'A-Z' 'a-z')
-                   NSD_SERVERS="${NSD_SERVERS}${NSD_SERVERS:+,}${name}.${ld}"
-           esac
-       }
-       hack_all_nodes_with hack_filter
-    fi
+    local node_count_sofs_front=0
+    hack_filter ()
+    {
+       if [ "$node_type" = "sofs_front" ] ; then
+           node_count_sofs_front=$(($node_count_sofs_front + 1))
+           name="${CLUSTER}front${node_count_sofs_front}"
+           ctdb_node=1
+       fi
+    }
+    hack_all_nodes_with hack_filter
 }
 
+register_hook hack_nodes_functions hack_nodes_sofs_front
+
 create_node_sofs_front ()
 {
     local ip_offset="$1"
@@ -41,6 +27,33 @@ create_node_sofs_front ()
     create_node_COMMON "$name" "$ip_offset" "$type"
 }
 
+node_has_shared_disks_sofs_front ()
+{
+    ! have_dedicated_storage_nodes
+}
+
+######################################################################
+
+NSD_SERVERS=
+
+hack_nodes_sofs_storage ()
+{
+    local node_count_sofs_storage=0
+    hack_filter ()
+    {
+       if [ "$node_type" = "sofs_storage" ] ; then
+           node_count_sofs_storage=$(($node_count_sofs_storage + 1))
+           name="${CLUSTER}storage${node_count_sofs_storage}"
+           ctdb_node=0
+           local ld=$(echo $DOMAIN | tr 'A-Z' 'a-z')
+           NSD_SERVERS="${NSD_SERVERS}${NSD_SERVERS:+,}${name}.${ld}"
+       fi
+    }
+    hack_all_nodes_with hack_filter
+}
+
+register_hook hack_nodes_functions hack_nodes_sofs_storage
+
 create_node_sofs_storage ()
 {
     local ip_offset="$1"
@@ -52,11 +65,6 @@ create_node_sofs_storage ()
     create_node_COMMON "$name" "$ip_offset" "$type"
 }
 
-node_has_shared_disks_sofs_front ()
-{
-    ! have_dedicated_storage_nodes
-}
-
 node_has_shared_disks_sofs_storage ()
 {
     true