summaryrefslogtreecommitdiffstats
path: root/ctdb/server/ctdb_daemon.c
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-01-10 16:06:25 +1100
committerAmitay Isaacs <amitay@gmail.com>2013-05-24 14:08:06 +1000
commit63577c96db3877417030f441268b3ec79bb82c2a (patch)
treedaf62bef0535c6bdbc496591b9276bb2b876b04a /ctdb/server/ctdb_daemon.c
parentc5bcff6724b85bac1a6343f67034b81ebbb7a2c2 (diff)
downloadsamba-63577c96db3877417030f441268b3ec79bb82c2a.tar.gz
samba-63577c96db3877417030f441268b3ec79bb82c2a.tar.xz
samba-63577c96db3877417030f441268b3ec79bb82c2a.zip
ctdbd: Replace ctdb->done_startup with ctdb->runstate
This allows states, including startup and shutdown states, to be clearly tracked. This doesn't include regular runtime "states", which are handled by node flags. Introduce new functions ctdb_set_runstate(), runstate_to_string() and runstate_from_string(). Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 8076773a9924dcf8aff16f7d96b2b9ac383ecc28)
Diffstat (limited to 'ctdb/server/ctdb_daemon.c')
-rw-r--r--ctdb/server/ctdb_daemon.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index d2df1150a7..bcead6f469 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -1054,6 +1054,8 @@ static void ctdb_setup_event_callback(struct ctdb_context *ctdb, int status,
}
ctdb_run_notification_script(ctdb, "setup");
+ ctdb_set_runstate(ctdb, CTDB_RUNSTATE_STARTUP);
+
/* tell all other nodes we've just started up */
ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL,
0, CTDB_CONTROL_STARTUP, 0,
@@ -1259,6 +1261,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
ctdb_fatal(ctdb, "Failed to attach to databases\n");
}
+ ctdb_set_runstate(ctdb, CTDB_RUNSTATE_INIT);
ret = ctdb_event_script(ctdb, CTDB_EVENT_INIT);
if (ret != 0) {
ctdb_fatal(ctdb, "Failed to run init event\n");
@@ -1284,6 +1287,8 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
/* start the transport going */
ctdb_start_transport(ctdb);
+ ctdb_set_runstate(ctdb, CTDB_RUNSTATE_SETUP);
+
ret = ctdb_event_script_callback(ctdb,
ctdb,
ctdb_setup_event_callback,