Simplify shared disk logic for sofs_front and sofs_storage nodes
authorMartin Schwenke <martin@meltin.net>
Mon, 30 Jun 2014 00:19:29 +0000 (10:19 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 2 Jul 2014 04:17:18 +0000 (14:17 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
config.d/50sofs.defconf

index c83e55800f478718fe9c7245b12991b7203efbeb..38bb710441e54ed9acd4af2c9db244a30333f095 100644 (file)
@@ -12,20 +12,11 @@ hack_nodes_sofs ()
        local node_count_sofs_storage=0
        hack_filter ()
        {
-           hack_shareddisks ()
-           {
-               # Make it so that only SoFS nodes get shared disks.
-               [ -n "$SOFS_SHAREDDISK_TEMPLATE" ] && return 0
-               SOFS_SHAREDDISK_TEMPLATE="$SHAREDDISK_TEMPLATE"
-               SHAREDDISK_TEMPLATE=""
-           }
-
            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
-                   hack_shareddisks
                    ;;
                sofs_storage)
                    node_count_sofs_storage=$(($node_count_sofs_storage + 1))
@@ -33,7 +24,6 @@ hack_nodes_sofs ()
                    ctdb_node=0
                    local ld=$(echo $DOMAIN | tr 'A-Z' 'a-z')
                    NSD_SERVERS="${NSD_SERVERS}${NSD_SERVERS:+,}${name}.${ld}"
-                   hack_shareddisks
            esac
        }
        hack_all_nodes_with hack_filter
@@ -48,9 +38,10 @@ create_node_sofs_front ()
 
     echo "Creating SoFS front-end node $name"
 
-    # Only configure shared disks If there are no sofs_storage nodes.
-    [ "${NODES/sofs_storage:/}" = "$NODES" ] && \
-       local SHAREDDISK_TEMPLATE="$SOFS_SHAREDDISK_TEMPLATE"
+    # Drop shared disks on this node if it shouldn't have them...
+    if have_dedicated_storage_nodes ; then
+       local SHAREDDISK_TEMPLATE=""
+    fi
 
     create_node_COMMON "$name" "$ip_offset" "$type"
 }
@@ -63,11 +54,15 @@ create_node_sofs_storage ()
 
     echo "Creating SoFS storage node $name"
 
-    local SHAREDDISK_TEMPLATE="$SOFS_SHAREDDISK_TEMPLATE"
-
     create_node_COMMON "$name" "$ip_offset" "$type"
 }
 
+have_dedicated_storage_nodes ()
+{
+    # True if there are sofs_storage nodes
+    [ "${NODES/sofs_storage:/}" != "$NODES" ]
+}
+
 shared_disk_iscsi_setup_base ()
 {
     # Do the iSCSI setup on this node if there are no sofs_storage nodes