Rename node type "sofs_storage" to "storage_gpfs"
authorMartin Schwenke <martin@meltin.net>
Mon, 30 Jun 2014 03:36:07 +0000 (13:36 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 2 Jul 2014 10:26:41 +0000 (20:26 +1000)
Move the code to new a new file and globally rename variable
NSD_SERVERS to NODES_STORAGE_GPFS.

Signed-off-by: Martin Schwenke <martin@meltin.net>
base/all/root/scripts/setup_clusterfs_gpfs.sh
config.d/50sofs.defconf
config.d/55node_storage_gpfs.defconf [new file with mode: 0644]

index 4ab3d968f80510074a18a2f63341010f16bbd14b..9db9dab95b3e51f5104e607d906f8b249dff4fe4 100755 (executable)
@@ -9,26 +9,26 @@ set -e
 gpfs_num_nsds="@@GPFS_DEFAULT_NSDS@@"
 cluster_name="@@CLUSTER@@"
 mountpoint="@@CLUSTERFS_DEFAULT_MOUNTPOINT@@"
-nsd_servers="@@NSD_SERVERS@@"
+nodes_storage_gpfs="@@NODES_STORAGE_GPFS@@"
 
 dir=$(dirname "$0")
 
 ##################################################
 
-# If there are sofs_storage nodes in the cluster (meaning that
-# other sofs_* nodes will not have direct-attached storage) then
+# If there are "storage_gpfs" nodes in the cluster (meaning that
+# other "sofs_front" nodes will not have direct-attached storage) then
 # scripts that include this snippet must be run on one of the
 # storage nodes.  Therefore, in the case, this snippet tries to
-# determine if it is running on the 1st NSD server and, if not,
+# determine if it is running on the 1st GPFS storage node and, if not,
 # attempts to run the script there.
-if [ -n "$nsd_servers" -a \
-    "${HOSTNAME%%.*}" != "${nsd_servers%%[.,]*}" ] ; then
+if [ -n "$nodes_storage_gpfs" -a \
+    "${HOSTNAME%%.*}" != "${nodes_storage_gpfs%%[.,]*}" ] ; then
     if [ "${0#/}" != "$0" ] ; then 
        script="$0"
     else
        script="${PWD}/${0}"
     fi
-    re_exec_node="${nsd_servers%%[.,]*}"
+    re_exec_node="${nodes_storage_gpfs%%[.,]*}"
     echo
     echo "Creating NSDs on node \"${re_exec_node}\""
     exec ssh "$re_exec_node" "$script" "$@"
@@ -44,12 +44,12 @@ gpfs_setup ()
 
     _first="${_nodes%% *}"
 
-    # Determine primary and secondary nodes.  Give preference to NSD
-    # servers, falling back to regular nodes if there aren't any or
-    # aren't enough.
-    if [ -n "$nsd_servers" ] ; then
-       _primary="${nsd_servers%%,*}"
-       _rest="${nsd_servers#*,}"
+    # Determine primary and secondary nodes.  Give preference to GPFS
+    # storage nodes, falling back to regular nodes if there aren't any
+    # or aren't enough.
+    if [ -n "$nodes_storage_gpfs" ] ; then
+       _primary="${nodes_storage_gpfs%%,*}"
+       _rest="${nodes_storage_gpfs#*,}"
        _secondary="${_rest%%,*}"
     fi
     if [ -z "$_primary" ] ; then
@@ -69,13 +69,13 @@ gpfs_setup ()
        for _n in $_nodes ; do
            if [ "$_n" = "$_first" ] ; then
                echo "${_n}:manager-quorum:"
-           elif [ -n "$nsd_servers" ] ; then
+           elif [ -n "$nodes_storage_gpfs" ] ; then
                echo "${_n}:manager:"
            else
                echo "${_n}:manager-quorum:"
            fi
        done
-       for _n in $(echo "$nsd_servers" | sed -e 's@,@ @g') ; do
+       for _n in $(echo "$nodes_storage_gpfs" | sed -e 's@,@ @g') ; do
            echo "${_n}:manager-quorum:"
        done
     } >"$_nodefile"
@@ -125,7 +125,7 @@ gpfs_setup ()
 
 nsdfile="${dir}/gpfs_nsds_all.${cluster_name}"
 
-# Uses: nsd_servers
+# Uses: nodes_storage_gpfs
 # Sets: nsdfile
 gpfs_mknsd ()
 {
@@ -146,7 +146,7 @@ gpfs_mknsd ()
     sed -r -n -e "s@^[^[:space:]]+[[:space:]]+\(($pat)\)[[:space:]](dm-[^[:space:]]+).*@\1 \2@p" |
     while read _name _disk ; do
        _name=$(echo "$_name" | tr -d -c '[:alnum:]')
-       echo "${_disk}:${nsd_servers}::dataAndMetadata:1:${_name}:"
+       echo "${_disk}:${nodes_storage_gpfs}::dataAndMetadata:1:${_name}:"
     done >"$nsdfile"
 
     mmcrnsd -F "$nsdfile"
index d95197781f94d54edff816012077d3060b767997..95cfc5f40c950aa8cf10fc05316d1e2326faf5e3 100644 (file)
@@ -31,46 +31,3 @@ 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"
-    local name="$2"
-    local ctdb_node="$3"
-
-    echo "Creating SoFS storage node $name"
-
-    create_node_COMMON "$name" "$ip_offset" "$type"
-}
-
-node_has_shared_disks_sofs_storage ()
-{
-    true
-}
-
-is_dedicated_storage_node_sofs_storage ()
-{
-    true
-}
diff --git a/config.d/55node_storage_gpfs.defconf b/config.d/55node_storage_gpfs.defconf
new file mode 100644 (file)
index 0000000..4601714
--- /dev/null
@@ -0,0 +1,42 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!
+
+NODES_STORAGE_GPFS=
+
+hack_nodes_storage_gpfs ()
+{
+    local node_count_storage_gpfs=0
+    hack_filter ()
+    {
+       if [ "$node_type" = "storage_gpfs" ] ; then
+           node_count_storage_gpfs=$(($node_count_storage_gpfs + 1))
+           name="${CLUSTER}storage${node_count_storage_gpfs}"
+           ctdb_node=0
+           local ld=$(echo $DOMAIN | tr 'A-Z' 'a-z')
+           NODES_STORAGE_GPFS="${NODES_STORAGE_GPFS}${NODES_STORAGE_GPFS:+,}${name}.${ld}"
+       fi
+    }
+    hack_all_nodes_with hack_filter
+}
+
+register_hook hack_nodes_functions hack_nodes_storage_gpfs
+
+create_node_storage_gpfs ()
+{
+    local ip_offset="$1"
+    local name="$2"
+    local ctdb_node="$3"
+
+    echo "Creating GPFS storage node $name"
+
+    create_node_COMMON "$name" "$ip_offset" "$type"
+}
+
+node_has_shared_disks_storage_gpfs ()
+{
+    true
+}
+
+is_dedicated_storage_node_storage_gpfs ()
+{
+    true
+}