summaryrefslogtreecommitdiffstats
path: root/config.d
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-07-02 11:56:54 +1000
committerMartin Schwenke <martin@meltin.net>2014-07-02 20:26:52 +1000
commita24dcfc63f5074f2971c869b24880dc77c2f3232 (patch)
tree11f24c931a437b425f2d0153a9d00a49dbe38fb6 /config.d
parent55d315b1118283c60edaf365ef9b123eaea27bed (diff)
downloadautocluster-a24dcfc63f5074f2971c869b24880dc77c2f3232.tar.gz
autocluster-a24dcfc63f5074f2971c869b24880dc77c2f3232.tar.xz
autocluster-a24dcfc63f5074f2971c869b24880dc77c2f3232.zip
Add create_node_DEFAULT, no more hack_nodes_functions
Reduce the amount of work needed to define how to create a new node type. * Each node type definition needs to define node_name_format_<TYPE>() * Node types that should be part of the CTDB cluster should define node_is_ctdb_node_<TYPE>() and have it echo 1 * Nodes need not define create_node_<TYPE>() if they don't do anything unusual. Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'config.d')
-rw-r--r--config.d/00base.defconf30
-rw-r--r--config.d/50node_nas.defconf25
-rw-r--r--config.d/51node_rhel_base.defconf6
-rw-r--r--config.d/52node_build.defconf10
-rw-r--r--config.d/55node_storage_gpfs.defconf22
-rw-r--r--config.d/57node_ad.defconf5
-rw-r--r--config.d/60tsm.defconf26
7 files changed, 31 insertions, 93 deletions
diff --git a/config.d/00base.defconf b/config.d/00base.defconf
index c39026f..e380fa9 100644
--- a/config.d/00base.defconf
+++ b/config.d/00base.defconf
@@ -528,36 +528,6 @@ defconf CREATE_BASE_TIMEOUT 3600 \
##############################
-register_hook hack_nodes_functions hack_nodes_rhel_base
-
-hack_nodes_rhel_base ()
-{
- local node_count_rhel_base=0
- hack_filter ()
- {
- case "$node_type" in
- rhel_base)
- node_count_rhel_base=$(($node_count_rhel_base + 1))
- name="${CLUSTER}base${node_count_rhel_base}"
- # rhel_base nodes are not part of CTDB cluster
- ctdb_node=0
- esac
- }
- hack_all_nodes_with hack_filter
-}
-
-create_node_rhel_base ()
-{
- local ip_offset="$1"
- local name="$2"
- local ctdb_node="$3"
-
- echo "Creating RHEL base node $name"
- create_node_COMMON "$name" "$ip_offset" "$type"
-}
-
-##############################
-
# Authentication method
defconf AUTH_METHOD "files" \
"files|winbind" "authentication method"
diff --git a/config.d/50node_nas.defconf b/config.d/50node_nas.defconf
index 794c42f..65c14fd 100644
--- a/config.d/50node_nas.defconf
+++ b/config.d/50node_nas.defconf
@@ -1,30 +1,13 @@
# Hey Emacs, this is a -*- shell-script -*- !!!
-hack_nodes_nas ()
+node_name_format_nas ()
{
- local node_count_nas=0
- hack_filter ()
- {
- if [ "$node_type" = "nas" ] ; then
- node_count_nas=$(($node_count_nas + 1))
- name="${CLUSTER}nas${node_count_nas}"
- ctdb_node=1
- fi
- }
- hack_all_nodes_with hack_filter
+ echo '%snas%d'
}
-register_hook hack_nodes_functions hack_nodes_nas
-
-create_node_nas ()
+node_is_ctdb_node_nas ()
{
- local ip_offset="$1"
- local name="$2"
- local ctdb_node="$3"
-
- echo "Creating NAS node $name"
-
- create_node_COMMON "$name" "$ip_offset" "$type"
+ echo 1
}
node_has_shared_disks_nas ()
diff --git a/config.d/51node_rhel_base.defconf b/config.d/51node_rhel_base.defconf
new file mode 100644
index 0000000..ddb90b5
--- /dev/null
+++ b/config.d/51node_rhel_base.defconf
@@ -0,0 +1,6 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!
+
+node_name_format_rhel_base ()
+{
+ echo '%sbase%d'
+}
diff --git a/config.d/52node_build.defconf b/config.d/52node_build.defconf
index b375e0c..c9fc3e0 100644
--- a/config.d/52node_build.defconf
+++ b/config.d/52node_build.defconf
@@ -1,14 +1,8 @@
# Hey Emacs, this is a -*- shell-script -*- !!!
-create_node_build ()
+node_name_format_build ()
{
- local ip_offset="$1"
- local name="$2"
- local ctdb_node="$3"
-
- echo "Creating build node $name"
-
- create_node_COMMON "$name" "$ip_offset" "$type"
+ echo '%sbuild%d'
}
cluster_setup_tasks_build ()
diff --git a/config.d/55node_storage_gpfs.defconf b/config.d/55node_storage_gpfs.defconf
index 4ed9ebd..08f9811 100644
--- a/config.d/55node_storage_gpfs.defconf
+++ b/config.d/55node_storage_gpfs.defconf
@@ -2,31 +2,21 @@
NODES_STORAGE_GPFS=
-hack_nodes_storage_gpfs ()
+node_name_format_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
+ echo '%sstorage%d'
}
-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"
+ local ld=$(echo $DOMAIN | tr 'A-Z' 'a-z')
+ NODES_STORAGE_GPFS="${NODES_STORAGE_GPFS}${NODES_STORAGE_GPFS:+,}${name}.${ld}"
+
+ echo "Creating node \"${name}\" (of type \"storage_gpfs\")"
create_node_COMMON "$name" "$ip_offset" "$type"
}
diff --git a/config.d/57node_ad.defconf b/config.d/57node_ad.defconf
index 8abeade..8cc791c 100644
--- a/config.d/57node_ad.defconf
+++ b/config.d/57node_ad.defconf
@@ -9,6 +9,11 @@ defconf AD_FUNCTION_LEVEL "2008" \
defconf AD_NETBIOS_NAME "samba4" \
"<string>" "NetBIOS name to use for AD server"
+node_name_format_ad ()
+{
+ echo '%sad%d'
+}
+
cluster_setup_tasks_ad ()
{
case "$1" in
diff --git a/config.d/60tsm.defconf b/config.d/60tsm.defconf
index e0ed1c6..c831188 100644
--- a/config.d/60tsm.defconf
+++ b/config.d/60tsm.defconf
@@ -25,24 +25,14 @@ defconf TSM_TEMPLATE "$installdir/templates/tsmserver.xml" \
# TSM server node type
-register_hook hack_nodes_functions hack_nodes_tsm_server
-
-hack_nodes_tsm_server ()
+node_name_format_tsm ()
{
- local node_count_tsm_server=0
# If only 1 tsm_server node then don't number it.
- [ "${NODES/tsm_server:/}" = "${NODES//tsm_server:/}" ] && \
- node_count_tsm_server=""
- hack_filter ()
- {
- if [ "$node_type" = "tsm_server" ] ; then
- [ -n "$node_count_tsm_server" ] && \
- node_count_tsm_server=$(($node_count_tsm_server + 1))
- name="${CLUSTER}tsm${node_count_tsm_server}"
- ctdb_node=0
- fi
- }
- hack_all_nodes_with hack_filter
+ if [ "${NODES/tsm_server:/}" = "${NODES//tsm_server:/}" ] ; then
+ echo '%stsm'
+ else
+ echo '%stsm%d'
+ fi
}
create_node_tsm_server ()
@@ -55,7 +45,7 @@ create_node_tsm_server ()
# template needs the value of TSMDISK.
TSMDISK="${VIRTBASE}/${CLUSTER}/${name}storage.qcow2"
- echo "Creating TSM server node $name"
+ echo "Creating node \"${name}\" (of type \"tsm_server\""
create_node_COMMON "$name" "$ip_offset" "$type" "$TSM_TEMPLATE"
local di="$TSMDISK"
@@ -63,7 +53,7 @@ create_node_tsm_server ()
di=$(readlink "$TSMDISK")
fi
- echo "Creating tsm disk"
+ echo "Creating TSM disk"
qemu-img create -f qcow2 "$di" $TSMDISKSIZE
echo