/* called when the "startup" event script has finished */
-static void ctdb_start_transport(struct ctdb_context *ctdb, int status, void *p)
+static void ctdb_start_transport(struct ctdb_context *ctdb)
{
- if (status != 0) {
- DEBUG(0,("startup event failed!\n"));
- ctdb_fatal(ctdb, "startup event script failed");
- }
-
/* start the transport running */
if (ctdb->methods->start(ctdb) != 0) {
DEBUG(0,("transport failed to start!\n"));
/* release any IPs we hold from previous runs of the daemon */
ctdb_release_all_ips(ctdb);
- ret = ctdb_event_script_callback(ctdb, timeval_zero(), ctdb,
- ctdb_start_transport, NULL, "startup");
- if (ret != 0) {
- DEBUG(0,("Failed startup event script\n"));
- return -1;
- }
+ /* start the transport going */
+ ctdb_start_transport(ctdb);
/* go into a wait loop to allow other nodes to complete */
event_loop_wait(ctdb->ev);
}
+/*
+ called when the startup event script finishes
+ */
+static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p)
+{
+ if (status != 0) {
+ DEBUG(0,("startup event failed\n"));
+ } else if (status == 0) {
+ DEBUG(0,("startup event OK - enabling monitoring\n"));
+ ctdb->done_startup = true;
+ }
+
+ if (ctdb->done_startup) {
+ event_add_timed(ctdb->ev, ctdb->monitor_context,
+ timeval_zero(),
+ ctdb_check_health, ctdb);
+ } else {
+ event_add_timed(ctdb->ev, ctdb->monitor_context,
+ timeval_current_ofs(ctdb->tunable.monitor_interval, 0),
+ ctdb_check_health, ctdb);
+ }
+
+}
+
+
/*
see if the event scripts think we are healthy
*/
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
int ret;
- if (ctdb->monitoring_mode == CTDB_MONITORING_DISABLED) {
+ if (ctdb->monitoring_mode == CTDB_MONITORING_DISABLED && ctdb->done_startup) {
event_add_timed(ctdb->ev, ctdb->monitor_context,
timeval_current_ofs(ctdb->tunable.monitor_interval, 0),
ctdb_check_health, ctdb);
return;
}
- ret = ctdb_event_script_callback(ctdb,
- timeval_current_ofs(ctdb->tunable.script_timeout, 0),
- ctdb->monitor_context, ctdb_health_callback, ctdb, "monitor");
+ if (!ctdb->done_startup) {
+ ret = ctdb_event_script_callback(ctdb,
+ timeval_current_ofs(ctdb->tunable.script_timeout, 0),
+ ctdb->monitor_context, ctdb_startup_callback,
+ ctdb, "startup");
+ } else {
+ ret = ctdb_event_script_callback(ctdb,
+ timeval_current_ofs(ctdb->tunable.script_timeout, 0),
+ ctdb->monitor_context, ctdb_health_callback,
+ ctdb, "monitor");
+ }
+
if (ret != 0) {
DEBUG(0,("Unable to launch monitor event script\n"));
event_add_timed(ctdb->ev, ctdb->monitor_context,