diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-02-12 11:24:08 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-02-23 10:38:49 +0100 |
commit | 3419e9c4dd8f59865783e183ee2177870a776180 (patch) | |
tree | da8cf7b867b9915a802f28c36a8c2466652b1ad7 /ctdb/server/ctdb_daemon.c | |
parent | 061c2a71822cc5ecc72316c9946b2a9989b91db0 (diff) | |
download | samba-3419e9c4dd8f59865783e183ee2177870a776180.tar.gz samba-3419e9c4dd8f59865783e183ee2177870a776180.tar.xz samba-3419e9c4dd8f59865783e183ee2177870a776180.zip |
server: add "setup" event
This is needed because the "init" event can't use 'ctdb' commands.
metze
(This used to be ctdb commit 1493436b6b24eb05a23b7a339071ad85f70de8f4)
Diffstat (limited to 'ctdb/server/ctdb_daemon.c')
-rw-r--r-- | ctdb/server/ctdb_daemon.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 5903f69635d..3d3af5b36db 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -694,6 +694,22 @@ static void sig_child_handler(struct event_context *ev, } } +static void ctdb_setup_event_callback(struct ctdb_context *ctdb, int status, + void *private_data) +{ + if (status != 0) { + ctdb_fatal(ctdb, "Failed to run setup event\n"); + return; + } + ctdb_run_notification_script(ctdb, "setup"); + + /* tell all other nodes we've just started up */ + ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, + 0, CTDB_CONTROL_STARTUP, 0, + CTDB_CTRL_FLAG_NOREPLY, + tdb_null, NULL, NULL); +} + /* start the protocol going as a daemon */ @@ -797,12 +813,6 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog) EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_accept_client, ctdb); - /* tell all other nodes we've just started up */ - ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, - 0, CTDB_CONTROL_STARTUP, 0, - CTDB_CTRL_FLAG_NOREPLY, - tdb_null, NULL, NULL); - /* release any IPs we hold from previous runs of the daemon */ ctdb_release_all_ips(ctdb); @@ -819,6 +829,18 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog) exit(1); } + ret = ctdb_event_script_callback(ctdb, + ctdb, + ctdb_setup_event_callback, + ctdb, + false, + CTDB_EVENT_SETUP, + ""); + if (ret != 0) { + DEBUG(DEBUG_CRIT,("Failed to set up 'setup' event\n")); + exit(1); + } + if (use_syslog) { if (start_syslog_daemon(ctdb)) { DEBUG(DEBUG_CRIT, ("Failed to start syslog daemon\n")); |