summaryrefslogtreecommitdiffstats
path: root/ctdb/server/ctdb_daemon.c
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-06-19 10:58:14 +1000
committerAmitay Isaacs <amitay@gmail.com>2013-06-22 15:51:02 +1000
commit6a52a87028c653edbcede161e96857ff37d802ee (patch)
tree53dbcedfd10505f4b15c35a84b97cf6af0e22e8b /ctdb/server/ctdb_daemon.c
parent01d879806bc772cff66134dd3bcece9c2cedbac0 (diff)
downloadsamba-6a52a87028c653edbcede161e96857ff37d802ee.tar.gz
samba-6a52a87028c653edbcede161e96857ff37d802ee.tar.xz
samba-6a52a87028c653edbcede161e96857ff37d802ee.zip
ctdbd: Refactor shutdown sequence
Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit b32fd04bfbf33062d45365b37a7247e272a76ceb)
Diffstat (limited to 'ctdb/server/ctdb_daemon.c')
-rw-r--r--ctdb/server/ctdb_daemon.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index b0252556db6..3c813ab9b8c 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -1725,3 +1725,20 @@ int32_t ctdb_control_process_exists(struct ctdb_context *ctdb, pid_t pid)
return kill(pid, 0);
}
+
+void ctdb_shutdown_sequence(struct ctdb_context *ctdb, int exit_code)
+{
+ DEBUG(DEBUG_NOTICE,("Shutdown sequence commencing.\n"));
+ ctdb_set_runstate(ctdb, CTDB_RUNSTATE_SHUTDOWN);
+ ctdb_stop_recoverd(ctdb);
+ ctdb_stop_keepalive(ctdb);
+ ctdb_stop_monitoring(ctdb);
+ ctdb_release_all_ips(ctdb);
+ ctdb_event_script(ctdb, CTDB_EVENT_SHUTDOWN);
+ if (ctdb->methods != NULL) {
+ ctdb->methods->shutdown(ctdb);
+ }
+
+ DEBUG(DEBUG_NOTICE,("Shutdown sequence complete, exiting.\n"));
+ exit(exit_code);
+}