int update_ip_assignment_tree(struct ctdb_context *ctdb,
struct ctdb_public_ip *ip);
+int ctdb_init_tevent_logging(struct ctdb_context *ctdb);
+
#endif
ctdb->ev = event_context_init(NULL);
tevent_loop_allow_nesting(ctdb->ev);
+ ret = ctdb_init_tevent_logging(ctdb);
+ if (ret != 0) {
+ DEBUG(DEBUG_ALERT,("Failed to initialize TEVENT logging\n"));
+ exit(1);
+ }
ctdb_set_child_logging(ctdb);
}
+/*
+ * set up a log handler to catch logging from TEVENT
+ */
+static void ctdb_tevent_logging(void *private_data,
+ enum tevent_debug_level level,
+ const char *fmt,
+ va_list ap)
+{
+ enum debug_level lvl = DEBUG_EMERG;
+
+ switch (level) {
+ case TEVENT_DEBUG_FATAL:
+ lvl = DEBUG_EMERG;
+ break;
+ case TEVENT_DEBUG_ERROR:
+ lvl = DEBUG_ERR;
+ break;
+ case TEVENT_DEBUG_WARNING:
+ lvl = DEBUG_WARNING;
+ break;
+ case TEVENT_DEBUG_TRACE:
+ lvl = DEBUG_DEBUG;
+ break;
+ }
+
+ if (lvl <= LogLevel) {
+ this_log_level = lvl;
+ do_debug_v(fmt, ap);
+ }
+}
+
+int ctdb_init_tevent_logging(struct ctdb_context *ctdb)
+{
+ int ret;
+
+ ret = tevent_set_debug(ctdb->ev,
+ ctdb_tevent_logging,
+ ctdb);
+ return ret;
+}
}
DEBUG(DEBUG_NOTICE,("Starting CTDB daemon\n"));
+
gettimeofday(&ctdb->ctdbd_start_time, NULL);
gettimeofday(&ctdb->last_recovery_started, NULL);
gettimeofday(&ctdb->last_recovery_finished, NULL);