From 12fd8d7a5c5d14d403aac6cd9e318afcd0a8e159 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 15 May 2018 13:39:15 +1000 Subject: [PATCH] ctdb-scripts: Move event scripts to events/legacy/ directory This is the initial location that will be used by the new multi-component aware event daemon. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/.gitignore | 1 - ctdb/config/README | 4 ++-- ctdb/config/{events.d => events}/README | 5 ++++- ctdb/config/{events.d => events/legacy}/00.ctdb | 0 ctdb/config/{events.d => events/legacy}/01.reclock | 0 ctdb/config/{events.d => events/legacy}/05.system | 0 ctdb/config/{events.d => events/legacy}/06.nfs | 0 ctdb/config/{events.d => events/legacy}/10.interface | 0 ctdb/config/{events.d => events/legacy}/11.natgw | 0 ctdb/config/{events.d => events/legacy}/11.routing | 0 ctdb/config/{events.d => events/legacy}/13.per_ip_routing | 0 ctdb/config/{events.d => events/legacy}/20.multipathd | 0 ctdb/config/{events.d => events/legacy}/31.clamd | 0 ctdb/config/{events.d => events/legacy}/40.vsftpd | 0 ctdb/config/{events.d => events/legacy}/41.httpd | 0 ctdb/config/{events.d => events/legacy}/49.winbind | 0 ctdb/config/{events.d => events/legacy}/50.samba | 0 ctdb/config/{events.d => events/legacy}/60.nfs | 0 ctdb/config/{events.d => events/legacy}/70.iscsi | 0 ctdb/config/{events.d => events/legacy}/91.lvs | 0 ctdb/config/{events.d => events/legacy}/99.timeout | 0 ctdb/config/functions | 2 +- ctdb/packaging/RPM/ctdb.spec.in | 8 ++++---- ctdb/server/ctdbd.c | 2 +- ctdb/tests/complex/90_debug_hung_script.sh | 2 +- ctdb/tests/eventscripts/scripts/local.sh | 8 ++++---- ctdb/tests/shellcheck/event_scripts.sh | 2 +- .../simple/etc-ctdb/{events.d => events/legacy}/00.test | 0 ctdb/tests/simple/scripts/local_daemons.bash | 2 +- ctdb/wscript | 2 +- 30 files changed, 20 insertions(+), 18 deletions(-) rename ctdb/config/{events.d => events}/README (97%) rename ctdb/config/{events.d => events/legacy}/00.ctdb (100%) rename ctdb/config/{events.d => events/legacy}/01.reclock (100%) rename ctdb/config/{events.d => events/legacy}/05.system (100%) rename ctdb/config/{events.d => events/legacy}/06.nfs (100%) rename ctdb/config/{events.d => events/legacy}/10.interface (100%) rename ctdb/config/{events.d => events/legacy}/11.natgw (100%) rename ctdb/config/{events.d => events/legacy}/11.routing (100%) rename ctdb/config/{events.d => events/legacy}/13.per_ip_routing (100%) rename ctdb/config/{events.d => events/legacy}/20.multipathd (100%) rename ctdb/config/{events.d => events/legacy}/31.clamd (100%) rename ctdb/config/{events.d => events/legacy}/40.vsftpd (100%) rename ctdb/config/{events.d => events/legacy}/41.httpd (100%) rename ctdb/config/{events.d => events/legacy}/49.winbind (100%) rename ctdb/config/{events.d => events/legacy}/50.samba (100%) rename ctdb/config/{events.d => events/legacy}/60.nfs (100%) rename ctdb/config/{events.d => events/legacy}/70.iscsi (100%) rename ctdb/config/{events.d => events/legacy}/91.lvs (100%) rename ctdb/config/{events.d => events/legacy}/99.timeout (100%) rename ctdb/tests/simple/etc-ctdb/{events.d => events/legacy}/00.test (100%) diff --git a/ctdb/.gitignore b/ctdb/.gitignore index 9e8c5812e9d..a634aeb8b45 100644 --- a/ctdb/.gitignore +++ b/ctdb/.gitignore @@ -22,7 +22,6 @@ public_addresses.txt rec.lock test.db tests/bin -tests/events.d/00.ctdb_test_trigger tests/var tests/takeover/ctdb_takeover.pyc tests/eventscripts/var diff --git a/ctdb/config/README b/ctdb/config/README index ffbeb0e690b..d28f4f0fc60 100644 --- a/ctdb/config/README +++ b/ctdb/config/README @@ -6,9 +6,9 @@ Selected highlights: An initscript for starting ctdbd at boot time. - events.d/ + events/ - Eventscripts. See events.d/README for more details. + Eventscripts. See events/README for more details. functions diff --git a/ctdb/config/events.d/README b/ctdb/config/events/README similarity index 97% rename from ctdb/config/events.d/README rename to ctdb/config/events/README index f13714a7a2e..88d5da45b6e 100644 --- a/ctdb/config/events.d/README +++ b/ctdb/config/events/README @@ -1,8 +1,11 @@ -The events.d/ directory contains event scripts used by CTDB. Event +The events/ directory contains event scripts used by CTDB. Event scripts are triggered on certain events, such as startup, monitoring or public IP allocation. Scripts may be specific to services, networking or internal CTDB operations. +Scripts are divided into subdirectories for different CTDB components. +Right now the only component is "legacy". + All event scripts start with the prefix 'NN.' where N is a digit. The event scripts are run in sequence based on NN. Thus 10.interface will be run before 60.nfs. It is recommended to keep each NN unique. diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events/legacy/00.ctdb similarity index 100% rename from ctdb/config/events.d/00.ctdb rename to ctdb/config/events/legacy/00.ctdb diff --git a/ctdb/config/events.d/01.reclock b/ctdb/config/events/legacy/01.reclock similarity index 100% rename from ctdb/config/events.d/01.reclock rename to ctdb/config/events/legacy/01.reclock diff --git a/ctdb/config/events.d/05.system b/ctdb/config/events/legacy/05.system similarity index 100% rename from ctdb/config/events.d/05.system rename to ctdb/config/events/legacy/05.system diff --git a/ctdb/config/events.d/06.nfs b/ctdb/config/events/legacy/06.nfs similarity index 100% rename from ctdb/config/events.d/06.nfs rename to ctdb/config/events/legacy/06.nfs diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events/legacy/10.interface similarity index 100% rename from ctdb/config/events.d/10.interface rename to ctdb/config/events/legacy/10.interface diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events/legacy/11.natgw similarity index 100% rename from ctdb/config/events.d/11.natgw rename to ctdb/config/events/legacy/11.natgw diff --git a/ctdb/config/events.d/11.routing b/ctdb/config/events/legacy/11.routing similarity index 100% rename from ctdb/config/events.d/11.routing rename to ctdb/config/events/legacy/11.routing diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events/legacy/13.per_ip_routing similarity index 100% rename from ctdb/config/events.d/13.per_ip_routing rename to ctdb/config/events/legacy/13.per_ip_routing diff --git a/ctdb/config/events.d/20.multipathd b/ctdb/config/events/legacy/20.multipathd similarity index 100% rename from ctdb/config/events.d/20.multipathd rename to ctdb/config/events/legacy/20.multipathd diff --git a/ctdb/config/events.d/31.clamd b/ctdb/config/events/legacy/31.clamd similarity index 100% rename from ctdb/config/events.d/31.clamd rename to ctdb/config/events/legacy/31.clamd diff --git a/ctdb/config/events.d/40.vsftpd b/ctdb/config/events/legacy/40.vsftpd similarity index 100% rename from ctdb/config/events.d/40.vsftpd rename to ctdb/config/events/legacy/40.vsftpd diff --git a/ctdb/config/events.d/41.httpd b/ctdb/config/events/legacy/41.httpd similarity index 100% rename from ctdb/config/events.d/41.httpd rename to ctdb/config/events/legacy/41.httpd diff --git a/ctdb/config/events.d/49.winbind b/ctdb/config/events/legacy/49.winbind similarity index 100% rename from ctdb/config/events.d/49.winbind rename to ctdb/config/events/legacy/49.winbind diff --git a/ctdb/config/events.d/50.samba b/ctdb/config/events/legacy/50.samba similarity index 100% rename from ctdb/config/events.d/50.samba rename to ctdb/config/events/legacy/50.samba diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events/legacy/60.nfs similarity index 100% rename from ctdb/config/events.d/60.nfs rename to ctdb/config/events/legacy/60.nfs diff --git a/ctdb/config/events.d/70.iscsi b/ctdb/config/events/legacy/70.iscsi similarity index 100% rename from ctdb/config/events.d/70.iscsi rename to ctdb/config/events/legacy/70.iscsi diff --git a/ctdb/config/events.d/91.lvs b/ctdb/config/events/legacy/91.lvs similarity index 100% rename from ctdb/config/events.d/91.lvs rename to ctdb/config/events/legacy/91.lvs diff --git a/ctdb/config/events.d/99.timeout b/ctdb/config/events/legacy/99.timeout similarity index 100% rename from ctdb/config/events.d/99.timeout rename to ctdb/config/events/legacy/99.timeout diff --git a/ctdb/config/functions b/ctdb/config/functions index 30afcdec962..5cc995adf3f 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -64,7 +64,7 @@ load_script_options () fi if [ -n "$_script" ] ; then - _s="${CTDB_BASE}/events.d/${_script}" + _s="${CTDB_BASE}/events/legacy/${_script}" else _s="${0%.script}" fi diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in index 55a0175a774..40871d3d8f2 100644 --- a/ctdb/packaging/RPM/ctdb.spec.in +++ b/ctdb/packaging/RPM/ctdb.spec.in @@ -131,8 +131,8 @@ install -m755 config/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/notify.d # This is a hack. All documents should be installed in /usr/share/doc. -rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events.d/README -cp config/events.d/README README.eventscripts +rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events/README +cp config/events/README README.eventscripts rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/nfs-checks.d/README cp config/nfs-checks.d/README README.nfs-checks.d cp config/notify.d.README README.notify.d @@ -179,8 +179,8 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/sudoers.d/ctdb %dir %{_sysconfdir}/ctdb %{_sysconfdir}/ctdb/functions -%dir %{_sysconfdir}/ctdb/events.d -%{_sysconfdir}/ctdb/events.d/* +%dir %{_sysconfdir}/ctdb/events +%{_sysconfdir}/ctdb/events/* %dir %{_sysconfdir}/ctdb/nfs-checks.d %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/00.portmapper.check %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/10.status.check diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 5290165a2a4..93aedf2e4d9 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -350,7 +350,7 @@ int main(int argc, const char *argv[]) ctdb_tunables_set_defaults(ctdb); ctdb->event_script_dir = talloc_asprintf(ctdb, - "%s/events.d", + "%s/events/legacy", ctdb_base); if (ctdb->event_script_dir == NULL) { DBG_ERR("Out of memory\n"); diff --git a/ctdb/tests/complex/90_debug_hung_script.sh b/ctdb/tests/complex/90_debug_hung_script.sh index b2518df6fdb..fc44bad8cb9 100755 --- a/ctdb/tests/complex/90_debug_hung_script.sh +++ b/ctdb/tests/complex/90_debug_hung_script.sh @@ -84,7 +84,7 @@ done <<'EOF' ===== Start of hung script debug for PID=".*", event="monitor" ===== ===== End of hung script debug for PID=".*", event="monitor" ===== pstree -p -a .*: -99\\.timeout,.* /etc/ctdb/events.d/99.timeout monitor +99\\.timeout,.* /etc/ctdb/events/legacy/99.timeout monitor *\`-sleep,.* ---- Stack trace of interesting process [0-9]*\\[sleep\\] ---- [<[0-9a-f]*>] .*sleep+.* diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh index d34135eba35..3f6bf16b5bc 100644 --- a/ctdb/tests/eventscripts/scripts/local.sh +++ b/ctdb/tests/eventscripts/scripts/local.sh @@ -40,7 +40,7 @@ else fi setup_ctdb_base "$EVENTSCRIPTS_TESTS_VAR_DIR" "etc-ctdb" \ - events.d \ + events \ functions \ nfs-checks.d \ nfs-linux-kernel-callout \ @@ -85,7 +85,7 @@ setup_script_options () fi if [ -n "$_script" ] ; then - _options="${CTDB_BASE}/events.d/${_script}.options" + _options="${CTDB_BASE}/events/legacy/${_script}.options" else _options="${script_dir}/${script%.script}.options" fi @@ -458,12 +458,12 @@ define_test () [0-9][0-9].*.*) script="${_f%.*}" event="${_f##*.}" - script_dir="${CTDB_BASE}/events.d" + script_dir="${CTDB_BASE}/events/legacy" ;; [0-9][0-9].*) script="$_f" unset event - script_dir="${CTDB_BASE}/events.d" + script_dir="${CTDB_BASE}/events/legacy" ;; *.*) script="${_f%.*}" diff --git a/ctdb/tests/shellcheck/event_scripts.sh b/ctdb/tests/shellcheck/event_scripts.sh index b8a2b7844a3..b64c93649c8 100755 --- a/ctdb/tests/shellcheck/event_scripts.sh +++ b/ctdb/tests/shellcheck/event_scripts.sh @@ -4,4 +4,4 @@ define_test "event scripts" -shellcheck_test "${CTDB_SCRIPTS_BASE}/events.d"/[0-9][0-9].* +shellcheck_test "${CTDB_SCRIPTS_BASE}/events/"*/[0-9][0-9].* diff --git a/ctdb/tests/simple/etc-ctdb/events.d/00.test b/ctdb/tests/simple/etc-ctdb/events/legacy/00.test similarity index 100% rename from ctdb/tests/simple/etc-ctdb/events.d/00.test rename to ctdb/tests/simple/etc-ctdb/events/legacy/00.test diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash index b3d0087888c..f681b18f6f1 100644 --- a/ctdb/tests/simple/scripts/local_daemons.bash +++ b/ctdb/tests/simple/scripts/local_daemons.bash @@ -137,7 +137,7 @@ setup_ctdb () done if $no_event_scripts ; then - rm -vf "${CTDB_BASE}/events.d/"* + rm -vf "${CTDB_BASE}/events/legacy/"* fi cat >"${CTDB_BASE}/ctdb.conf" <