merge from ronnie
authorAndrew Tridgell <tridge@samba.org>
Mon, 4 Feb 2008 09:07:15 +0000 (20:07 +1100)
committerAndrew Tridgell <tridge@samba.org>
Mon, 4 Feb 2008 09:07:15 +0000 (20:07 +1100)
(This used to be ctdb commit e7b57d38cf7255be823a223cf15b7526285b4f1c)

36 files changed:
ctdb/client/ctdb_client.c
ctdb/common/cmdline.c
ctdb/common/ctdb_io.c
ctdb/common/ctdb_ltdb.c
ctdb/common/ctdb_util.c
ctdb/common/rb_tree.c
ctdb/common/system_aix.c
ctdb/common/system_linux.c
ctdb/ib/ibw_ctdb.c
ctdb/ib/ibw_ctdb_init.c
ctdb/ib/ibwrapper.c
ctdb/ib/ibwrapper_test.c
ctdb/server/ctdb_call.c
ctdb/server/ctdb_control.c
ctdb/server/ctdb_daemon.c
ctdb/server/ctdb_freeze.c
ctdb/server/ctdb_keepalive.c
ctdb/server/ctdb_logging.c
ctdb/server/ctdb_ltdb_server.c
ctdb/server/ctdb_monitor.c
ctdb/server/ctdb_persistent.c
ctdb/server/ctdb_recover.c
ctdb/server/ctdb_recoverd.c
ctdb/server/ctdb_server.c
ctdb/server/ctdb_serverids.c
ctdb/server/ctdb_takeover.c
ctdb/server/ctdb_traverse.c
ctdb/server/ctdb_tunables.c
ctdb/server/ctdbd.c
ctdb/server/eventscript.c
ctdb/tcp/tcp_connect.c
ctdb/tcp/tcp_init.c
ctdb/tcp/tcp_io.c
ctdb/tests/ctdb_persistent.c
ctdb/tools/ctdb.c
ctdb/tools/ctdb_vacuum.c

index 2cdec005e9cc2ca8489977815b9855d0602a1e9f..166b982ea3e0884f599d5af36bd8f556a6b31e05 100644 (file)
@@ -45,7 +45,7 @@ struct ctdb_req_header *_ctdbd_allocate_pkt(struct ctdb_context *ctdb,
 
        hdr = (struct ctdb_req_header *)talloc_size(mem_ctx, size);
        if (hdr == NULL) {
-               DEBUG(0,("Unable to allocate packet for operation %u of length %u\n",
+               DEBUG(DEBUG_ERR,("Unable to allocate packet for operation %u of length %u\n",
                         operation, (unsigned)length));
                return NULL;
        }
@@ -160,13 +160,13 @@ static void ctdb_client_reply_call(struct ctdb_context *ctdb, struct ctdb_req_he
 
        state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_client_call_state);
        if (state == NULL) {
-               DEBUG(0,(__location__ " reqid %u not found\n", hdr->reqid));
+               DEBUG(DEBUG_ERR,(__location__ " reqid %u not found\n", hdr->reqid));
                return;
        }
 
        if (hdr->reqid != state->reqid) {
                /* we found a record  but it was the wrong one */
-               DEBUG(0, ("Dropped client call reply with reqid:%u\n",hdr->reqid));
+               DEBUG(DEBUG_ERR, ("Dropped client call reply with reqid:%u\n",hdr->reqid));
                return;
        }
 
@@ -207,7 +207,7 @@ static void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args)
        }
 
        if (cnt < sizeof(*hdr)) {
-               DEBUG(0,("Bad packet length %u in client\n", (unsigned)cnt));
+               DEBUG(DEBUG_CRIT,("Bad packet length %u in client\n", (unsigned)cnt));
                goto done;
        }
        if (cnt != hdr->length) {
@@ -240,7 +240,7 @@ static void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args)
                break;
 
        default:
-               DEBUG(0,("bogus operation code:%u\n",hdr->operation));
+               DEBUG(DEBUG_CRIT,("bogus operation code:%u\n",hdr->operation));
        }
 
 done:
@@ -303,7 +303,7 @@ int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call)
                event_loop_once(state->ctdb_db->ctdb->ev);
        }
        if (state->state != CTDB_CALL_DONE) {
-               DEBUG(0,(__location__ " ctdb_call_recv failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_call_recv failed\n"));
                talloc_free(state);
                return -1;
        }
@@ -388,7 +388,7 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
 
        ret = ctdb_ltdb_lock(ctdb_db, call->key);
        if (ret != 0) {
-               DEBUG(0,(__location__ " Failed to get chainlock\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get chainlock\n"));
                return NULL;
        }
 
@@ -406,14 +406,14 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
 
        state = talloc_zero(ctdb_db, struct ctdb_client_call_state);
        if (state == NULL) {
-               DEBUG(0, (__location__ " failed to allocate state\n"));
+               DEBUG(DEBUG_ERR, (__location__ " failed to allocate state\n"));
                return NULL;
        }
 
        len = offsetof(struct ctdb_req_call, data) + call->key.dsize + call->call_data.dsize;
        c = ctdbd_allocate_pkt(ctdb, state, CTDB_REQ_CALL, len, struct ctdb_req_call);
        if (c == NULL) {
-               DEBUG(0, (__location__ " failed to allocate packet\n"));
+               DEBUG(DEBUG_ERR, (__location__ " failed to allocate packet\n"));
                return NULL;
        }
 
@@ -471,7 +471,7 @@ int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
        res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_REGISTER_SRVID, 0, 
                           tdb_null, NULL, NULL, &status, NULL, NULL);
        if (res != 0 || status != 0) {
-               DEBUG(0,("Failed to register srvid %llu\n", (unsigned long long)srvid));
+               DEBUG(DEBUG_ERR,("Failed to register srvid %llu\n", (unsigned long long)srvid));
                return -1;
        }
 
@@ -490,7 +490,7 @@ int ctdb_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid, void
        res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_DEREGISTER_SRVID, 0, 
                           tdb_null, NULL, NULL, &status, NULL, NULL);
        if (res != 0 || status != 0) {
-               DEBUG(0,("Failed to deregister srvid %llu\n", (unsigned long long)srvid));
+               DEBUG(DEBUG_ERR,("Failed to deregister srvid %llu\n", (unsigned long long)srvid));
                return -1;
        }
 
@@ -592,7 +592,7 @@ again:
        /* step 1 - get the chain lock */
        ret = ctdb_ltdb_lock(ctdb_db, key);
        if (ret != 0) {
-               DEBUG(0, (__location__ " failed to lock ltdb record\n"));
+               DEBUG(DEBUG_ERR, (__location__ " failed to lock ltdb record\n"));
                talloc_free(h);
                return NULL;
        }
@@ -653,7 +653,7 @@ int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data)
 
        rec = ctdb_marshall_record(h, h->ctdb_db->db_id, h->key, &h->header, data);
        if (rec == NULL) {
-               DEBUG(0,("Unable to marshall record in ctdb_record_store\n"));
+               DEBUG(DEBUG_ERR,("Unable to marshall record in ctdb_record_store\n"));
                return -1;
        }
 
@@ -667,7 +667,7 @@ int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data)
        talloc_free(rec);
 
        if (ret != 0 || status != 0) {
-               DEBUG(0,("Failed persistent store in ctdb_record_store\n"));
+               DEBUG(DEBUG_ERR,("Failed persistent store in ctdb_record_store\n"));
                return -1;
        }
 
@@ -735,13 +735,13 @@ static void ctdb_client_reply_control(struct ctdb_context *ctdb,
 
        state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_client_control_state);
        if (state == NULL) {
-               DEBUG(0,(__location__ " reqid %u not found\n", hdr->reqid));
+               DEBUG(DEBUG_ERR,(__location__ " reqid %u not found\n", hdr->reqid));
                return;
        }
 
        if (hdr->reqid != state->reqid) {
                /* we found a record  but it was the wrong one */
-               DEBUG(0, ("Dropped orphaned reply control with reqid:%u\n",hdr->reqid));
+               DEBUG(DEBUG_ERR, ("Dropped orphaned reply control with reqid:%u\n",hdr->reqid));
                return;
        }
 
@@ -786,7 +786,7 @@ static void control_timeout_func(struct event_context *ev, struct timed_event *t
 {
        struct ctdb_client_control_state *state = talloc_get_type(private_data, struct ctdb_client_control_state);
 
-       DEBUG(0,("control timed out. reqid:%d opcode:%d dstnode:%d\n", state->reqid, state->c->opcode, state->c->hdr.destnode));
+       DEBUG(DEBUG_ERR,("control timed out. reqid:%d opcode:%d dstnode:%d\n", state->reqid, state->c->opcode, state->c->hdr.destnode));
 
        state->state = CTDB_CONTROL_TIMEOUT;
 
@@ -891,7 +891,7 @@ int ctdb_control_recv(struct ctdb_context *ctdb,
        }
 
        if (state->state != CTDB_CONTROL_DONE) {
-               DEBUG(0,(__location__ " ctdb_control_recv failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control_recv failed\n"));
                if (state->async.fn) {
                        state->async.fn(state);
                }
@@ -900,7 +900,7 @@ int ctdb_control_recv(struct ctdb_context *ctdb,
        }
 
        if (state->errormsg) {
-               DEBUG(0,("ctdb_control error: '%s'\n", state->errormsg));
+               DEBUG(DEBUG_ERR,("ctdb_control error: '%s'\n", state->errormsg));
                if (errormsg) {
                        (*errormsg) = talloc_move(mem_ctx, &state->errormsg);
                }
@@ -969,7 +969,7 @@ int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t
                           CTDB_CONTROL_PROCESS_EXISTS, 0, data, 
                           NULL, NULL, &status, NULL, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_control for process_exists failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for process_exists failed\n"));
                return -1;
        }
 
@@ -989,12 +989,12 @@ int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ct
                           CTDB_CONTROL_STATISTICS, 0, tdb_null, 
                           ctdb, &data, &res, NULL, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for statistics failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for statistics failed\n"));
                return -1;
        }
 
        if (data.dsize != sizeof(struct ctdb_statistics)) {
-               DEBUG(0,(__location__ " Wrong statistics size %u - expected %u\n",
+               DEBUG(DEBUG_ERR,(__location__ " Wrong statistics size %u - expected %u\n",
                         (unsigned)data.dsize, (unsigned)sizeof(struct ctdb_statistics)));
                      return -1;
        }
@@ -1016,7 +1016,7 @@ int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32
                           CTDB_CONTROL_SHUTDOWN, 0, tdb_null, 
                           NULL, &timeout, NULL);
        if (state == NULL) {
-               DEBUG(0,(__location__ " ctdb_control for shutdown failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for shutdown failed\n"));
                return -1;
        }
 
@@ -1037,14 +1037,14 @@ int ctdb_ctrl_getvnnmap(struct ctdb_context *ctdb, struct timeval timeout, uint3
                           CTDB_CONTROL_GETVNNMAP, 0, tdb_null, 
                           mem_ctx, &outdata, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for getvnnmap failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getvnnmap failed\n"));
                return -1;
        }
        
        map = (struct ctdb_vnn_map_wire *)outdata.dptr;
        if (outdata.dsize < offsetof(struct ctdb_vnn_map_wire, map) ||
            outdata.dsize != map->size*sizeof(uint32_t) + offsetof(struct ctdb_vnn_map_wire, map)) {
-               DEBUG(0,("Bad vnn map size received in ctdb_ctrl_getvnnmap\n"));
+               DEBUG(DEBUG_ERR,("Bad vnn map size received in ctdb_ctrl_getvnnmap\n"));
                return -1;
        }
 
@@ -1080,7 +1080,7 @@ int ctdb_ctrl_getrecmode_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, st
 
        ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_ctrl_getrecmode_recv failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_getrecmode_recv failed\n"));
                return -1;
        }
 
@@ -1118,7 +1118,7 @@ int ctdb_ctrl_setrecmode(struct ctdb_context *ctdb, struct timeval timeout, uint
                           CTDB_CONTROL_SET_RECMODE, 0, data, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for setrecmode failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setrecmode failed\n"));
                return -1;
        }
 
@@ -1146,7 +1146,7 @@ int ctdb_ctrl_getrecmaster_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
 
        ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_ctrl_getrecmaster_recv failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_getrecmaster_recv failed\n"));
                return -1;
        }
 
@@ -1183,7 +1183,7 @@ int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout, ui
                           CTDB_CONTROL_SET_RECMASTER, 0, data, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for setrecmaster failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setrecmaster failed\n"));
                return -1;
        }
 
@@ -1205,7 +1205,7 @@ int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout, uint32
                           CTDB_CONTROL_GET_DBMAP, 0, tdb_null, 
                           mem_ctx, &outdata, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for getdbmap failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed\n"));
                return -1;
        }
 
@@ -1231,7 +1231,7 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
                           CTDB_CONTROL_GET_NODEMAP, 0, tdb_null, 
                           mem_ctx, &outdata, &res, &timeout, NULL);
        if (ret != 0 || res != 0 || outdata.dsize == 0) {
-               DEBUG(0,(__location__ " ctdb_control for getnodes failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed\n"));
                return -1;
        }
 
@@ -1268,7 +1268,7 @@ int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb, struct timeval timeout, uint3
                           CTDB_CONTROL_SETVNNMAP, 0, data, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for setvnnmap failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setvnnmap failed\n"));
                return -1;
        }
 
@@ -1319,7 +1319,7 @@ int ctdb_ctrl_pulldb_recv(
 
        ret = ctdb_control_recv(ctdb, state, mem_ctx, outdata, &res, NULL);
        if ( (ret != 0) || (res != 0) ){
-               DEBUG(0,(__location__ " ctdb_ctrl_pulldb_recv failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_pulldb_recv failed\n"));
                return -1;
        }
 
@@ -1363,7 +1363,7 @@ int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb, struct timeval timeout, uint
                           CTDB_CONTROL_SET_DMASTER, 0, indata, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for setdmaster failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setdmaster failed\n"));
                return -1;
        }
 
@@ -1486,7 +1486,7 @@ int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, uint3
                return -1;
        }
        if (data.dsize != sizeof(uint32_t)) {
-               DEBUG(0,("Bad control reply size in ctdb_get_debuglevel (got %u)\n",
+               DEBUG(DEBUG_ERR,("Bad control reply size in ctdb_get_debuglevel (got %u)\n",
                         (unsigned)data.dsize));
                return -1;
        }
@@ -1563,7 +1563,7 @@ int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode)
                           CTDB_CONTROL_STATISTICS_RESET, 0, tdb_null, 
                           NULL, NULL, &res, NULL, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for reset statistics failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for reset statistics failed\n"));
                return -1;
        }
        return 0;
@@ -1616,7 +1616,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
                           persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH,
                           0, data, ctdb_db, &data, &res, NULL, NULL);
        if (ret != 0 || res != 0 || data.dsize != sizeof(uint32_t)) {
-               DEBUG(0,("Failed to attach to database '%s'\n", name));
+               DEBUG(DEBUG_ERR,("Failed to attach to database '%s'\n", name));
                talloc_free(ctdb_db);
                return NULL;
        }
@@ -1626,7 +1626,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
 
        ret = ctdb_ctrl_getdbpath(ctdb, timeval_current_ofs(2, 0), CTDB_CURRENT_NODE, ctdb_db->db_id, ctdb_db, &ctdb_db->db_path);
        if (ret != 0) {
-               DEBUG(0,("Failed to get dbpath for database '%s'\n", name));
+               DEBUG(DEBUG_ERR,("Failed to get dbpath for database '%s'\n", name));
                talloc_free(ctdb_db);
                return NULL;
        }
@@ -1674,7 +1674,7 @@ int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id)
        ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_SET_CALL, 0,
                           data, NULL, NULL, &status, NULL, NULL);
        if (ret != 0 || status != 0) {
-               DEBUG(0,("ctdb_set_call failed for call %u\n", id));
+               DEBUG(DEBUG_ERR,("ctdb_set_call failed for call %u\n", id));
                return -1;
        }
 #endif
@@ -1707,7 +1707,7 @@ static void traverse_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA
 
        if (data.dsize < sizeof(uint32_t) ||
            d->length != data.dsize) {
-               DEBUG(0,("Bad data size %u in traverse_handler\n", (unsigned)data.dsize));
+               DEBUG(DEBUG_ERR,("Bad data size %u in traverse_handler\n", (unsigned)data.dsize));
                state->done = True;
                return;
        }
@@ -1751,7 +1751,7 @@ int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *
 
        ret = ctdb_set_message_handler(ctdb_db->ctdb, srvid, traverse_handler, &state);
        if (ret != 0) {
-               DEBUG(0,("Failed to setup traverse handler\n"));
+               DEBUG(DEBUG_ERR,("Failed to setup traverse handler\n"));
                return -1;
        }
 
@@ -1765,7 +1765,7 @@ int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *
        ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_TRAVERSE_START, 0,
                           data, NULL, NULL, &status, NULL, NULL);
        if (ret != 0 || status != 0) {
-               DEBUG(0,("ctdb_traverse_all failed\n"));
+               DEBUG(DEBUG_ERR,("ctdb_traverse_all failed\n"));
                ctdb_remove_message_handler(ctdb_db->ctdb, srvid, &state);
                return -1;
        }
@@ -1776,7 +1776,7 @@ int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *
 
        ret = ctdb_remove_message_handler(ctdb_db->ctdb, srvid, &state);
        if (ret != 0) {
-               DEBUG(0,("Failed to remove ctdb_traverse handler\n"));
+               DEBUG(DEBUG_ERR,("Failed to remove ctdb_traverse handler\n"));
                return -1;
        }
 
@@ -1824,7 +1824,7 @@ int ctdb_ctrl_getpid(struct ctdb_context *ctdb, struct timeval timeout, uint32_t
                           CTDB_CONTROL_GET_PID, 0, tdb_null, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_control for getpid failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpid failed\n"));
                return -1;
        }
 
@@ -1855,7 +1855,7 @@ int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct
 
        ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
        if ( (ret != 0) || (res != 0) ){
-               DEBUG(0,(__location__ " ctdb_ctrl_freeze_recv failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_freeze_recv failed\n"));
                return -1;
        }
 
@@ -1890,7 +1890,7 @@ int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout, uint32_t d
                           CTDB_CONTROL_THAW, 0, tdb_null, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control thaw failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control thaw failed\n"));
                return -1;
        }
 
@@ -1909,7 +1909,7 @@ int ctdb_ctrl_getpnn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t
                           CTDB_CONTROL_GET_PNN, 0, tdb_null, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_control for getpnn failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpnn failed\n"));
                return -1;
        }
 
@@ -1928,7 +1928,7 @@ int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint
                           CTDB_CONTROL_GET_MONMODE, 0, tdb_null, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_control for getrecmode failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getrecmode failed\n"));
                return -1;
        }
 
@@ -1954,7 +1954,7 @@ int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
                           NULL, &res, &timeout, NULL);
 
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for takeover_ip failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for takeover_ip failed\n"));
                return -1;
        }
 
@@ -1979,7 +1979,7 @@ int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
                           NULL, &res, &timeout, NULL);
 
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for release_ip failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for release_ip failed\n"));
                return -1;
        }
 
@@ -2012,12 +2012,12 @@ int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb,
                           &outdata, &res, &timeout, NULL);
        talloc_free(data.dptr);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for get_tunable failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get_tunable failed\n"));
                return -1;
        }
 
        if (outdata.dsize != sizeof(uint32_t)) {
-               DEBUG(0,("Invalid return data in get_tunable\n"));
+               DEBUG(DEBUG_ERR,("Invalid return data in get_tunable\n"));
                talloc_free(outdata.dptr);
                return -1;
        }
@@ -2054,7 +2054,7 @@ int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb,
                           NULL, &res, &timeout, NULL);
        talloc_free(data.dptr);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for set_tunable failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for set_tunable failed\n"));
                return -1;
        }
 
@@ -2079,14 +2079,14 @@ int ctdb_ctrl_list_tunables(struct ctdb_context *ctdb,
        ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_LIST_TUNABLES, 0, tdb_null, 
                           mem_ctx, &outdata, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for list_tunables failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for list_tunables failed\n"));
                return -1;
        }
 
        t = (struct ctdb_control_list_tunable *)outdata.dptr;
        if (outdata.dsize < offsetof(struct ctdb_control_list_tunable, data) ||
            t->length > outdata.dsize-offsetof(struct ctdb_control_list_tunable, data)) {
-               DEBUG(0,("Invalid data in list_tunables reply\n"));
+               DEBUG(DEBUG_ERR,("Invalid data in list_tunables reply\n"));
                talloc_free(outdata.dptr);
                return -1;              
        }
@@ -2125,7 +2125,7 @@ int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
                           CTDB_CONTROL_GET_PUBLIC_IPS, 0, tdb_null, 
                           mem_ctx, &outdata, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for getpublicips failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed\n"));
                return -1;
        }
 
@@ -2156,7 +2156,7 @@ int ctdb_ctrl_modflags(struct ctdb_context *ctdb, struct timeval timeout, uint32
                           CTDB_CONTROL_MODIFY_FLAGS, 0, data, 
                           NULL, NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for modflags failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for modflags failed\n"));
                return -1;
        }
 
@@ -2179,12 +2179,12 @@ int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
        ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_ALL_TUNABLES, 0, tdb_null, ctdb,
                           &outdata, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for get all tunables failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get all tunables failed\n"));
                return -1;
        }
 
        if (outdata.dsize != sizeof(*tunables)) {
-               DEBUG(0,(__location__ " bad data size %u in ctdb_ctrl_get_all_tunables should be %u\n",
+               DEBUG(DEBUG_ERR,(__location__ " bad data size %u in ctdb_ctrl_get_all_tunables should be %u\n",
                         (unsigned)outdata.dsize, (unsigned)sizeof(*tunables)));
                return -1;              
        }
@@ -2213,7 +2213,7 @@ int ctdb_ctrl_killtcp(struct ctdb_context *ctdb,
        ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_KILL_TCP, 0, data, NULL,
                           NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for killtcp failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for killtcp failed\n"));
                return -1;
        }
 
@@ -2252,7 +2252,7 @@ int ctdb_ctrl_gratious_arp(struct ctdb_context *ctdb,
        ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_SEND_GRATIOUS_ARP, 0, data, NULL,
                           NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for gratious_arp failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for gratious_arp failed\n"));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -2281,7 +2281,7 @@ int ctdb_ctrl_get_tcp_tickles(struct ctdb_context *ctdb,
                           CTDB_CONTROL_GET_TCP_TICKLE_LIST, 0, data, 
                           mem_ctx, &outdata, &status, NULL, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_control for get tcp tickles failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get tcp tickles failed\n"));
                return -1;
        }
 
@@ -2309,7 +2309,7 @@ int ctdb_ctrl_register_server_id(struct ctdb_context *ctdb,
                        0, data, NULL,
                        NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for register server id failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for register server id failed\n"));
                return -1;
        }
 
@@ -2335,7 +2335,7 @@ int ctdb_ctrl_unregister_server_id(struct ctdb_context *ctdb,
                        0, data, NULL,
                        NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for unregister server id failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for unregister server id failed\n"));
                return -1;
        }
 
@@ -2365,7 +2365,7 @@ int ctdb_ctrl_check_server_id(struct ctdb_context *ctdb,
                        0, data, NULL,
                        NULL, &res, &timeout, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_control for check server id failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for check server id failed\n"));
                return -1;
        }
 
@@ -2394,7 +2394,7 @@ int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
                           CTDB_CONTROL_GET_SERVER_ID_LIST, 0, tdb_null, 
                           mem_ctx, &outdata, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for get_server_id_list failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get_server_id_list failed\n"));
                return -1;
        }
 
@@ -2469,7 +2469,7 @@ int ctdb_ctrl_uptime_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct
 
        ret = ctdb_control_recv(ctdb, state, mem_ctx, &outdata, &res, NULL);
        if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_ctrl_uptime_recv failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_uptime_recv failed\n"));
                return -1;
        }
 
@@ -2498,7 +2498,7 @@ int ctdb_ctrl_end_recovery(struct ctdb_context *ctdb, struct timeval timeout, ui
                           CTDB_CONTROL_END_RECOVERY, 0, tdb_null, 
                           NULL, NULL, &status, &timeout, NULL);
        if (ret != 0 || status != 0) {
-               DEBUG(0,(__location__ " ctdb_control for end_recovery failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for end_recovery failed\n"));
                return -1;
        }
 
@@ -2523,7 +2523,7 @@ static void async_callback(struct ctdb_client_control_state *state)
        */
        if (state->state != CTDB_CONTROL_DONE) {
                if ( !data->dont_log_errors) {
-                       DEBUG(0,("Async operation failed with state %d\n", state->state));
+                       DEBUG(DEBUG_ERR,("Async operation failed with state %d\n", state->state));
                }
                data->fail_count++;
                return;
@@ -2534,7 +2534,7 @@ static void async_callback(struct ctdb_client_control_state *state)
        ret = ctdb_control_recv(state->ctdb, state, data, NULL, &res, NULL);
        if ((ret != 0) || (res != 0)) {
                if ( !data->dont_log_errors) {
-                       DEBUG(0,("Async operation failed with ret=%d res=%d\n", ret, (int)res));
+                       DEBUG(DEBUG_ERR,("Async operation failed with ret=%d res=%d\n", ret, (int)res));
                }
                data->fail_count++;
        }
@@ -2562,7 +2562,7 @@ int ctdb_client_async_wait(struct ctdb_context *ctdb, struct client_async_data *
        }
        if (data->fail_count != 0) {
                if (!data->dont_log_errors) {
-                       DEBUG(0,("Async wait failed - fail_count=%u\n", 
+                       DEBUG(DEBUG_ERR,("Async wait failed - fail_count=%u\n", 
                                 data->fail_count));
                }
                return -1;
@@ -2599,7 +2599,7 @@ int ctdb_client_async_control(struct ctdb_context *ctdb,
                state = ctdb_control_send(ctdb, pnn, 0, opcode, 
                                          0, data, async_data, &timeout, NULL);
                if (state == NULL) {
-                       DEBUG(0,(__location__ " Failed to call async control %u\n", (unsigned)opcode));
+                       DEBUG(DEBUG_ERR,(__location__ " Failed to call async control %u\n", (unsigned)opcode));
                        talloc_free(async_data);
                        return -1;
                }
index a8010711fb2bf7ac271ff781005df5d85c47d767..b6e3541a265ea9f4f44aa995e45d8b7ddbf36519 100644 (file)
@@ -127,7 +127,7 @@ struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
        /* get our pnn */
        ctdb->pnn = ctdb_ctrl_getpnn(ctdb, timeval_current_ofs(3, 0), CTDB_CURRENT_NODE);
        if (ctdb->pnn == (uint32_t)-1) {
-               DEBUG(0,(__location__ " Failed to get ctdb pnn\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " Failed to get ctdb pnn\n"));
                talloc_free(ctdb);
                return NULL;
        }
index 3cc522b58a485ea3791a3d59597a7852cc049816..a46c6dfbf38b8627de80ba92bf576c4d1bb218bf 100644 (file)
@@ -77,14 +77,14 @@ static void queue_io_read(struct ctdb_queue *queue)
                                                  num_ready + queue->partial.length);
 
        if (queue->partial.data == NULL) {
-               DEBUG(0,("read error alloc failed for %u\n", 
+               DEBUG(DEBUG_ERR,("read error alloc failed for %u\n", 
                         num_ready + queue->partial.length));
                goto failed;
        }
 
        nread = read(queue->fd, queue->partial.data + queue->partial.length, num_ready);
        if (nread <= 0) {
-               DEBUG(0,("read error nread=%d\n", (int)nread));
+               DEBUG(DEBUG_ERR,("read error nread=%d\n", (int)nread));
                goto failed;
        }
 
@@ -111,12 +111,12 @@ static void queue_io_read(struct ctdb_queue *queue)
                len = *(uint32_t *)data;
                if (len == 0) {
                        /* bad packet! treat as EOF */
-                       DEBUG(0,("Invalid packet of length 0\n"));
+                       DEBUG(DEBUG_CRIT,("Invalid packet of length 0\n"));
                        goto failed;
                }
                d2 = talloc_memdup(queue, data, len);
                if (d2 == NULL) {
-                       DEBUG(0,("read error memdup failed for %u\n", len));
+                       DEBUG(DEBUG_ERR,("read error memdup failed for %u\n", len));
                        /* sigh */
                        goto failed;
                }
@@ -133,7 +133,7 @@ static void queue_io_read(struct ctdb_queue *queue)
                } else {
                        queue->partial.data = talloc_memdup(queue, data, nread);
                        if (queue->partial.data == NULL) {
-                               DEBUG(0,("read error memdup partial failed for %u\n", 
+                               DEBUG(DEBUG_ERR,("read error memdup partial failed for %u\n", 
                                         (unsigned)nread));
                                goto failed;
                        }
index 7db1523ca1e02f8e138441c119b34bf0576d6d5c..e8a334afecafad5a591fe91b5d5962041ad94235 100644 (file)
@@ -137,7 +137,7 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
                rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
                h2 = (struct ctdb_ltdb_header *)rec.dptr;
                if (rec.dptr && rec.dsize >= sizeof(h2) && h2->rsn > header->rsn) {
-                       DEBUG(0,("RSN regression! %llu %llu\n",
+                       DEBUG(DEBUG_CRIT,("RSN regression! %llu %llu\n",
                                 (unsigned long long)h2->rsn, (unsigned long long)header->rsn));
                }
                if (rec.dptr) free(rec.dptr);
@@ -172,7 +172,7 @@ int ctdb_ltdb_unlock(struct ctdb_db_context *ctdb_db, TDB_DATA key)
 {
        int ret = tdb_chainunlock(ctdb_db->ltdb->tdb, key);
        if (ret != 0) {
-               DEBUG(0,("tdb_chainunlock failed\n"));
+               DEBUG(DEBUG_ERR,("tdb_chainunlock failed\n"));
        }
        return ret;
 }
index 6724bfc2ec1a25cf3170baba2e8a36caa9319fc0..8ae4df7c4d8edfcac57c73c5398a8d23aa6dc72f 100644 (file)
@@ -46,7 +46,7 @@ void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...)
        talloc_free(ctdb->err_msg);
        va_start(ap, fmt);
        ctdb->err_msg = talloc_vasprintf(ctdb, fmt, ap);
-       DEBUG(0,("ctdb error: %s\n", ctdb->err_msg));
+       DEBUG(DEBUG_ERR,("ctdb error: %s\n", ctdb->err_msg));
        va_end(ap);
 }
 
@@ -113,7 +113,7 @@ static void *_idr_find_type(struct idr_context *idp, int id, const char *type, c
 {
        void *p = idr_find(idp, id);
        if (p && talloc_check_name(p, type) == NULL) {
-               DEBUG(0,("%s idr_find_type expected type %s  but got %s\n",
+               DEBUG(DEBUG_ERR,("%s idr_find_type expected type %s  but got %s\n",
                         location, type, talloc_get_name(p)));
                return NULL;
        }
@@ -147,7 +147,7 @@ void *_ctdb_reqid_find(struct ctdb_context *ctdb, uint32_t reqid, const char *ty
 
        p = _idr_find_type(ctdb->idr, (reqid>>16)&0xFFFF, type, location);
        if (p == NULL) {
-               DEBUG(0, ("Could not find idr:%u\n",reqid));
+               DEBUG(DEBUG_ERR, ("Could not find idr:%u\n",reqid));
        }
 
        return p;
@@ -160,7 +160,7 @@ void ctdb_reqid_remove(struct ctdb_context *ctdb, uint32_t reqid)
 
        ret = idr_remove(ctdb->idr, (reqid>>16)&0xFFFF);
        if (ret != 0) {
-               DEBUG(0, ("Removing idr that does not exist\n"));
+               DEBUG(DEBUG_ERR, ("Removing idr that does not exist\n"));
        }
 }
 
@@ -216,7 +216,7 @@ void ctdb_set_scheduler(struct ctdb_context *ctdb)
        }
        
        if (sched_getparam(0, (struct sched_param *)ctdb->saved_scheduler_param) == -1) {
-               DEBUG(0,("Unable to get old scheduler params\n"));
+               DEBUG(DEBUG_ERR,("Unable to get old scheduler params\n"));
                return;
        }
 
@@ -224,7 +224,7 @@ void ctdb_set_scheduler(struct ctdb_context *ctdb)
        p.sched_priority = 1;
 
        if (sched_setscheduler(0, SCHED_FIFO, &p) == -1) {
-               DEBUG(0,("Unable to set scheduler to SCHED_FIFO (%s)\n", 
+               DEBUG(DEBUG_CRIT,("Unable to set scheduler to SCHED_FIFO (%s)\n", 
                         strerror(errno)));
        } else {
                DEBUG(DEBUG_NOTICE,("Set scheduler to SCHED_FIFO\n"));
index d541e38ce63ec402370d2ec1382bbab722931656..b2c2ee83d5036dd99d035882e76b1da553f6346b 100644 (file)
@@ -21,7 +21,7 @@
 #include "rb_tree.h"
 
 #define NO_MEMORY_FATAL(p) do { if (!(p)) { \
-          DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
+          DEBUG(DEBUG_CRIT,("Out of memory for %s at %s\n", #p, __location__)); \
          exit(10); \
          }} while (0)
 
index f296e17d8192f79a946303bf7b87044072238054..50f1418061833db878860ba552f500e96a39635c 100644 (file)
@@ -41,14 +41,14 @@ int ctdb_sys_open_sending_socket(void)
 
        s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
        if (s == -1) {
-               DEBUG(0,(" failed to open raw socket (%s)\n",
+               DEBUG(DEBUG_CRIT,(" failed to open raw socket (%s)\n",
                         strerror(errno)));
                return -1;
        }
 
        ret = setsockopt(s, IPPROTO_IP, IP_HDRINCL, &one, sizeof(one));
        if (ret != 0) {
-               DEBUG(0,(" failed to setup IP headers (%s)\n",
+               DEBUG(DEBUG_CRIT, (" failed to setup IP headers (%s)\n",
                         strerror(errno)));
                close(s);
                return -1;
@@ -123,7 +123,7 @@ int ctdb_sys_send_tcp(int s,
 
        /* for now, we only handle AF_INET addresses */
        if (src->sin_family != AF_INET || dest->sin_family != AF_INET) {
-               DEBUG(0,(__location__ " not an ipv4 address\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address\n"));
                return -1;
        }
 
@@ -151,7 +151,7 @@ int ctdb_sys_send_tcp(int s,
 
        ret = sendto(s, &pkt, sizeof(pkt), 0, (struct sockaddr *)dest, sizeof(*dest));
        if (ret != sizeof(pkt)) {
-               DEBUG(0,(__location__ " failed sendto (%s)\n", strerror(errno)));
+               DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
                return -1;
        }
 
@@ -191,7 +191,7 @@ int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
 
        pt=pcap_open_live(iface, 100, 0, 0, NULL);
        if (pt == NULL) {
-               DEBUG(0,("Failed to open capture device %s\n", iface));
+               DEBUG(DEBUG_CRIT,("Failed to open capture device %s\n", iface));
                return -1;
        }
        *((pcap_t **)private_data) = pt;
index 7017875fed40beb6491ed0e729f04ac5e66addb4..207387fe899558090104d57122def2e76c75699b 100644 (file)
@@ -49,13 +49,13 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
 
        /* for now, we only handle AF_INET addresses */
        if (saddr->sin_family != AF_INET) {
-               DEBUG(0,(__location__ " not an ipv4 address (family is %u)\n", saddr->sin_family));
+               DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address (family is %u)\n", saddr->sin_family));
                return -1;
        }
 
        s = socket(AF_INET, SOCK_PACKET, htons(ETHERTYPE_ARP));
        if (s == -1){
-               DEBUG(0,(__location__ " failed to open raw socket\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
                return -1;
        }
 
@@ -64,7 +64,7 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
        ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
        if ( ret < 0 ) {
                close(s);
-               DEBUG(0,(__location__ " ioctl failed\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " ioctl failed\n"));
                return -1;
        }
        if (ARPHRD_LOOPBACK == if_hwaddr.ifr_hwaddr.sa_family) {
@@ -75,7 +75,7 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
        if (if_hwaddr.ifr_hwaddr.sa_family != AF_LOCAL) {
                close(s);
                errno = EINVAL;
-               DEBUG(0,(__location__ " not an ethernet address family (0x%x)\n",
+               DEBUG(DEBUG_CRIT,(__location__ " not an ethernet address family (0x%x)\n",
                         if_hwaddr.ifr_hwaddr.sa_family));
                return -1;
        }
@@ -109,7 +109,7 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
        ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
        if (ret < 0 ){
                close(s);
-               DEBUG(0,(__location__ " failed sendto\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
                return -1;
        }
 
@@ -128,7 +128,7 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
        strncpy(sa.sa_data, iface, sizeof(sa.sa_data));
        ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
        if (ret < 0 ){
-               DEBUG(0,(__location__ " failed sendto\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
                return -1;
        }
 
@@ -200,7 +200,7 @@ int ctdb_sys_send_tcp(int s,
 
        /* for now, we only handle AF_INET addresses */
        if (src->sin_family != AF_INET || dest->sin_family != AF_INET) {
-               DEBUG(0,(__location__ " not an ipv4 address\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address\n"));
                return -1;
        }
 
@@ -228,7 +228,7 @@ int ctdb_sys_send_tcp(int s,
 
        ret = sendto(s, &pkt, sizeof(pkt), 0, dest, sizeof(*dest));
        if (ret != sizeof(pkt)) {
-               DEBUG(0,(__location__ " failed sendto (%s)\n", strerror(errno)));
+               DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
                return -1;
        }
 
@@ -270,7 +270,7 @@ int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
        /* Open a socket to capture all traffic */
        s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
        if (s == -1) {
-               DEBUG(0,(__location__ " failed to open raw socket\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
                return -1;
        }
 
@@ -300,14 +300,14 @@ int ctdb_sys_open_sending_socket(void)
 
        s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
        if (s == -1) {
-               DEBUG(0,(__location__ " failed to open raw socket (%s)\n",
+               DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
                         strerror(errno)));
                return -1;
        }
 
        ret = setsockopt(s, SOL_IP, IP_HDRINCL, &one, sizeof(one));
        if (ret != 0) {
-               DEBUG(0,(__location__ " failed to setup IP headers (%s)\n",
+               DEBUG(DEBUG_CRIT,(__location__ " failed to setup IP headers (%s)\n",
                         strerror(errno)));
                close(s);
                return -1;
index d931c2dd0f2e2905a277a56b202fe6afc8a1aba6..fd577ffdce407315aeac8f33770c41dedd96e9cd 100644 (file)
@@ -56,13 +56,13 @@ int ctdb_ibw_node_connect(struct ctdb_node *node)
        sock_out.sin_port = htons(node->address.port);
        sock_out.sin_family = PF_INET;
        if (ctdb_ibw_get_address(node->ctdb, node->address.address, &sock_out.sin_addr)) {
-               DEBUG(0, ("ctdb_ibw_node_connect failed\n"));
+               DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect failed\n"));
                return -1;
        }
 
        rc = ibw_connect(cn->conn, &sock_out, node);
        if (rc) {
-               DEBUG(0, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
+               DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
                /* try again once a second */
                event_add_timed(node->ctdb->ev, node, timeval_current_ofs(1, 0), 
                        ctdb_ibw_node_connect_event, node);
@@ -92,7 +92,7 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
                case IBWS_CONNECT_REQUEST: /* after [IBWS_READY + incoming request] */
                                /* => [(ibw_accept)IBWS_READY | (ibw_disconnect)STOPPED | ERROR] */
                        if (ibw_accept(ctx, conn, NULL)) {
-                               DEBUG(0, ("connstate_handler/ibw_accept failed\n"));
+                               DEBUG(DEBUG_ERR, ("connstate_handler/ibw_accept failed\n"));
                                return -1;
                        } /* else continue in IBWC_CONNECTED */
                        break;
index d1693550c14d28b4d1cd9f6a82180f353ca90891..2f4fbfe3f263812775907f6e188262d275350ca7 100644 (file)
@@ -41,12 +41,12 @@ static int ctdb_ibw_listen(struct ctdb_context *ctdb, int backlog)
                return -1;
 
        if (ibw_bind(ictx, &my_addr)) {
-               DEBUG(0, ("ctdb_ibw_listen: ibw_bind failed\n"));
+               DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_bind failed\n"));
                return -1;
        }
 
        if (ibw_listen(ictx, backlog)) {
-               DEBUG(0, ("ctdb_ibw_listen: ibw_listen failed\n"));
+               DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_listen failed\n"));
                return -1;
        }
 
@@ -82,7 +82,7 @@ static int ctdb_ibw_initialise(struct ctdb_context *ctdb)
 
        for (i=0; i<ctdb->num_nodes; i++) {
                if (ctdb_ibw_add_node(ctdb->nodes[i]) != 0) {
-                       DEBUG(0, ("methods->add_node failed at %d\n", i));
+                       DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i));
                        return -1;
                }
        }
@@ -118,7 +118,7 @@ static int ctdb_ibw_send_pkt(struct ibw_conn *conn, uint8_t *data, uint32_t leng
        void    *buf, *key;
 
        if (ibw_alloc_send_buf(conn, &buf, &key, length)) {
-               DEBUG(0, ("queue_pkt/ibw_alloc_send_buf failed\n"));
+               DEBUG(DEBUG_ERR, ("queue_pkt/ibw_alloc_send_buf failed\n"));
                return -1;
        }
 
@@ -156,7 +156,7 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le
        assert(cn!=NULL);
 
        if (cn->conn==NULL) {
-               DEBUG(0, ("ctdb_ibw_queue_pkt: conn is NULL\n"));
+               DEBUG(DEBUG_ERR, ("ctdb_ibw_queue_pkt: conn is NULL\n"));
                return -1;
        }
 
@@ -180,7 +180,7 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le
 static void ctdb_ibw_restart(struct ctdb_node *node)
 {
        /* TODO: implement this method for IB */
-       DEBUG(0,("WARNING: method restart is not yet implemented for IB\n"));
+       DEBUG(DEBUG_ALERT,("WARNING: method restart is not yet implemented for IB\n"));
 }
 
 /*
@@ -232,7 +232,7 @@ int ctdb_ibw_init(struct ctdb_context *ctdb)
                ctdb->ev);
 
        if (ictx==NULL) {
-               DEBUG(0, ("ctdb_ibw_init: ibw_init failed\n"));
+               DEBUG(DEBUG_CRIT, ("ctdb_ibw_init: ibw_init failed\n"));
                return -1;
        }
 
index 981ac5af83ea4d455b3525b6938ab12e72d3ada6..5a166e5353f88588532f7f1c0f611f41dfaf7076 100644 (file)
@@ -346,7 +346,7 @@ static int ibw_refill_cq_recv(struct ibw_conn *conn)
        rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
        if (rc) {
                sprintf(ibw_lasterr, "refill/ibv_post_recv failed with %d\n", rc);
-               DEBUG(0, (ibw_lasterr));
+               DEBUG(DEBUG_ERR, (ibw_lasterr));
                return -2;
        }
 
@@ -380,7 +380,7 @@ static int ibw_fill_cq(struct ibw_conn *conn)
                rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
                if (rc) {
                        sprintf(ibw_lasterr, "fill/ibv_post_recv failed with %d\n", rc);
-                       DEBUG(0, (ibw_lasterr));
+                       DEBUG(DEBUG_ERR, (ibw_lasterr));
                        return -2;
                }
        }
@@ -480,7 +480,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
                if (!pconn->is_accepted) {
                        rc = rdma_reject(cma_id, NULL, 0);
                        if (rc)
-                               DEBUG(0, ("rdma_reject failed with rc=%d\n", rc));
+                               DEBUG(DEBUG_ERR, ("rdma_reject failed with rc=%d\n", rc));
                        talloc_free(conn);
                        DEBUG(DEBUG_DEBUG, ("pconn->cm_id %p wasn't accepted\n", pconn->cm_id));
                }
@@ -523,7 +523,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
                if (conn) {
                        /* must be done BEFORE connstate */
                        if ((rc=rdma_ack_cm_event(event)))
-                               DEBUG(0, ("reject/rdma_ack_cm_event failed with %d\n", rc));
+                               DEBUG(DEBUG_ERR, ("reject/rdma_ack_cm_event failed with %d\n", rc));
                        event = NULL; /* not to touch cma_id or conn */
                        conn->state = IBWC_ERROR;
                        /* it should free the conn */
@@ -534,11 +534,11 @@ static void ibw_event_handler_cm(struct event_context *ev,
        case RDMA_CM_EVENT_DISCONNECTED:
                DEBUG(DEBUG_DEBUG, ("RDMA_CM_EVENT_DISCONNECTED\n"));
                if ((rc=rdma_ack_cm_event(event)))
-                       DEBUG(0, ("disc/rdma_ack_cm_event failed with %d\n", rc));
+                       DEBUG(DEBUG_ERR, ("disc/rdma_ack_cm_event failed with %d\n", rc));
                event = NULL; /* don't ack more */
 
                if (cma_id!=pctx->cm_id) {
-                       DEBUG(0, ("client DISCONNECT event cm_id=%p\n", cma_id));
+                       DEBUG(DEBUG_ERR, ("client DISCONNECT event cm_id=%p\n", cma_id));
                        conn = talloc_get_type(cma_id->context, struct ibw_conn);
                        conn->state = IBWC_DISCONNECTED;
                        pctx->connstate_func(NULL, conn);
@@ -561,7 +561,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
 
        return;
 error:
-       DEBUG(0, ("cm event handler: %s", ibw_lasterr));
+       DEBUG(DEBUG_ERR, ("cm event handler: %s", ibw_lasterr));
 
        if (event!=NULL) {
                if (cma_id!=NULL && cma_id!=pctx->cm_id) {
@@ -576,7 +576,7 @@ error:
                }
 
                if ((rc=rdma_ack_cm_event(event))!=0) {
-                       DEBUG(0, ("rdma_ack_cm_event failed with %d\n", rc));
+                       DEBUG(DEBUG_ERR, ("rdma_ack_cm_event failed with %d\n", rc));
                }
        }
 
@@ -657,7 +657,7 @@ static void ibw_event_handler_verbs(struct event_context *ev,
 error:
        ibv_ack_cq_events(pconn->cq, 1);
 
-       DEBUG(0, (ibw_lasterr));
+       DEBUG(DEBUG_ERR, (ibw_lasterr));
        
        if (conn->state!=IBWC_ERROR) {
                conn->state = IBWC_ERROR;
@@ -895,7 +895,7 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc)
        return 0;
 
 error:
-       DEBUG(0, ("ibw_wc_recv error: %s", ibw_lasterr));
+       DEBUG(DEBUG_ERR, ("ibw_wc_recv error: %s", ibw_lasterr));
        return -1;
 }
 
@@ -993,7 +993,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr,
        return ctx;
        /* don't put code here */
 cleanup:
-       DEBUG(0, (ibw_lasterr));
+       DEBUG(DEBUG_ERR, (ibw_lasterr));
 
        if (ctx)
                talloc_free(ctx);
@@ -1031,7 +1031,7 @@ int ibw_bind(struct ibw_ctx *ctx, struct sockaddr_in *my_addr)
        rc = rdma_bind_addr(pctx->cm_id, (struct sockaddr *) my_addr);
        if (rc) {
                sprintf(ibw_lasterr, "rdma_bind_addr error %d\n", rc);
-               DEBUG(0, (ibw_lasterr));
+               DEBUG(DEBUG_ERR, (ibw_lasterr));
                return rc;
        }
        DEBUG(DEBUG_DEBUG, ("rdma_bind_addr successful\n"));
@@ -1048,7 +1048,7 @@ int ibw_listen(struct ibw_ctx *ctx, int backlog)
        rc = rdma_listen(pctx->cm_id, backlog);
        if (rc) {
                sprintf(ibw_lasterr, "rdma_listen failed: %d\n", rc);
-               DEBUG(0, (ibw_lasterr));
+               DEBUG(DEBUG_ERR, (ibw_lasterr));
                return rc;
        }
 
@@ -1070,7 +1070,7 @@ int ibw_accept(struct ibw_ctx *ctx, struct ibw_conn *conn, void *conn_userdata)
        rc = rdma_accept(pconn->cm_id, &conn_param);
        if (rc) {
                sprintf(ibw_lasterr, "rdma_accept failed %d\n", rc);
-               DEBUG(0, (ibw_lasterr));
+               DEBUG(DEBUG_ERR, (ibw_lasterr));
                return -1;;
        }
 
@@ -1096,7 +1096,7 @@ int ibw_connect(struct ibw_conn *conn, struct sockaddr_in *serv_addr, void *conn
 
        /* clean previous - probably half - initialization */
        if (ibw_conn_priv_destruct(pconn)) {
-               DEBUG(0, ("ibw_connect/ibw_pconn_destruct failed for cm_id=%p\n", pconn->cm_id));
+               DEBUG(DEBUG_ERR, ("ibw_connect/ibw_pconn_destruct failed for cm_id=%p\n", pconn->cm_id));
                return -1;
        }
 
@@ -1117,7 +1117,7 @@ int ibw_connect(struct ibw_conn *conn, struct sockaddr_in *serv_addr, void *conn
        rc = rdma_resolve_addr(pconn->cm_id, NULL, (struct sockaddr *) serv_addr, 2000);
        if (rc) {
                sprintf(ibw_lasterr, "rdma_resolve_addr error %d\n", rc);
-               DEBUG(0, (ibw_lasterr));
+               DEBUG(DEBUG_ERR, (ibw_lasterr));
                talloc_free(conn);
                return -1;
        }
@@ -1144,7 +1144,7 @@ int ibw_disconnect(struct ibw_conn *conn)
                rc = rdma_disconnect(pconn->cm_id);
                if (rc) {
                        sprintf(ibw_lasterr, "ibw_disconnect failed with %d\n", rc);
-                       DEBUG(0, (ibw_lasterr));
+                       DEBUG(DEBUG_ERR, (ibw_lasterr));
                        return rc;
                }
                break;
@@ -1194,9 +1194,9 @@ int ibw_alloc_send_buf(struct ibw_conn *conn, void **buf, void **key, uint32_t l
                        pconn->extra_max++;
                        switch(pconn->extra_max) {
                                case 1: DEBUG(DEBUG_INFO, ("warning: queue performed\n")); break;
-                               case 10: DEBUG(0, ("warning: queue reached 10\n")); break;
-                               case 100: DEBUG(0, ("warning: queue reached 100\n")); break;
-                               case 1000: DEBUG(0, ("warning: queue reached 1000\n")); break;
+                               case 10: DEBUG(DEBUG_INFO, ("warning: queue reached 10\n")); break;
+                               case 100: DEBUG(DEBUG_INFO, ("warning: queue reached 100\n")); break;
+                               case 1000: DEBUG(DEBUG_INFO, ("warning: queue reached 1000\n")); break;
                                default: break;
                        }
                }
@@ -1218,7 +1218,7 @@ int ibw_alloc_send_buf(struct ibw_conn *conn, void **buf, void **key, uint32_t l
 
        return 0;
 error:
-       DEBUG(0, ("ibw_alloc_send_buf error: %s", ibw_lasterr));
+       DEBUG(DEBUG_ERR, ("ibw_alloc_send_buf error: %s", ibw_lasterr));
        return -1;
 }
 
@@ -1282,7 +1282,7 @@ static int ibw_send_packet(struct ibw_conn *conn, void *buf, struct ibw_wr *p, u
 
        return 0;
 error:
-       DEBUG(0, (ibw_lasterr));
+       DEBUG(DEBUG_ERR, (ibw_lasterr));
        return -1;
 }
 
index ed5ab963676b281edfc3845b958925c466d4885d..cbd4f43173819008bfa06b7bf16f5338a5dbdc7f 100644 (file)
@@ -106,7 +106,7 @@ int ibwtest_send_id(struct ibw_conn *conn)
        DEBUG(DEBUG_DEBUG, ("ibwtest_send_id\n"));
        len = sizeof(uint32_t)+strlen(tcx->id)+2;
        if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
-               DEBUG(0, ("send_id: ibw_alloc_send_buf failed\n"));
+               DEBUG(DEBUG_ERR, ("send_id: ibw_alloc_send_buf failed\n"));
                return -1;
        }
 
@@ -116,7 +116,7 @@ int ibwtest_send_id(struct ibw_conn *conn)
        strcpy(buf+sizeof(uint32_t)+1, tcx->id);
 
        if (ibw_send(conn, buf, key, len)) {
-               DEBUG(0, ("send_id: ibw_send error\n"));
+               DEBUG(DEBUG_ERR, ("send_id: ibw_send error\n"));
                return -1;
        }
        tcx->nsent++;
@@ -147,7 +147,7 @@ int ibwtest_send_test_msg(struct ibwtest_ctx *tcx, struct ibw_conn *conn, const
        strcpy(p, msg);
 
        if (ibw_send(conn, buf, key, len)) {
-               DEBUG(0, ("send_test_msg: ibw_send error\n"));
+               DEBUG(DEBUG_ERR, ("send_test_msg: ibw_send error\n"));
                return -1;
        }
        tcx->nsent++;
@@ -190,7 +190,7 @@ int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_co
 
        len = sizeof(uint32_t) + 1 + size + 1;
        if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
-               DEBUG(0, ("varsize/ibw_alloc_send_buf failed\n"));
+               DEBUG(DEBUG_ERR, ("varsize/ibw_alloc_send_buf failed\n"));
                return -1;
        }
        *((uint32_t *)buf) = len;
@@ -198,7 +198,7 @@ int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_co
        sum = ibwtest_fill_random(buf + sizeof(uint32_t) + 1, size);
        buf[sizeof(uint32_t) + 1 + size] = sum;
        if (ibw_send(conn, buf, key, len)) {
-               DEBUG(0, ("varsize/ibw_send failed\n"));
+               DEBUG(DEBUG_ERR, ("varsize/ibw_send failed\n"));
                return -1;
        }
        tcx->nsent++;
@@ -254,7 +254,7 @@ int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
                        DEBUG(DEBUG_DEBUG, ("test IBWS_CONNECT_REQUEST\n"));
                        tconn = talloc_zero(conn, struct ibwtest_conn);
                        if (ibw_accept(ctx, conn, tconn)) {
-                               DEBUG(0, ("error accepting the connect request\n"));
+                               DEBUG(DEBUG_ERR, ("error accepting the connect request\n"));
                        }
                        break;
                case IBWS_STOPPED:
@@ -279,7 +279,7 @@ int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
                        break;
                case IBWC_CONNECTED:
                        if (gettimeofday(&tcx->start_time, NULL)) {
-                               DEBUG(0, ("gettimeofday error %d", errno));
+                               DEBUG(DEBUG_ERR, ("gettimeofday error %d", errno));
                                return -1;
                        }
                        ibwtest_send_id(conn);
@@ -330,7 +330,7 @@ int ibwtest_receive_handler(struct ibw_conn *conn, void *buf, int n)
                                (uint32_t)sum,
                                tconn->id ? tconn->id : "NULL"));
                        if (sum!=((unsigned char *)buf)[n-1]) {
-                               DEBUG(0, ("ERROR: checksum mismatch %u!=%u\n",
+                               DEBUG(DEBUG_ERR, ("ERROR: checksum mismatch %u!=%u\n",
                                        (uint32_t)sum, (uint32_t)((unsigned char *)buf)[n-1]));
                                ibw_stop(tcx->ibwctx);
                                goto error;
@@ -404,7 +404,7 @@ static struct ibwtest_ctx *testctx = NULL;
 
 void ibwtest_sigint_handler(int sig)
 {
-       DEBUG(0, ("got SIGINT\n"));
+       DEBUG(DEBUG_ERR, ("got SIGINT\n"));
        if (testctx) {
                if (testctx->ibwctx->state==IBWS_READY ||
                        testctx->ibwctx->state==IBWS_CONNECT_REQUEST ||
@@ -470,7 +470,7 @@ static int ibwtest_get_address(const char *address, struct in_addr *addr)
        if (inet_pton(AF_INET, address, addr) <= 0) {
                struct hostent *he = gethostbyname(address);
                if (he == NULL || he->h_length > sizeof(*addr)) {
-                       DEBUG(0, ("invalid nework address '%s'\n", address));
+                       DEBUG(DEBUG_ERR, ("invalid nework address '%s'\n", address));
                        return -1;
                }
                memcpy(addr, he->h_addr, he->h_length);
@@ -511,12 +511,12 @@ int ibwtest_init_server(struct ibwtest_ctx *tcx)
        }
 
        if (ibw_bind(tcx->ibwctx, &tcx->addrs[0])) {
-               DEBUG(0, ("ERROR: ibw_bind failed\n"));
+               DEBUG(DEBUG_ERR, ("ERROR: ibw_bind failed\n"));
                return -1;
        }
        
        if (ibw_listen(tcx->ibwctx, 1)) {
-               DEBUG(0, ("ERROR: ibw_listen failed\n"));
+               DEBUG(DEBUG_ERR, ("ERROR: ibw_listen failed\n"));
                return -1;
        }
 
@@ -637,7 +637,7 @@ int main(int argc, char *argv[])
 
        if (!tcx->is_server && tcx->nsent!=0 && !tcx->error) {
                if (gettimeofday(&tcx->end_time, NULL)) {
-                       DEBUG(0, ("gettimeofday error %d\n", errno));
+                       DEBUG(DEBUG_ERR, ("gettimeofday error %d\n", errno));
                        goto cleanup;
                }
                usec = (tcx->end_time.tv_sec - tcx->start_time.tv_sec) * 1000000 +
@@ -654,6 +654,6 @@ cleanup:
                talloc_free(tcx);
        if (ev)
                talloc_free(ev);
-       DEBUG(0, ("exited with code %d\n", result));
+       DEBUG(DEBUG_ERR, ("exited with code %d\n", result));
        return result;
 }
index 6fcbe37d82c6c8a4a2674fe58f4e72681fde10e5..8129668751c5a16caa72d34ee6d5cabf92c880d9 100644 (file)
@@ -134,7 +134,7 @@ static void ctdb_send_dmaster_reply(struct ctdb_db_context *ctdb_db,
        TALLOC_CTX *tmp_ctx;
 
        if (ctdb->pnn != ctdb_lmaster(ctdb, &key)) {
-               DEBUG(0,(__location__ " Caller is not lmaster!\n"));
+               DEBUG(DEBUG_ALERT,(__location__ " Caller is not lmaster!\n"));
                return;
        }
 
@@ -246,7 +246,7 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
        state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
 
        if (state == NULL) {
-               DEBUG(0,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n",
+               DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n",
                         ctdb->pnn, hdr->reqid, hdr->srcnode));
                ctdb_ltdb_unlock(ctdb_db, key);
                return;
@@ -254,7 +254,7 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
 
        if (hdr->reqid != state->reqid) {
                /* we found a record  but it was the wrong one */
-               DEBUG(0, ("Dropped orphan in ctdb_become_dmaster with reqid:%u\n from node %u", hdr->reqid, hdr->srcnode));
+               DEBUG(DEBUG_ERR, ("Dropped orphan in ctdb_become_dmaster with reqid:%u\n from node %u", hdr->reqid, hdr->srcnode));
                ctdb_ltdb_unlock(ctdb_db, key);
                return;
        }
@@ -311,7 +311,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
        }
 
        if (ctdb_lmaster(ctdb, &key) != ctdb->pnn) {
-               DEBUG(0,("pnn %u dmaster request to non-lmaster lmaster=%u gen=%u curgen=%u\n",
+               DEBUG(DEBUG_ALERT,("pnn %u dmaster request to non-lmaster lmaster=%u gen=%u curgen=%u\n",
                         ctdb->pnn, ctdb_lmaster(ctdb, &key), 
                         hdr->generation, ctdb->vnn_map->generation));
                ctdb_fatal(ctdb, "ctdb_req_dmaster to non-lmaster");
@@ -322,7 +322,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
 
        /* its a protocol error if the sending node is not the current dmaster */
        if (header.dmaster != hdr->srcnode) {
-               DEBUG(0,("pnn %u dmaster request for new-dmaster %u from non-master %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u keyval=0x%08x\n",
+               DEBUG(DEBUG_ALERT,("pnn %u dmaster request for new-dmaster %u from non-master %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u keyval=0x%08x\n",
                         ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
                         ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
                         (unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid,
@@ -334,7 +334,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
        }
 
        if (header.rsn > c->rsn) {
-               DEBUG(0,("pnn %u dmaster request with older RSN new-dmaster %u from %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u\n",
+               DEBUG(DEBUG_ALERT,("pnn %u dmaster request with older RSN new-dmaster %u from %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u\n",
                         ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
                         ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
                         (unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid));
@@ -459,13 +459,13 @@ void ctdb_reply_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 
        state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
        if (state == NULL) {
-               DEBUG(0, (__location__ " reqid %u not found\n", hdr->reqid));
+               DEBUG(DEBUG_ERR, (__location__ " reqid %u not found\n", hdr->reqid));
                return;
        }
 
        if (hdr->reqid != state->reqid) {
                /* we found a record  but it was the wrong one */
-               DEBUG(0, ("Dropped orphaned call reply with reqid:%u\n",hdr->reqid));
+               DEBUG(DEBUG_ERR, ("Dropped orphaned call reply with reqid:%u\n",hdr->reqid));
                return;
        }
 
@@ -498,7 +498,7 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 
        ctdb_db = find_ctdb_db(ctdb, c->db_id);
        if (ctdb_db == NULL) {
-               DEBUG(0,("Unknown db_id 0x%x in ctdb_reply_dmaster\n", c->db_id));
+               DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_reply_dmaster\n", c->db_id));
                return;
        }
        
@@ -513,7 +513,7 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
                return;
        }
        if (ret != 0) {
-               DEBUG(0,(__location__ " Failed to get lock in ctdb_reply_dmaster\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get lock in ctdb_reply_dmaster\n"));
                return;
        }
 
@@ -531,14 +531,14 @@ void ctdb_reply_error(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 
        state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
        if (state == NULL) {
-               DEBUG(0,("pnn %u Invalid reqid %u in ctdb_reply_error\n",
+               DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_reply_error\n",
                         ctdb->pnn, hdr->reqid));
                return;
        }
 
        if (hdr->reqid != state->reqid) {
                /* we found a record  but it was the wrong one */
-               DEBUG(0, ("Dropped orphaned error reply with reqid:%u\n",hdr->reqid));
+               DEBUG(DEBUG_ERR, ("Dropped orphaned error reply with reqid:%u\n",hdr->reqid));
                return;
        }
 
@@ -584,7 +584,7 @@ static void ctdb_call_resend(struct ctdb_call_state *state)
        state->c->hdr.destnode = ctdb->pnn;
 
        ctdb_queue_packet(ctdb, &state->c->hdr);
-       DEBUG(0,("resent ctdb_call\n"));
+       DEBUG(DEBUG_NOTICE,("resent ctdb_call\n"));
 }
 
 /*
index 884ed69177f0a74e75eba76adae40c5a30d5c99b..0d9bab0f61fb1197e32938a493a46fd319114b9d 100644 (file)
@@ -46,7 +46,7 @@ static int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata)
        long fsize;
        f = tmpfile();
        if (f == NULL) {
-               DEBUG(0,(__location__ " Unable to open tmpfile - %s\n", strerror(errno)));
+               DEBUG(DEBUG_ERR,(__location__ " Unable to open tmpfile - %s\n", strerror(errno)));
                return -1;
        }
        talloc_report_full(NULL, f);
@@ -57,7 +57,7 @@ static int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata)
        outdata->dsize = fread(outdata->dptr, 1, fsize, f);
        fclose(f);
        if (outdata->dsize != fsize) {
-               DEBUG(0,(__location__ " Unable to read tmpfile\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Unable to read tmpfile\n"));
                return -1;
        }
        return 0;
@@ -155,7 +155,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
        case CTDB_CONTROL_SET_RECMASTER: {
                CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
                if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-                       DEBUG(0,("Attempt to set recmaster when not frozen\n"));
+                       DEBUG(DEBUG_NOTICE,("Attempt to set recmaster when not frozen\n"));
                        return -1;
                }
                ctdb->recovery_master = ((uint32_t *)(&indata.dptr[0]))[0];
@@ -260,7 +260,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
                ctdb_release_all_ips(ctdb);
                ctdb->methods->shutdown(ctdb);
                ctdb_event_script(ctdb, "shutdown");
-               DEBUG(0,("Received SHUTDOWN command. Stopping CTDB daemon.\n"));
+               DEBUG(DEBUG_NOTICE,("Received SHUTDOWN command. Stopping CTDB daemon.\n"));
                exit(0);
 
        case CTDB_CONTROL_TAKEOVER_IP:
@@ -361,7 +361,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
        case CTDB_CONTROL_END_RECOVERY:
                return ctdb_control_end_recovery(ctdb, c, async_reply);
        default:
-               DEBUG(0,(__location__ " Unknown CTDB control opcode %u\n", opcode));
+               DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
                return -1;
        }
 }
@@ -441,14 +441,14 @@ void ctdb_reply_control(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 
        state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_control_state);
        if (state == NULL) {
-               DEBUG(0,("pnn %u Invalid reqid %u in ctdb_reply_control\n",
+               DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_reply_control\n",
                         ctdb->pnn, hdr->reqid));
                return;
        }
 
        if (hdr->reqid != state->reqid) {
                /* we found a record  but it was the wrong one */
-               DEBUG(0, ("Dropped orphaned control reply with reqid:%u\n", hdr->reqid));
+               DEBUG(DEBUG_ERR, ("Dropped orphaned control reply with reqid:%u\n", hdr->reqid));
                return;
        }
 
@@ -510,7 +510,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
             (destnode == CTDB_BROADCAST_ALL) ||
             (destnode == CTDB_BROADCAST_CONNECTED)) && 
            !(flags & CTDB_CTRL_FLAG_NOREPLY)) {
-               DEBUG(0,("Attempt to broadcast control without NOREPLY\n"));
+               DEBUG(DEBUG_CRIT,("Attempt to broadcast control without NOREPLY\n"));
                return -1;
        }
 
index 8f878ccc8398b96de22c8bba3393304eb5a8efbc..b9f0e07699ce08a9728824814d925c9c152df102 100644 (file)
@@ -39,12 +39,12 @@ static void flag_change_handler(struct ctdb_context *ctdb, uint64_t srvid,
        struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
 
        if (data.dsize != sizeof(*c) || !ctdb_validate_pnn(ctdb, c->pnn)) {
-               DEBUG(0,(__location__ "Invalid data in ctdb_node_flag_change\n"));
+               DEBUG(DEBUG_CRIT,(__location__ "Invalid data in ctdb_node_flag_change\n"));
                return;
        }
 
        if (!ctdb_validate_pnn(ctdb, c->pnn)) {
-               DEBUG(0,("Bad pnn %u in flag_change_handler\n", c->pnn));
+               DEBUG(DEBUG_CRIT,("Bad pnn %u in flag_change_handler\n", c->pnn));
                return;
        }
 
@@ -63,7 +63,7 @@ static void flag_change_handler(struct ctdb_context *ctdb, uint64_t srvid,
 
 static void print_exit_message(void)
 {
-       DEBUG(0,("CTDB daemon shutting down\n"));
+       DEBUG(DEBUG_NOTICE,("CTDB daemon shutting down\n"));
 }
 
 
@@ -72,13 +72,13 @@ static void ctdb_start_transport(struct ctdb_context *ctdb)
 {
        /* start the transport running */
        if (ctdb->methods->start(ctdb) != 0) {
-               DEBUG(0,("transport failed to start!\n"));
+               DEBUG(DEBUG_ALERT,("transport failed to start!\n"));
                ctdb_fatal(ctdb, "transport failed to start");
        }
 
        /* start the recovery daemon process */
        if (ctdb_start_recoverd(ctdb) != 0) {
-               DEBUG(0,("Failed to start recovery daemon\n"));
+               DEBUG(DEBUG_ALERT,("Failed to start recovery daemon\n"));
                exit(11);
        }
 
@@ -159,12 +159,12 @@ int daemon_register_message_handler(struct ctdb_context *ctdb, uint32_t client_i
        struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
        int res;
        if (client == NULL) {
-               DEBUG(0,("Bad client_id in daemon_request_register_message_handler\n"));
+               DEBUG(DEBUG_ERR,("Bad client_id in daemon_request_register_message_handler\n"));
                return -1;
        }
        res = ctdb_register_message_handler(ctdb, client, srvid, daemon_message_handler, client);
        if (res != 0) {
-               DEBUG(0,(__location__ " Failed to register handler %llu in daemon\n", 
+               DEBUG(DEBUG_ERR,(__location__ " Failed to register handler %llu in daemon\n", 
                         (unsigned long long)srvid));
        } else {
                DEBUG(DEBUG_INFO,(__location__ " Registered message handler for srvid=%llu\n", 
@@ -189,7 +189,7 @@ int daemon_deregister_message_handler(struct ctdb_context *ctdb, uint32_t client
 {
        struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
        if (client == NULL) {
-               DEBUG(0,("Bad client_id in daemon_request_deregister_message_handler\n"));
+               DEBUG(DEBUG_ERR,("Bad client_id in daemon_request_deregister_message_handler\n"));
                return -1;
        }
        return ctdb_deregister_message_handler(ctdb, srvid, client);
@@ -230,7 +230,7 @@ static void daemon_request_message_from_client(struct ctdb_client *client,
        res = ctdb_daemon_send_message(client->ctdb, c->hdr.destnode,
                                       c->srvid, data);
        if (res != 0) {
-               DEBUG(0,(__location__ " Failed to send message to remote node %u\n",
+               DEBUG(DEBUG_ERR,(__location__ " Failed to send message to remote node %u\n",
                         c->hdr.destnode));
        }
 }
@@ -260,7 +260,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
 
        res = ctdb_daemon_call_recv(state, dstate->call);
        if (res != 0) {
-               DEBUG(0, (__location__ " ctdbd_call_recv() returned error\n"));
+               DEBUG(DEBUG_ERR, (__location__ " ctdbd_call_recv() returned error\n"));
                client->ctdb->statistics.pending_calls--;
                ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
                return;
@@ -270,7 +270,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
        r = ctdbd_allocate_pkt(client->ctdb, dstate, CTDB_REPLY_CALL, 
                               length, struct ctdb_reply_call);
        if (r == NULL) {
-               DEBUG(0, (__location__ " Failed to allocate reply_call in ctdb daemon\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Failed to allocate reply_call in ctdb daemon\n"));
                client->ctdb->statistics.pending_calls--;
                ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
                return;
@@ -281,7 +281,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
 
        res = daemon_queue_send(client, &r->hdr);
        if (res != 0) {
-               DEBUG(0, (__location__ " Failed to queue packet from daemon to client\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Failed to queue packet from daemon to client\n"));
        }
        ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
        talloc_free(dstate);
@@ -302,13 +302,13 @@ static void daemon_incoming_packet_wrap(void *p, struct ctdb_req_header *hdr)
        struct ctdb_daemon_packet_wrap *w = talloc_get_type(p, 
                                                            struct ctdb_daemon_packet_wrap);
        if (w == NULL) {
-               DEBUG(0,(__location__ " Bad packet type '%s'\n", talloc_get_name(p)));
+               DEBUG(DEBUG_CRIT,(__location__ " Bad packet type '%s'\n", talloc_get_name(p)));
                return;
        }
 
        client = ctdb_reqid_find(w->ctdb, w->client_id, struct ctdb_client);
        if (client == NULL) {
-               DEBUG(0,(__location__ " Packet for disconnected client %u\n",
+               DEBUG(DEBUG_ERR,(__location__ " Packet for disconnected client %u\n",
                         w->client_id));
                talloc_free(w);
                return;
@@ -342,7 +342,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
 
        ctdb_db = find_ctdb_db(client->ctdb, c->db_id);
        if (!ctdb_db) {
-               DEBUG(0, (__location__ " Unknown database in request. db_id==0x%08x",
+               DEBUG(DEBUG_ERR, (__location__ " Unknown database in request. db_id==0x%08x",
                          c->db_id));
                ctdb->statistics.pending_calls--;
                return;
@@ -369,7 +369,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
        talloc_free(w);
 
        if (ret != 0) {
-               DEBUG(0,(__location__ " Unable to fetch record\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Unable to fetch record\n"));
                ctdb->statistics.pending_calls--;
                return;
        }
@@ -377,7 +377,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
        dstate = talloc(client, struct daemon_call_state);
        if (dstate == NULL) {
                ctdb_ltdb_unlock(ctdb_db, key);
-               DEBUG(0,(__location__ " Unable to allocate dstate\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Unable to allocate dstate\n"));
                ctdb->statistics.pending_calls--;
                return;
        }
@@ -389,7 +389,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
        call = dstate->call = talloc_zero(dstate, struct ctdb_call);
        if (call == NULL) {
                ctdb_ltdb_unlock(ctdb_db, key);
-               DEBUG(0,(__location__ " Unable to allocate call\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Unable to allocate call\n"));
                ctdb->statistics.pending_calls--;
                ctdb_latency(&ctdb->statistics.max_call_latency, dstate->start_time);
                return;
@@ -410,7 +410,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
        ctdb_ltdb_unlock(ctdb_db, key);
 
        if (state == NULL) {
-               DEBUG(0,(__location__ " Unable to setup call send\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Unable to setup call send\n"));
                ctdb->statistics.pending_calls--;
                ctdb_latency(&ctdb->statistics.max_call_latency, dstate->start_time);
                return;
@@ -467,7 +467,7 @@ static void daemon_incoming_packet(void *p, struct ctdb_req_header *hdr)
                break;
 
        default:
-               DEBUG(0,(__location__ " daemon: unrecognized operation %u\n",
+               DEBUG(DEBUG_CRIT,(__location__ " daemon: unrecognized operation %u\n",
                         hdr->operation));
        }
 
@@ -573,7 +573,7 @@ static int ux_socket_bind(struct ctdb_context *ctdb)
        /* AIX doesn't like this :( */
        if (fchown(ctdb->daemon.sd, geteuid(), getegid()) != 0 ||
            fchmod(ctdb->daemon.sd, 0700) != 0) {
-               DEBUG(0,("Unable to secure ctdb socket '%s', ctdb->daemon.name\n"));
+               DEBUG(DEBUG_CRIT,("Unable to secure ctdb socket '%s', ctdb->daemon.name\n"));
                goto failed;
        }
 #endif
@@ -585,11 +585,11 @@ static int ux_socket_bind(struct ctdb_context *ctdb)
        strncpy(addr.sun_path, ctdb->daemon.name, sizeof(addr.sun_path));
 
        if (bind(ctdb->daemon.sd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
-               DEBUG(0,("Unable to bind on ctdb socket '%s'\n", ctdb->daemon.name));
+               DEBUG(DEBUG_CRIT,("Unable to bind on ctdb socket '%s'\n", ctdb->daemon.name));
                goto failed;
        }       
        if (listen(ctdb->daemon.sd, 10) != 0) {
-               DEBUG(0,("Unable to listen on ctdb socket '%s'\n", ctdb->daemon.name));
+               DEBUG(DEBUG_CRIT,("Unable to listen on ctdb socket '%s'\n", ctdb->daemon.name));
                goto failed;
        }
 
@@ -625,7 +625,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
        /* create a unix domain stream socket to listen to */
        res = ux_socket_bind(ctdb);
        if (res!=0) {
-               DEBUG(0,(__location__ " Failed to open CTDB unix domain socket\n"));
+               DEBUG(DEBUG_ALERT,(__location__ " Failed to open CTDB unix domain socket\n"));
                exit(10);
        }
 
@@ -639,7 +639,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
                setsid();
                close(0);
                if (open("/dev/null", O_RDONLY) != 0) {
-                       DEBUG(0,(__location__ " Failed to setup stdin on /dev/null\n"));
+                       DEBUG(DEBUG_ALERT,(__location__ " Failed to setup stdin on /dev/null\n"));
                        exit(11);
                }
        }
@@ -672,13 +672,12 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
        }
 #endif
        if (ret != 0) {
-               DEBUG(0,("Failed to initialise transport '%s'\n", ctdb->transport));
+               DEBUG(DEBUG_ERR,("Failed to initialise transport '%s'\n", ctdb->transport));
                return -1;
        }
 
        /* initialise the transport  */
        if (ctdb->methods->initialise(ctdb) != 0) {
-               DEBUG(0,("transport failed to initialise!\n"));
                ctdb_fatal(ctdb, "transport failed to initialise");
        }
 
@@ -712,7 +711,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
        /* go into a wait loop to allow other nodes to complete */
        event_loop_wait(ctdb->ev);
 
-       DEBUG(0,("event_loop_wait() returned. this should not happen\n"));
+       DEBUG(DEBUG_CRIT,("event_loop_wait() returned. this should not happen\n"));
        exit(1);
 }
 
@@ -733,7 +732,7 @@ struct ctdb_req_header *_ctdb_transport_allocate(struct ctdb_context *ctdb,
 
        hdr = (struct ctdb_req_header *)ctdb->methods->allocate_pkt(mem_ctx, size);
        if (hdr == NULL) {
-               DEBUG(0,("Unable to allocate transport packet for operation %u of length %u\n",
+               DEBUG(DEBUG_ERR,("Unable to allocate transport packet for operation %u of length %u\n",
                         operation, (unsigned)length));
                return NULL;
        }
@@ -862,7 +861,7 @@ static void daemon_request_control_from_client(struct ctdb_client *client,
                                       data, daemon_control_callback,
                                       state);
        if (res != 0) {
-               DEBUG(0,(__location__ " Failed to send control to remote node %u\n",
+               DEBUG(DEBUG_ERR,(__location__ " Failed to send control to remote node %u\n",
                         c->hdr.destnode));
        }
 
@@ -913,7 +912,7 @@ static void ctdb_local_message_trigger(struct event_context *ev, struct timed_ev
 
        res = ctdb_dispatch_message(m->ctdb, m->srvid, m->data);
        if (res != 0) {
-               DEBUG(0, (__location__ " Failed to dispatch message for srvid=%llu\n", 
+               DEBUG(DEBUG_ERR, (__location__ " Failed to dispatch message for srvid=%llu\n", 
                          (unsigned long long)m->srvid));
        }
        talloc_free(m);
index 98a98aab3970faf164f4a5be13b3efc28af45800..f7fb38d4938dbfce17508c85134bfa2b66e060d6 100644 (file)
@@ -84,18 +84,18 @@ static void ctdb_freeze_lock_handler(struct event_context *ev, struct fd_event *
        struct ctdb_freeze_waiter *w;
 
        if (h->ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("freeze child died - unfreezing\n"));
+               DEBUG(DEBUG_INFO,("freeze child died - unfreezing\n"));
                talloc_free(h);
                return;
        }
 
        if (read(h->fd, &status, sizeof(status)) != sizeof(status)) {
-               DEBUG(0,("read error from freeze lock child\n"));
+               DEBUG(DEBUG_ERR,("read error from freeze lock child\n"));
                status = -1;
        }
 
        if (status == -1) {
-               DEBUG(0,("Failed to get locks in ctdb_freeze_child\n"));
+               DEBUG(DEBUG_ERR,("Failed to get locks in ctdb_freeze_child\n"));
                /* we didn't get the locks - destroy the handle */
                talloc_free(h);
                return;
@@ -128,14 +128,14 @@ static struct ctdb_freeze_handle *ctdb_freeze_lock(struct ctdb_context *ctdb)
 
        /* use socketpair() instead of pipe() so we have bi-directional fds */
        if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) {
-               DEBUG(0,("Failed to create pipe for ctdb_freeze_lock\n"));
+               DEBUG(DEBUG_ERR,("Failed to create pipe for ctdb_freeze_lock\n"));
                talloc_free(h);
                return NULL;
        }
        
        h->child = fork();
        if (h->child == -1) {
-               DEBUG(0,("Failed to fork child for ctdb_freeze_lock\n"));
+               DEBUG(DEBUG_ERR,("Failed to fork child for ctdb_freeze_lock\n"));
                talloc_free(h);
                return NULL;
        }
@@ -163,7 +163,7 @@ static struct ctdb_freeze_handle *ctdb_freeze_lock(struct ctdb_context *ctdb)
        fde = event_add_fd(ctdb->ev, h, h->fd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, 
                           ctdb_freeze_lock_handler, h);
        if (fde == NULL) {
-               DEBUG(0,("Failed to setup fd event for ctdb_freeze_lock\n"));
+               DEBUG(DEBUG_ERR,("Failed to setup fd event for ctdb_freeze_lock\n"));
                close(fd[0]);
                talloc_free(h);
                return NULL;
@@ -258,7 +258,7 @@ int32_t ctdb_control_thaw(struct ctdb_context *ctdb)
                for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
                        tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
                        if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
-                               DEBUG(0,(__location__ " Failed to cancel transaction for db '%s'\n",
+                               DEBUG(DEBUG_ERR,(__location__ " Failed to cancel transaction for db '%s'\n",
                                         ctdb_db->db_name));
                        }
                        tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
@@ -291,7 +291,7 @@ int32_t ctdb_control_transaction_start(struct ctdb_context *ctdb, uint32_t id)
        struct ctdb_db_context *ctdb_db;
 
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
                return -1;
        }
 
@@ -303,7 +303,7 @@ int32_t ctdb_control_transaction_start(struct ctdb_context *ctdb, uint32_t id)
 
                if (ctdb->freeze_handle->transaction_started) {
                        if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
-                               DEBUG(0,(__location__ " Failed to cancel transaction for db '%s'\n",
+                               DEBUG(DEBUG_ERR,(__location__ " Failed to cancel transaction for db '%s'\n",
                                         ctdb_db->db_name));
                                /* not a fatal error */
                        }
@@ -314,7 +314,7 @@ int32_t ctdb_control_transaction_start(struct ctdb_context *ctdb, uint32_t id)
                tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
 
                if (ret != 0) {
-                       DEBUG(0,(__location__ " Failed to start transaction for db '%s'\n",
+                       DEBUG(DEBUG_ERR,(__location__ " Failed to start transaction for db '%s'\n",
                                 ctdb_db->db_name));
                        return -1;
                }
@@ -334,24 +334,24 @@ int32_t ctdb_control_transaction_commit(struct ctdb_context *ctdb, uint32_t id)
        struct ctdb_db_context *ctdb_db;
 
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
                return -1;
        }
 
        if (!ctdb->freeze_handle->transaction_started) {
-               DEBUG(0,(__location__ " transaction not started\n"));
+               DEBUG(DEBUG_ERR,(__location__ " transaction not started\n"));
                return -1;
        }
 
        if (id != ctdb->freeze_handle->transaction_id) {
-               DEBUG(0,(__location__ " incorrect transaction id 0x%x in commit\n", id));
+               DEBUG(DEBUG_ERR,(__location__ " incorrect transaction id 0x%x in commit\n", id));
                return -1;
        }
 
        for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
                tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
                if (tdb_transaction_commit(ctdb_db->ltdb->tdb) != 0) {
-                       DEBUG(0,(__location__ " Failed to commit transaction for db '%s'\n",
+                       DEBUG(DEBUG_ERR,(__location__ " Failed to commit transaction for db '%s'\n",
                                 ctdb_db->db_name));
                        /* this has to be fatal to maintain integrity - it should only
                           happen if we run out of disk space */
@@ -376,28 +376,28 @@ int32_t ctdb_control_wipe_database(struct ctdb_context *ctdb, TDB_DATA indata)
        struct ctdb_db_context *ctdb_db;
 
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
                return -1;
        }
 
        if (!ctdb->freeze_handle->transaction_started) {
-               DEBUG(0,(__location__ " transaction not started\n"));
+               DEBUG(DEBUG_ERR,(__location__ " transaction not started\n"));
                return -1;
        }
 
        if (w.transaction_id != ctdb->freeze_handle->transaction_id) {
-               DEBUG(0,(__location__ " incorrect transaction id 0x%x in commit\n", w.transaction_id));
+               DEBUG(DEBUG_ERR,(__location__ " incorrect transaction id 0x%x in commit\n", w.transaction_id));
                return -1;
        }
 
        ctdb_db = find_ctdb_db(ctdb, w.db_id);
        if (!ctdb_db) {
-               DEBUG(0,(__location__ " Unknown db 0x%x\n", w.db_id));
+               DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%x\n", w.db_id));
                return -1;
        }
 
        if (tdb_wipe_all(ctdb_db->ltdb->tdb) != 0) {
-               DEBUG(0,(__location__ " Failed to wipe database for db '%s'\n",
+               DEBUG(DEBUG_ERR,(__location__ " Failed to wipe database for db '%s'\n",
                         ctdb_db->db_name));
                return -1;
        }
index 0047e9cf8a10c30f2634ea18b1ee650edea82c1f..1e46f5f0de97632d590f818280d27c58205f262e 100644 (file)
@@ -59,7 +59,7 @@ static void ctdb_check_for_dead_nodes(struct event_context *ev, struct timed_eve
                node->rx_cnt = 0;
 
                if (node->dead_count >= ctdb->tunable.keepalive_limit) {
-                       DEBUG(0,("dead count reached for node %u\n", node->pnn));
+                       DEBUG(DEBUG_NOTICE,("dead count reached for node %u\n", node->pnn));
                        ctdb_node_dead(node);
                        ctdb_send_keepalive(ctdb, node->pnn);
                        /* maybe tell the transport layer to kill the
@@ -94,7 +94,7 @@ void ctdb_start_keepalive(struct ctdb_context *ctdb)
                             ctdb_check_for_dead_nodes, ctdb);
        CTDB_NO_MEMORY_FATAL(ctdb, te);
 
-       DEBUG(0,("Keepalive monitoring has been started\n"));
+       DEBUG(DEBUG_NOTICE,("Keepalive monitoring has been started\n"));
 }
 
 void ctdb_stop_keepalive(struct ctdb_context *ctdb)
index 9748d0e1b78331e123c456a2a7e36870f0087c42..6ebc8c178106acc0aa9dadf4e82c5f0bfcecfa26 100644 (file)
@@ -188,7 +188,7 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
 
        /* setup a pipe to catch IO from subprocesses */
        if (pipe(p) != 0) {
-               DEBUG(0,(__location__ " Failed to setup for child logging pipe\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to setup for child logging pipe\n"));
                return -1;
        }
 
index ea0190ec367c825975a0387f64fa744fad111732..e900f7b9ca8c80b839e4498263864e62569b191f 100644 (file)
@@ -63,7 +63,7 @@ static void lock_fetch_callback(void *p)
        struct lock_fetch_state *state = talloc_get_type(p, struct lock_fetch_state);
        if (!state->ignore_generation &&
            state->generation != state->ctdb->vnn_map->generation) {
-               DEBUG(0,("Discarding previous generation lockwait packet\n"));
+               DEBUG(DEBUG_NOTICE,("Discarding previous generation lockwait packet\n"));
                talloc_free(state->hdr);
                return;
        }
@@ -181,7 +181,7 @@ static void ctdb_check_db_empty(struct ctdb_db_context *ctdb_db)
        struct tdb_context *tdb = ctdb_db->ltdb->tdb;
        int count = tdb_traverse_read(tdb, NULL, NULL);
        if (count != 0) {
-               DEBUG(0,(__location__ " tdb '%s' not empty on attach! aborting\n",
+               DEBUG(DEBUG_ALERT,(__location__ " tdb '%s' not empty on attach! aborting\n",
                         ctdb_db->db_path));
                ctdb_fatal(ctdb_db->ctdb, "database not empty on attach");
        }
@@ -213,7 +213,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
        /* check for hash collisions */
        for (tmp_db=ctdb->db_list;tmp_db;tmp_db=tmp_db->next) {
                if (tmp_db->db_id == ctdb_db->db_id) {
-                       DEBUG(0,("db_id 0x%x hash collision. name1='%s' name2='%s'\n",
+                       DEBUG(DEBUG_CRIT,("db_id 0x%x hash collision. name1='%s' name2='%s'\n",
                                 tmp_db->db_id, db_name, tmp_db->db_name));
                        talloc_free(ctdb_db);
                        return -1;
@@ -226,14 +226,14 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
 
        /* make sure the db directory exists */
        if (mkdir(ctdb->db_directory, 0700) == -1 && errno != EEXIST) {
-               DEBUG(0,(__location__ " Unable to create ctdb directory '%s'\n", 
+               DEBUG(DEBUG_CRIT,(__location__ " Unable to create ctdb directory '%s'\n", 
                         ctdb->db_directory));
                talloc_free(ctdb_db);
                return -1;
        }
 
        if (persistent && mkdir(ctdb->db_directory_persistent, 0700) == -1 && errno != EEXIST) {
-               DEBUG(0,(__location__ " Unable to create ctdb persistent directory '%s'\n", 
+               DEBUG(DEBUG_CRIT,(__location__ " Unable to create ctdb persistent directory '%s'\n", 
                         ctdb->db_directory_persistent));
                talloc_free(ctdb_db);
                return -1;
@@ -249,7 +249,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
                                      persistent? TDB_DEFAULT : TDB_CLEAR_IF_FIRST | TDB_NOSYNC, 
                                      O_CREAT|O_RDWR, 0666);
        if (ctdb_db->ltdb == NULL) {
-               DEBUG(0,("Failed to open tdb '%s'\n", ctdb_db->db_path));
+               DEBUG(DEBUG_CRIT,("Failed to open tdb '%s'\n", ctdb_db->db_path));
                talloc_free(ctdb_db);
                return -1;
        }
@@ -269,7 +269,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
        */
        ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_null_func, CTDB_NULL_FUNC);
        if (ret != 0) {
-               DEBUG(0,("Failed to setup null function for '%s'\n", ctdb_db->db_name));
+               DEBUG(DEBUG_CRIT,("Failed to setup null function for '%s'\n", ctdb_db->db_name));
                talloc_free(ctdb_db);
                return -1;
        }
@@ -280,7 +280,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
        */
        ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_fetch_func, CTDB_FETCH_FUNC);
        if (ret != 0) {
-               DEBUG(0,("Failed to setup fetch function for '%s'\n", ctdb_db->db_name));
+               DEBUG(DEBUG_CRIT,("Failed to setup fetch function for '%s'\n", ctdb_db->db_name));
                talloc_free(ctdb_db);
                return -1;
        }
@@ -307,7 +307,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
           databases
        */
        if (node->flags & NODE_FLAGS_INACTIVE) {
-               DEBUG(0,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name));
+               DEBUG(DEBUG_ERR,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name));
                return -1;
        }
 
@@ -326,7 +326,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
 
        db = ctdb_db_handle(ctdb, db_name);
        if (!db) {
-               DEBUG(0,("Failed to find db handle for name '%s'\n", db_name));
+               DEBUG(DEBUG_ERR,("Failed to find db handle for name '%s'\n", db_name));
                return -1;
        }
 
@@ -380,12 +380,12 @@ int ctdb_attach_persistent(struct ctdb_context *ctdb)
                p[4] = 0;
 
                if (ctdb_local_attach(ctdb, s, true) != 0) {
-                       DEBUG(0,("Failed to attach to persistent database '%s'\n", de->d_name));
+                       DEBUG(DEBUG_ERR,("Failed to attach to persistent database '%s'\n", de->d_name));
                        closedir(d);
                        talloc_free(s);
                        return -1;
                }
-               DEBUG(0,("Attached to persistent database %s\n", s));
+               DEBUG(DEBUG_NOTICE,("Attached to persistent database %s\n", s));
 
                talloc_free(s);
        }
@@ -406,7 +406,7 @@ int32_t ctdb_ltdb_update_seqnum(struct ctdb_context *ctdb, uint32_t db_id, uint3
 
        ctdb_db = find_ctdb_db(ctdb, db_id);
        if (!ctdb_db) {
-               DEBUG(0,("Unknown db_id 0x%x in ctdb_ltdb_update_seqnum\n", db_id));
+               DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_ltdb_update_seqnum\n", db_id));
                return -1;
        }
 
@@ -450,7 +450,7 @@ int32_t ctdb_ltdb_enable_seqnum(struct ctdb_context *ctdb, uint32_t db_id)
        struct ctdb_db_context *ctdb_db;
        ctdb_db = find_ctdb_db(ctdb, db_id);
        if (!ctdb_db) {
-               DEBUG(0,("Unknown db_id 0x%x in ctdb_ltdb_enable_seqnum\n", db_id));
+               DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_ltdb_enable_seqnum\n", db_id));
                return -1;
        }
 
index 74873e75ec868a79380f11074e47dbb9a96cd96d..0f87261c4c0b1c65764f5dfbd3a8c80e1ea71a57 100644 (file)
@@ -47,7 +47,7 @@ static void ctdb_health_callback(struct ctdb_context *ctdb, int status, void *p)
        c.old_flags = node->flags;
 
        if (status != 0 && !(node->flags & NODE_FLAGS_UNHEALTHY)) {
-               DEBUG(0,("monitor event failed - disabling node\n"));
+               DEBUG(DEBUG_NOTICE,("monitor event failed - disabling node\n"));
                node->flags |= NODE_FLAGS_UNHEALTHY;
                ctdb->monitor->next_interval = 1;
        } else if (status == 0 && (node->flags & NODE_FLAGS_UNHEALTHY)) {
@@ -89,9 +89,9 @@ static void ctdb_health_callback(struct ctdb_context *ctdb, int status, void *p)
 static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p)
 {
        if (status != 0) {
-               DEBUG(0,("startup event failed\n"));
+               DEBUG(DEBUG_ERR,("startup event failed\n"));
        } else if (status == 0) {
-               DEBUG(0,("startup event OK - enabling monitoring\n"));
+               DEBUG(DEBUG_NOTICE,("startup event OK - enabling monitoring\n"));
                ctdb->done_startup = true;
                ctdb->monitor->next_interval = 1;
        }
@@ -132,7 +132,7 @@ static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
        }
 
        if (ret != 0) {
-               DEBUG(0,("Unable to launch monitor event script\n"));
+               DEBUG(DEBUG_ERR,("Unable to launch monitor event script\n"));
                ctdb->monitor->next_interval = 1;
                event_add_timed(ctdb->ev, ctdb->monitor->monitor_context, 
                                timeval_current_ofs(1, 0), 
@@ -170,7 +170,7 @@ void ctdb_stop_monitoring(struct ctdb_context *ctdb)
 
        ctdb->monitor->monitoring_mode  = CTDB_MONITORING_DISABLED;
        ctdb->monitor->next_interval = 1;
-       DEBUG(0,("Monitoring has been stopped\n"));
+       DEBUG(DEBUG_NOTICE,("Monitoring has been stopped\n"));
 }
 
 /*
@@ -198,7 +198,7 @@ void ctdb_start_monitoring(struct ctdb_context *ctdb)
        CTDB_NO_MEMORY_FATAL(ctdb, te);
 
        ctdb->monitor->monitoring_mode  = CTDB_MONITORING_ACTIVE;
-       DEBUG(0,("Monitoring has been started\n"));
+       DEBUG(DEBUG_NOTICE,("Monitoring has been started\n"));
 }
 
 
@@ -221,7 +221,7 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
                return 0;
        }
 
-       DEBUG(0, ("Control modflags on node %u - flags now 0x%x\n", ctdb->pnn, node->flags));
+       DEBUG(DEBUG_INFO, ("Control modflags on node %u - flags now 0x%x\n", ctdb->pnn, node->flags));
 
        /* if we have been banned, go into recovery mode */
        c.pnn = ctdb->pnn;
@@ -237,7 +237,7 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
 
        if ((node->flags & NODE_FLAGS_BANNED) && !(old_flags & NODE_FLAGS_BANNED)) {
                /* make sure we are frozen */
-               DEBUG(0,("This node has been banned - forcing freeze and recovery\n"));
+               DEBUG(DEBUG_NOTICE,("This node has been banned - forcing freeze and recovery\n"));
                /* Reset the generation id to 1 to make us ignore any
                   REQ/REPLY CALL/DMASTER someone sends to us.
                   We are now banned so we shouldnt service database calls
index 16e28065463b4183543761d5731aa371496b7728..053bd400aecc285ede815fda6676ef7544633a1d 100644 (file)
@@ -46,7 +46,7 @@ static void ctdb_persistent_callback(struct ctdb_context *ctdb,
                                                              struct ctdb_persistent_state);
 
        if (status != 0) {
-               DEBUG(0,("ctdb_persistent_callback failed with status %d (%s)\n",
+               DEBUG(DEBUG_ERR,("ctdb_persistent_callback failed with status %d (%s)\n",
                         status, errormsg));
                state->status = status;
                state->errormsg = errormsg;
@@ -108,7 +108,7 @@ int32_t ctdb_control_persistent_store(struct ctdb_context *ctdb,
                                               c->client_id, 0, recdata, 
                                               ctdb_persistent_callback, state);
                if (ret == -1) {
-                       DEBUG(0,("Unable to send CTDB_CONTROL_UPDATE_RECORD to pnn %u\n", node->pnn));
+                       DEBUG(DEBUG_ERR,("Unable to send CTDB_CONTROL_UPDATE_RECORD to pnn %u\n", node->pnn));
                        talloc_free(state);
                        return -1;
                }
@@ -157,13 +157,13 @@ static int ctdb_persistent_store(struct ctdb_persistent_lock_state *state)
        /* fetch the old header and ensure the rsn is less than the new rsn */
        ret = ctdb_ltdb_fetch(state->ctdb_db, state->key, &oldheader, NULL, NULL);
        if (ret != 0) {
-               DEBUG(0,("Failed to fetch old record for db_id 0x%08x in ctdb_persistent_store\n",
+               DEBUG(DEBUG_ERR,("Failed to fetch old record for db_id 0x%08x in ctdb_persistent_store\n",
                         state->ctdb_db->db_id));
                return -1;
        }
 
        if (oldheader.rsn >= state->header->rsn) {
-               DEBUG(0,("existing header for db_id 0x%08x has larger RSN %llu than new RSN %llu in ctdb_persistent_store\n",
+               DEBUG(DEBUG_CRIT,("existing header for db_id 0x%08x has larger RSN %llu than new RSN %llu in ctdb_persistent_store\n",
                         state->ctdb_db->db_id, 
                         (unsigned long long)oldheader.rsn, (unsigned long long)state->header->rsn));
                return -1;
@@ -171,7 +171,7 @@ static int ctdb_persistent_store(struct ctdb_persistent_lock_state *state)
 
        ret = ctdb_ltdb_store(state->ctdb_db, state->key, state->header, state->data);
        if (ret != 0) {
-               DEBUG(0,("Failed to store record for db_id 0x%08x in ctdb_persistent_store\n", 
+               DEBUG(DEBUG_CRIT,("Failed to store record for db_id 0x%08x in ctdb_persistent_store\n", 
                         state->ctdb_db->db_id));
                return -1;
        }
@@ -192,7 +192,7 @@ static void ctdb_persistent_lock_callback(void *private_data)
 
        ret = tdb_chainlock_mark(state->tdb, state->key);
        if (ret != 0) {
-               DEBUG(0,("Failed to mark lock in ctdb_persistent_lock_callback\n"));
+               DEBUG(DEBUG_ERR,("Failed to mark lock in ctdb_persistent_lock_callback\n"));
                ctdb_request_control_reply(state->ctdb_db->ctdb, state->c, NULL, ret, NULL);
                return;
        }
@@ -231,13 +231,13 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
        struct ctdb_persistent_lock_state *state;
 
        if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
-               DEBUG(0,("rejecting ctdb_control_update_record when recovery active\n"));
+               DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_update_record when recovery active\n"));
                return -1;
        }
 
        ctdb_db = find_ctdb_db(ctdb, db_id);
        if (ctdb_db == NULL) {
-               DEBUG(0,("Unknown database 0x%08x in ctdb_control_update_record\n", db_id));
+               DEBUG(DEBUG_ERR,("Unknown database 0x%08x in ctdb_control_update_record\n", db_id));
                return -1;
        }
 
@@ -253,7 +253,7 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
        state->data.dsize = rec->datalen;
 
        if (state->data.dsize < sizeof(struct ctdb_ltdb_header)) {
-               DEBUG(0,("Invalid data size %u in ctdb_control_update_record\n", 
+               DEBUG(DEBUG_CRIT,("Invalid data size %u in ctdb_control_update_record\n", 
                         (unsigned)state->data.dsize));
                return -1;
        }
@@ -273,7 +273,7 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
        /* wait until we have a lock on this record */
        handle = ctdb_lockwait(ctdb_db, state->key, ctdb_persistent_lock_callback, state);
        if (handle == NULL) {
-               DEBUG(0,("Failed to setup lockwait handler in ctdb_control_update_record\n"));
+               DEBUG(DEBUG_ERR,("Failed to setup lockwait handler in ctdb_control_update_record\n"));
                return -1;
        }
 
index d35bb9e8d534ce5dc8d3b5a17dc94f4825a20e3c..c3a0caf0a7a4a73878271c592c75a7d2c0c98139 100644 (file)
@@ -35,7 +35,7 @@ static int ctdb_lock_all_databases_mark(struct ctdb_context *ctdb)
 {
        struct ctdb_db_context *ctdb_db;
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("Attempt to mark all databases locked when not frozen\n"));
+               DEBUG(DEBUG_ERR,("Attempt to mark all databases locked when not frozen\n"));
                return -1;
        }
        for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
@@ -53,7 +53,7 @@ static int ctdb_lock_all_databases_unmark(struct ctdb_context *ctdb)
 {
        struct ctdb_db_context *ctdb_db;
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("Attempt to unmark all databases locked when not frozen\n"));
+               DEBUG(DEBUG_ERR,("Attempt to unmark all databases locked when not frozen\n"));
                return -1;
        }
        for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
@@ -92,7 +92,7 @@ ctdb_control_setvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA inda
        struct ctdb_vnn_map_wire *map = (struct ctdb_vnn_map_wire *)indata.dptr;
 
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("Attempt to set vnnmap when not frozen\n"));
+               DEBUG(DEBUG_ERR,("Attempt to set vnnmap when not frozen\n"));
                return -1;
        }
 
@@ -129,7 +129,7 @@ ctdb_control_getdbmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indat
        outdata->dsize = offsetof(struct ctdb_dbid_map, dbs) + sizeof(dbid_map->dbs[0])*len;
        outdata->dptr  = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
        if (!outdata->dptr) {
-               DEBUG(0, (__location__ " Failed to allocate dbmap array\n"));
+               DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate dbmap array\n"));
                exit(1);
        }
 
@@ -156,7 +156,7 @@ ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA ind
        outdata->dsize = offsetof(struct ctdb_node_map, nodes) + num_nodes*sizeof(struct ctdb_node_and_flags);
        outdata->dptr  = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
        if (!outdata->dptr) {
-               DEBUG(0, (__location__ " Failed to allocate nodemap array\n"));
+               DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate nodemap array\n"));
                exit(1);
        }
 
@@ -194,7 +194,7 @@ static int traverse_pulldb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
        }
        params->pulldata = talloc_realloc_size(NULL, params->pulldata, rec->length + params->len);
        if (params->pulldata == NULL) {
-               DEBUG(0,(__location__ " Failed to expand pulldb_data to %u (%u records)\n", 
+               DEBUG(DEBUG_ERR,(__location__ " Failed to expand pulldb_data to %u (%u records)\n", 
                         rec->length + params->len, params->pulldata->count));
                params->failed = true;
                return -1;
@@ -218,7 +218,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
        struct ctdb_control_pulldb_reply *reply;
 
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("rejecting ctdb_control_pull_db when not frozen\n"));
+               DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_pull_db when not frozen\n"));
                return -1;
        }
 
@@ -226,7 +226,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
        
        ctdb_db = find_ctdb_db(ctdb, pull->db_id);
        if (!ctdb_db) {
-               DEBUG(0,(__location__ " Unknown db 0x%08x\n", pull->db_id));
+               DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", pull->db_id));
                return -1;
        }
 
@@ -241,12 +241,12 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
        params.failed = false;
 
        if (ctdb_lock_all_databases_mark(ctdb) != 0) {
-               DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
                return -1;
        }
 
        if (tdb_traverse_read(ctdb_db->ltdb->tdb, traverse_pulldb, &params) == -1) {
-               DEBUG(0,(__location__ " Failed to get traverse db '%s'\n", ctdb_db->db_name));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get traverse db '%s'\n", ctdb_db->db_name));
                ctdb_lock_all_databases_unmark(ctdb);
                talloc_free(params.pulldata);
                return -1;
@@ -271,23 +271,23 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
        struct ctdb_rec_data *rec;
 
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("rejecting ctdb_control_push_db when not frozen\n"));
+               DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_push_db when not frozen\n"));
                return -1;
        }
 
        if (indata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
-               DEBUG(0,(__location__ " invalid data in pulldb reply\n"));
+               DEBUG(DEBUG_ERR,(__location__ " invalid data in pulldb reply\n"));
                return -1;
        }
 
        ctdb_db = find_ctdb_db(ctdb, reply->db_id);
        if (!ctdb_db) {
-               DEBUG(0,(__location__ " Unknown db 0x%08x\n", reply->db_id));
+               DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", reply->db_id));
                return -1;
        }
 
        if (ctdb_lock_all_databases_mark(ctdb) != 0) {
-               DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
                return -1;
        }
 
@@ -306,7 +306,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
                data.dsize = rec->datalen;
 
                if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
-                       DEBUG(0,(__location__ " bad ltdb record\n"));
+                       DEBUG(DEBUG_CRIT,(__location__ " bad ltdb record\n"));
                        goto failed;
                }
                hdr = (struct ctdb_ltdb_header *)data.dptr;
@@ -315,7 +315,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
 
                ret = ctdb_ltdb_store(ctdb_db, key, hdr, data);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to store record\n"));
+                       DEBUG(DEBUG_CRIT, (__location__ " Unable to store record\n"));
                        goto failed;
                }
 
@@ -349,7 +349,7 @@ static int traverse_setdmaster(struct tdb_context *tdb, TDB_DATA key, TDB_DATA d
 
        ret = tdb_store(tdb, key, data, TDB_REPLACE);
        if (ret) {
-               DEBUG(0,(__location__ " failed to write tdb data back  ret:%d\n",ret));
+               DEBUG(DEBUG_CRIT,(__location__ " failed to write tdb data back  ret:%d\n",ret));
                return ret;
        }
 
@@ -364,18 +364,18 @@ int32_t ctdb_control_set_dmaster(struct ctdb_context *ctdb, TDB_DATA indata)
        struct ctdb_db_context *ctdb_db;
 
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("rejecting ctdb_control_set_dmaster when not frozen\n"));
+               DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_set_dmaster when not frozen\n"));
                return -1;
        }
 
        ctdb_db = find_ctdb_db(ctdb, p->db_id);
        if (!ctdb_db) {
-               DEBUG(0,(__location__ " Unknown db 0x%08x\n", p->db_id));
+               DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", p->db_id));
                return -1;
        }
 
        if (ctdb_lock_all_databases_mark(ctdb) != 0) {
-               DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
                return -1;
        }
 
@@ -473,14 +473,14 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
        pid_t parent = getpid();
 
        if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("Attempt to change recovery mode to %u when not frozen\n", 
+               DEBUG(DEBUG_ERR,("Attempt to change recovery mode to %u when not frozen\n", 
                         recmode));
                (*errormsg) = "Cannot change recovery mode while not frozen";
                return -1;
        }
 
        if (recmode != ctdb->recovery_mode) {
-               DEBUG(0,(__location__ " Recovery mode set to %s\n", 
+               DEBUG(DEBUG_NOTICE,(__location__ " Recovery mode set to %s\n", 
                         recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"ACTIVE"));
        }
 
@@ -503,7 +503,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
        ret = pipe(state->fd);
        if (ret != 0) {
                talloc_free(state);
-               DEBUG(0,(__location__ " Failed to open pipe for set_recmode child\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " Failed to open pipe for set_recmode child\n"));
                return -1;
        }
 
@@ -523,7 +523,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
                  as it should  be held by the recovery master 
                */
                if (ctdb_recovery_lock(ctdb, false)) {
-                       DEBUG(0,("ERROR: recovery lock file %s not locked when recovering!\n", ctdb->recovery_lock_file));
+                       DEBUG(DEBUG_CRIT,("ERROR: recovery lock file %s not locked when recovering!\n", ctdb->recovery_lock_file));
                        cc = 1;
                }
 
@@ -573,7 +573,7 @@ bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep)
        }
        ctdb->recovery_lock_fd = open(ctdb->recovery_lock_file, O_RDWR|O_CREAT, 0600);
        if (ctdb->recovery_lock_fd == -1) {
-               DEBUG(0,("ctdb_recovery_lock: Unable to open %s - (%s)\n", 
+               DEBUG(DEBUG_ERR,("ctdb_recovery_lock: Unable to open %s - (%s)\n", 
                         ctdb->recovery_lock_file, strerror(errno)));
                return false;
        }
@@ -590,7 +590,7 @@ bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep)
                close(ctdb->recovery_lock_fd);
                ctdb->recovery_lock_fd = -1;
                if (keep) {
-                       DEBUG(0,("ctdb_recovery_lock: Failed to get recovery lock on '%s'\n", ctdb->recovery_lock_file));
+                       DEBUG(DEBUG_CRIT,("ctdb_recovery_lock: Failed to get recovery lock on '%s'\n", ctdb->recovery_lock_file));
                }
                return false;
        }
@@ -600,7 +600,7 @@ bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep)
                ctdb->recovery_lock_fd = -1;
        }
 
-       DEBUG(0,("ctdb_recovery_lock: Got recovery lock on '%s'\n", ctdb->recovery_lock_file));
+       DEBUG(DEBUG_NOTICE,("ctdb_recovery_lock: Got recovery lock on '%s'\n", ctdb->recovery_lock_file));
 
        return true;
 }
@@ -624,13 +624,13 @@ int32_t ctdb_control_delete_record(struct ctdb_context *ctdb, TDB_DATA indata)
        int tdb_unlock(struct tdb_context *tdb, int list, int ltype);
 
        if (indata.dsize < sizeof(uint32_t) || indata.dsize != rec->length) {
-               DEBUG(0,(__location__ " Bad record size in ctdb_control_delete_record\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Bad record size in ctdb_control_delete_record\n"));
                return -1;
        }
 
        ctdb_db = find_ctdb_db(ctdb, rec->reqid);
        if (!ctdb_db) {
-               DEBUG(0,(__location__ " Unknown db 0x%08x\n", rec->reqid));
+               DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", rec->reqid));
                return -1;
        }
 
@@ -645,7 +645,7 @@ int32_t ctdb_control_delete_record(struct ctdb_context *ctdb, TDB_DATA indata)
        }
 
        if (data.dsize != sizeof(struct ctdb_ltdb_header)) {
-               DEBUG(0,(__location__ " Bad record size\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Bad record size\n"));
                return -1;
        }
 
@@ -666,7 +666,7 @@ int32_t ctdb_control_delete_record(struct ctdb_context *ctdb, TDB_DATA indata)
                if (tdb_lock_nonblock(ctdb_db->ltdb->tdb, -1, F_WRLCK) == 0) {
                        tdb_delete(ctdb_db->ltdb->tdb, key);
                        tdb_unlock(ctdb_db->ltdb->tdb, -1, F_WRLCK);
-                       DEBUG(0,(__location__ " Deleted corrupt record\n"));
+                       DEBUG(DEBUG_CRIT,(__location__ " Deleted corrupt record\n"));
                }
                tdb_chainunlock(ctdb_db->ltdb->tdb, key);
                free(data.dptr);
@@ -726,7 +726,7 @@ static void ctdb_end_recovery_callback(struct ctdb_context *ctdb, int status, vo
        ctdb_enable_monitoring(ctdb);
 
        if (status != 0) {
-               DEBUG(0,(__location__ " recovered event script failed (status %d)\n", status));
+               DEBUG(DEBUG_ERR,(__location__ " recovered event script failed (status %d)\n", status));
        }
 
        ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
@@ -745,7 +745,7 @@ int32_t ctdb_control_end_recovery(struct ctdb_context *ctdb,
        int ret;
        struct recovery_callback_state *state;
 
-       DEBUG(0,("Recovery has finished\n"));
+       DEBUG(DEBUG_NOTICE,("Recovery has finished\n"));
 
        state = talloc(ctdb, struct recovery_callback_state);
        CTDB_NO_MEMORY(ctdb, state);
@@ -763,7 +763,7 @@ int32_t ctdb_control_end_recovery(struct ctdb_context *ctdb,
        if (ret != 0) {
                ctdb_enable_monitoring(ctdb);
 
-               DEBUG(0,(__location__ " Failed to end recovery\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to end recovery\n"));
                talloc_free(state);
                return -1;
        }
@@ -783,7 +783,7 @@ static void ctdb_start_recovery_callback(struct ctdb_context *ctdb, int status,
        ctdb_enable_monitoring(ctdb);
 
        if (status != 0) {
-               DEBUG(0,(__location__ " startrecovery event script failed (status %d)\n", status));
+               DEBUG(DEBUG_ERR,(__location__ " startrecovery event script failed (status %d)\n", status));
        }
 
        ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
@@ -800,7 +800,7 @@ int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb,
        int ret;
        struct recovery_callback_state *state;
 
-       DEBUG(0,("Recovery has started\n"));
+       DEBUG(DEBUG_NOTICE,("Recovery has started\n"));
 
        state = talloc(ctdb, struct recovery_callback_state);
        CTDB_NO_MEMORY(ctdb, state);
@@ -818,7 +818,7 @@ int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb,
        if (ret != 0) {
                ctdb_enable_monitoring(ctdb);
 
-               DEBUG(0,(__location__ " Failed to start recovery\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to start recovery\n"));
                talloc_free(state);
                return -1;
        }
index 9696fcf20526324a772aa9d73d4851cc5d6b90fc..7367093810be7e7655eecb81238bd00bb902516d 100644 (file)
@@ -65,10 +65,10 @@ static void ctdb_unban_node(struct ctdb_recoverd *rec, uint32_t pnn)
 {
        struct ctdb_context *ctdb = rec->ctdb;
 
-       DEBUG(0,("Unbanning node %u\n", pnn));
+       DEBUG(DEBUG_NOTICE,("Unbanning node %u\n", pnn));
 
        if (!ctdb_validate_pnn(ctdb, pnn)) {
-               DEBUG(0,("Bad pnn %u in ctdb_unban_node\n", pnn));
+               DEBUG(DEBUG_ERR,("Bad pnn %u in ctdb_unban_node\n", pnn));
                return;
        }
 
@@ -77,14 +77,14 @@ static void ctdb_unban_node(struct ctdb_recoverd *rec, uint32_t pnn)
                TDB_DATA data;
                int ret;
                
-               DEBUG(0,("Unanning remote node %u. Passing the ban request on to the remote node.\n", pnn));
+               DEBUG(DEBUG_NOTICE,("Unanning remote node %u. Passing the ban request on to the remote node.\n", pnn));
 
                data.dptr = (uint8_t *)&pnn;
                data.dsize = sizeof(uint32_t);
 
                ret = ctdb_send_message(ctdb, pnn, CTDB_SRVID_UNBAN_NODE, data);
                if (ret != 0) {
-                       DEBUG(0,("Failed to unban node %u\n", pnn));
+                       DEBUG(DEBUG_ERR,("Failed to unban node %u\n", pnn));
                        return;
                }
 
@@ -95,11 +95,11 @@ static void ctdb_unban_node(struct ctdb_recoverd *rec, uint32_t pnn)
           there is an election */
        rec->node_flags &= ~NODE_FLAGS_BANNED;
 
-       DEBUG(0,("Clearing ban flag on node %u\n", pnn));
+       DEBUG(DEBUG_INFO,("Clearing ban flag on node %u\n", pnn));
        ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), pnn, 0, NODE_FLAGS_BANNED);
 
        if (rec->banned_nodes[pnn] == NULL) {
-               DEBUG(0,("No ban recorded for this node. ctdb_unban_node() request ignored\n"));
+               DEBUG(DEBUG_INFO,("No ban recorded for this node. ctdb_unban_node() request ignored\n"));
                return;
        }
 
@@ -117,7 +117,7 @@ static void ctdb_ban_timeout(struct event_context *ev, struct timed_event *te, s
        struct ctdb_recoverd *rec = state->rec;
        uint32_t pnn = state->banned_node;
 
-       DEBUG(0,("Ban timeout. Node %u is now unbanned\n", pnn));
+       DEBUG(DEBUG_NOTICE,("Ban timeout. Node %u is now unbanned\n", pnn));
        ctdb_unban_node(rec, pnn);
 }
 
@@ -128,15 +128,15 @@ static void ctdb_ban_node(struct ctdb_recoverd *rec, uint32_t pnn, uint32_t ban_
 {
        struct ctdb_context *ctdb = rec->ctdb;
 
-       DEBUG(0,("Banning node %u for %u seconds\n", pnn, ban_time));
+       DEBUG(DEBUG_NOTICE,("Banning node %u for %u seconds\n", pnn, ban_time));
 
        if (!ctdb_validate_pnn(ctdb, pnn)) {
-               DEBUG(0,("Bad pnn %u in ctdb_ban_node\n", pnn));
+               DEBUG(DEBUG_ERR,("Bad pnn %u in ctdb_ban_node\n", pnn));
                return;
        }
 
        if (0 == ctdb->tunable.enable_bans) {
-               DEBUG(0,("Bans are disabled - ignoring ban of node %u\n", pnn));
+               DEBUG(DEBUG_INFO,("Bans are disabled - ignoring ban of node %u\n", pnn));
                return;
        }
 
@@ -146,7 +146,7 @@ static void ctdb_ban_node(struct ctdb_recoverd *rec, uint32_t pnn, uint32_t ban_
                TDB_DATA data;
                int ret;
                
-               DEBUG(0,("Banning remote node %u for %u seconds. Passing the ban request on to the remote node.\n", pnn, ban_time));
+               DEBUG(DEBUG_NOTICE,("Banning remote node %u for %u seconds. Passing the ban request on to the remote node.\n", pnn, ban_time));
 
                b.pnn = pnn;
                b.ban_time = ban_time;
@@ -156,14 +156,14 @@ static void ctdb_ban_node(struct ctdb_recoverd *rec, uint32_t pnn, uint32_t ban_
 
                ret = ctdb_send_message(ctdb, pnn, CTDB_SRVID_BAN_NODE, data);
                if (ret != 0) {
-                       DEBUG(0,("Failed to ban node %u\n", pnn));
+                       DEBUG(DEBUG_ERR,("Failed to ban node %u\n", pnn));
                        return;
                }
 
                return;
        }
 
-       DEBUG(0,("self ban - lowering our election priority\n"));
+       DEBUG(DEBUG_NOTICE,("self ban - lowering our election priority\n"));
        ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), pnn, NODE_FLAGS_BANNED, 0);
 
        /* banning ourselves - lower our election priority */
@@ -174,7 +174,7 @@ static void ctdb_ban_node(struct ctdb_recoverd *rec, uint32_t pnn, uint32_t ban_
        rec->node_flags |= NODE_FLAGS_BANNED;
 
        if (rec->banned_nodes[pnn] != NULL) {
-               DEBUG(0,("Re-banning an already banned node. Remove previous ban and set a new ban.\n"));               
+               DEBUG(DEBUG_NOTICE,("Re-banning an already banned node. Remove previous ban and set a new ban.\n"));            
                talloc_free(rec->banned_nodes[pnn]);
                rec->banned_nodes[pnn] = NULL;
        }
@@ -208,7 +208,7 @@ static int run_recovered_eventscript(struct ctdb_context *ctdb, struct ctdb_node
        if (ctdb_client_async_control(ctdb, CTDB_CONTROL_END_RECOVERY,
                        list_of_active_nodes(ctdb, nodemap, tmp_ctx, true),
                        CONTROL_TIMEOUT(), false, tdb_null) != 0) {
-               DEBUG(0, (__location__ " Unable to run the 'recovered' event. Recovery failed.\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'recovered' event. Recovery failed.\n"));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -230,7 +230,7 @@ static int run_startrecovery_eventscript(struct ctdb_context *ctdb, struct ctdb_
        if (ctdb_client_async_control(ctdb, CTDB_CONTROL_START_RECOVERY,
                        list_of_active_nodes(ctdb, nodemap, tmp_ctx, true),
                        CONTROL_TIMEOUT(), false, tdb_null) != 0) {
-               DEBUG(0, (__location__ " Unable to run the 'startrecovery' event. Recovery failed.\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'startrecovery' event. Recovery failed.\n"));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -258,7 +258,7 @@ static int set_recovery_mode(struct ctdb_context *ctdb, struct ctdb_node_map *no
                if (ctdb_client_async_control(ctdb, CTDB_CONTROL_FREEZE,
                                                nodes, CONTROL_TIMEOUT(),
                                                false, tdb_null) != 0) {
-                       DEBUG(0, (__location__ " Unable to freeze nodes. Recovery failed.\n"));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to freeze nodes. Recovery failed.\n"));
                        talloc_free(tmp_ctx);
                        return -1;
                }
@@ -271,7 +271,7 @@ static int set_recovery_mode(struct ctdb_context *ctdb, struct ctdb_node_map *no
        if (ctdb_client_async_control(ctdb, CTDB_CONTROL_SET_RECMODE,
                                        nodes, CONTROL_TIMEOUT(),
                                        false, data) != 0) {
-               DEBUG(0, (__location__ " Unable to set recovery mode. Recovery failed.\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode. Recovery failed.\n"));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -280,7 +280,7 @@ static int set_recovery_mode(struct ctdb_context *ctdb, struct ctdb_node_map *no
                if (ctdb_client_async_control(ctdb, CTDB_CONTROL_THAW,
                                                nodes, CONTROL_TIMEOUT(),
                                                false, tdb_null) != 0) {
-                       DEBUG(0, (__location__ " Unable to thaw nodes. Recovery failed.\n"));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to thaw nodes. Recovery failed.\n"));
                        talloc_free(tmp_ctx);
                        return -1;
                }
@@ -307,7 +307,7 @@ static int set_recovery_master(struct ctdb_context *ctdb, struct ctdb_node_map *
        if (ctdb_client_async_control(ctdb, CTDB_CONTROL_SET_RECMASTER,
                        list_of_active_nodes(ctdb, nodemap, tmp_ctx, true),
                        CONTROL_TIMEOUT(), false, data) != 0) {
-               DEBUG(0, (__location__ " Unable to set recmaster. Recovery failed.\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to set recmaster. Recovery failed.\n"));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -340,7 +340,7 @@ static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctd
                ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
                                         mem_ctx, &remote_dbmap);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to get dbids from node %u\n", pnn));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from node %u\n", pnn));
                        return -1;
                }
 
@@ -362,13 +362,13 @@ static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctd
                        ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), pnn, dbmap->dbs[db].dbid, 
                                            mem_ctx, &name);
                        if (ret != 0) {
-                               DEBUG(0, (__location__ " Unable to get dbname from node %u\n", pnn));
+                               DEBUG(DEBUG_ERR, (__location__ " Unable to get dbname from node %u\n", pnn));
                                return -1;
                        }
                        ctdb_ctrl_createdb(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
                                           mem_ctx, name, dbmap->dbs[db].persistent);
                        if (ret != 0) {
-                               DEBUG(0, (__location__ " Unable to create remote db:%s\n", name));
+                               DEBUG(DEBUG_ERR, (__location__ " Unable to create remote db:%s\n", name));
                                return -1;
                        }
                }
@@ -401,7 +401,7 @@ static int create_missing_local_databases(struct ctdb_context *ctdb, struct ctdb
                ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
                                         mem_ctx, &remote_dbmap);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to get dbids from node %u\n", pnn));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from node %u\n", pnn));
                        return -1;
                }
 
@@ -424,19 +424,19 @@ static int create_missing_local_databases(struct ctdb_context *ctdb, struct ctdb
                        ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
                                            remote_dbmap->dbs[db].dbid, mem_ctx, &name);
                        if (ret != 0) {
-                               DEBUG(0, (__location__ " Unable to get dbname from node %u\n", 
+                               DEBUG(DEBUG_ERR, (__location__ " Unable to get dbname from node %u\n", 
                                          nodemap->nodes[j].pnn));
                                return -1;
                        }
                        ctdb_ctrl_createdb(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, name, 
                                           remote_dbmap->dbs[db].persistent);
                        if (ret != 0) {
-                               DEBUG(0, (__location__ " Unable to create local db:%s\n", name));
+                               DEBUG(DEBUG_ERR, (__location__ " Unable to create local db:%s\n", name));
                                return -1;
                        }
                        ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, dbmap);
                        if (ret != 0) {
-                               DEBUG(0, (__location__ " Unable to reread dbmap on node %u\n", pnn));
+                               DEBUG(DEBUG_ERR, (__location__ " Unable to reread dbmap on node %u\n", pnn));
                                return -1;
                        }
                }
@@ -462,7 +462,7 @@ static int pull_one_remote_database(struct ctdb_context *ctdb, uint32_t srcnode,
        ret = ctdb_ctrl_pulldb(ctdb, srcnode, dbid, CTDB_LMASTER_ANY, tmp_ctx,
                               CONTROL_TIMEOUT(), &outdata);
        if (ret != 0) {
-               DEBUG(0,(__location__ " Unable to copy db from node %u\n", srcnode));
+               DEBUG(DEBUG_ERR,(__location__ " Unable to copy db from node %u\n", srcnode));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -470,7 +470,7 @@ static int pull_one_remote_database(struct ctdb_context *ctdb, uint32_t srcnode,
        reply = (struct ctdb_control_pulldb_reply *)outdata.dptr;
 
        if (outdata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
-               DEBUG(0,(__location__ " invalid data in pulldb reply\n"));
+               DEBUG(DEBUG_ERR,(__location__ " invalid data in pulldb reply\n"));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -492,7 +492,7 @@ static int pull_one_remote_database(struct ctdb_context *ctdb, uint32_t srcnode,
                hdr = (struct ctdb_ltdb_header *)data.dptr;
 
                if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
-                       DEBUG(0,(__location__ " bad ltdb record\n"));
+                       DEBUG(DEBUG_CRIT,(__location__ " bad ltdb record\n"));
                        talloc_free(tmp_ctx);
                        return -1;
                }
@@ -503,7 +503,7 @@ static int pull_one_remote_database(struct ctdb_context *ctdb, uint32_t srcnode,
                if (existing.dptr != NULL) {
                        struct ctdb_ltdb_header header;
                        if (existing.dsize < sizeof(struct ctdb_ltdb_header)) {
-                               DEBUG(0,(__location__ " Bad record size %u from node %u\n", 
+                               DEBUG(DEBUG_CRIT,(__location__ " Bad record size %u from node %u\n", 
                                         (unsigned)existing.dsize, srcnode));
                                free(existing.dptr);
                                talloc_free(tmp_ctx);
@@ -518,7 +518,7 @@ static int pull_one_remote_database(struct ctdb_context *ctdb, uint32_t srcnode,
                }
                
                if (tdb_store(recdb->tdb, key, data, TDB_REPLACE) != 0) {
-                       DEBUG(0,(__location__ " Failed to store record\n"));
+                       DEBUG(DEBUG_CRIT,(__location__ " Failed to store record\n"));
                        talloc_free(tmp_ctx);
                        return -1;                              
                }
@@ -546,7 +546,7 @@ static int pull_remote_database(struct ctdb_context *ctdb, struct ctdb_node_map
                        continue;
                }
                if (pull_one_remote_database(ctdb, nodemap->nodes[j].pnn, recdb, dbid) != 0) {
-                       DEBUG(0,(__location__ " Failed to pull remote database from node %u\n", 
+                       DEBUG(DEBUG_ERR,(__location__ " Failed to pull remote database from node %u\n", 
                                 nodemap->nodes[j].pnn));
                        return -1;
                }
@@ -598,7 +598,7 @@ static int update_vnnmap_on_all_nodes(struct ctdb_context *ctdb, struct ctdb_nod
 
                ret = ctdb_ctrl_setvnnmap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, mem_ctx, vnnmap);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to set vnnmap for node %u\n", pnn));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to set vnnmap for node %u\n", pnn));
                        return -1;
                }
        }
@@ -618,17 +618,17 @@ static void ban_handler(struct ctdb_context *ctdb, uint64_t srvid,
        TALLOC_CTX *mem_ctx = talloc_new(ctdb);
 
        if (data.dsize != sizeof(*b)) {
-               DEBUG(0,("Bad data in ban_handler\n"));
+               DEBUG(DEBUG_ERR,("Bad data in ban_handler\n"));
                talloc_free(mem_ctx);
                return;
        }
 
        if (b->pnn != ctdb->pnn) {
-               DEBUG(0,("Got a ban request for pnn:%u but our pnn is %u. Ignoring ban request\n", b->pnn, ctdb->pnn));
+               DEBUG(DEBUG_ERR,("Got a ban request for pnn:%u but our pnn is %u. Ignoring ban request\n", b->pnn, ctdb->pnn));
                return;
        }
 
-       DEBUG(0,("Node %u has been banned for %u seconds\n", 
+       DEBUG(DEBUG_NOTICE,("Node %u has been banned for %u seconds\n", 
                 b->pnn, b->ban_time));
 
        ctdb_ban_node(rec, b->pnn, b->ban_time);
@@ -646,18 +646,18 @@ static void unban_handler(struct ctdb_context *ctdb, uint64_t srvid,
        uint32_t pnn;
 
        if (data.dsize != sizeof(uint32_t)) {
-               DEBUG(0,("Bad data in unban_handler\n"));
+               DEBUG(DEBUG_ERR,("Bad data in unban_handler\n"));
                talloc_free(mem_ctx);
                return;
        }
        pnn = *(uint32_t *)data.dptr;
 
        if (pnn != ctdb->pnn) {
-               DEBUG(0,("Got an unban request for pnn:%u but our pnn is %u. Ignoring unban request\n", pnn, ctdb->pnn));
+               DEBUG(DEBUG_ERR,("Got an unban request for pnn:%u but our pnn is %u. Ignoring unban request\n", pnn, ctdb->pnn));
                return;
        }
 
-       DEBUG(0,("Node %u has been unbanned.\n", pnn));
+       DEBUG(DEBUG_NOTICE,("Node %u has been unbanned.\n", pnn));
        ctdb_unban_node(rec, pnn);
        talloc_free(mem_ctx);
 }
@@ -740,7 +740,7 @@ static void vacuum_fetch_next(struct vacuum_info *v)
                state = ctdb_call_send(v->ctdb_db, &call);
                tdb_chainunlock(v->ctdb_db->ltdb->tdb, call.key);
                if (state == NULL) {
-                       DEBUG(0,(__location__ " Failed to setup vacuum fetch call\n"));
+                       DEBUG(DEBUG_ERR,(__location__ " Failed to setup vacuum fetch call\n"));
                        talloc_free(v);
                        return;
                }
@@ -800,7 +800,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        /* work out if the database is persistent */
        ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &dbmap);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to get dbids from local node\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from local node\n"));
                talloc_free(tmp_ctx);
                return;
        }
@@ -812,14 +812,14 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
                }
        }
        if (i == dbmap->num) {
-               DEBUG(0, (__location__ " Unable to find db_id 0x%x on local node\n", recs->db_id));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to find db_id 0x%x on local node\n", recs->db_id));
                talloc_free(tmp_ctx);
                return;         
        }
 
        /* find the name of this database */
        if (ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, recs->db_id, tmp_ctx, &name) != 0) {
-               DEBUG(0,(__location__ " Failed to get name of db 0x%x\n", recs->db_id));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", recs->db_id));
                talloc_free(tmp_ctx);
                return;
        }
@@ -827,14 +827,14 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        /* attach to it */
        ctdb_db = ctdb_attach(ctdb, name, persistent);
        if (ctdb_db == NULL) {
-               DEBUG(0,(__location__ " Failed to attach to database '%s'\n", name));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
                talloc_free(tmp_ctx);
                return;
        }
 
        v = talloc_zero(rec, struct vacuum_info);
        if (v == NULL) {
-               DEBUG(0,(__location__ " Out of memory\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " Out of memory\n"));
                return;
        }
 
@@ -843,7 +843,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        v->ctdb_db = ctdb_db;
        v->recs = talloc_memdup(v, recs, data.dsize);
        if (v->recs == NULL) {
-               DEBUG(0,(__location__ " Out of memory\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " Out of memory\n"));
                talloc_free(v);
                return;         
        }
@@ -947,7 +947,7 @@ static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map *n
                ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
                                           mem_ctx, &remote_nodemap);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to get nodemap from remote node %u\n", 
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from remote node %u\n", 
                                  nodemap->nodes[j].pnn));
                        ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
                        talloc_free(mem_ctx);
@@ -977,7 +977,7 @@ static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map *n
                        /* Update our local copy of the flags in the recovery
                           daemon.
                        */
-                       DEBUG(0,("Remote node %u had flags 0x%x, local had 0x%x - updating local\n",
+                       DEBUG(DEBUG_NOTICE,("Remote node %u had flags 0x%x, local had 0x%x - updating local\n",
                                 nodemap->nodes[j].pnn, remote_nodemap->nodes[j].flags,
                                 nodemap->nodes[j].flags));
                        nodemap->nodes[j].flags = remote_nodemap->nodes[j].flags;
@@ -986,7 +986,7 @@ static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map *n
                           this is a good reason to do a new election.
                         */
                        if ((c.old_flags ^ c.new_flags) & NODE_FLAGS_BANNED) {
-                               DEBUG(0,("Remote node %u had different BANNED flags 0x%x, local had 0x%x - trigger a re-election\n",
+                               DEBUG(DEBUG_NOTICE,("Remote node %u had different BANNED flags 0x%x, local had 0x%x - trigger a re-election\n",
                                 nodemap->nodes[j].pnn, c.new_flags,
                                 c.old_flags));
                                talloc_free(mem_ctx);
@@ -1037,7 +1037,7 @@ static struct tdb_wrap *create_recdb(struct ctdb_context *ctdb, TALLOC_CTX *mem_
        recdb = tdb_wrap_open(mem_ctx, name, ctdb->tunable.database_hash_size, 
                              TDB_NOLOCK, O_RDWR|O_CREAT|O_EXCL, 0600);
        if (recdb == NULL) {
-               DEBUG(0,(__location__ " Failed to create temp recovery database '%s'\n", name));
+               DEBUG(DEBUG_CRIT,(__location__ " Failed to create temp recovery database '%s'\n", name));
        }
 
        talloc_free(name);
@@ -1079,7 +1079,7 @@ static int traverse_recdb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
        }
        params->recdata = talloc_realloc_size(NULL, params->recdata, rec->length + params->len);
        if (params->recdata == NULL) {
-               DEBUG(0,(__location__ " Failed to expand recdata to %u (%u records)\n", 
+               DEBUG(DEBUG_CRIT,(__location__ " Failed to expand recdata to %u (%u records)\n", 
                         rec->length + params->len, params->recdata->count));
                params->failed = true;
                return -1;
@@ -1117,14 +1117,14 @@ static int push_recdb_database(struct ctdb_context *ctdb, uint32_t dbid,
        params.failed = false;
 
        if (tdb_traverse_read(recdb->tdb, traverse_recdb, &params) == -1) {
-               DEBUG(0,(__location__ " Failed to traverse recdb database\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to traverse recdb database\n"));
                talloc_free(params.recdata);
                talloc_free(tmp_ctx);
                return -1;
        }
 
        if (params.failed) {
-               DEBUG(0,(__location__ " Failed to traverse recdb database\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to traverse recdb database\n"));
                talloc_free(params.recdata);
                talloc_free(tmp_ctx);
                return -1;              
@@ -1138,7 +1138,7 @@ static int push_recdb_database(struct ctdb_context *ctdb, uint32_t dbid,
        if (ctdb_client_async_control(ctdb, CTDB_CONTROL_PUSH_DB,
                        list_of_active_nodes(ctdb, nodemap, tmp_ctx, true),
                        CONTROL_TIMEOUT(), false, outdata) != 0) {
-               DEBUG(0,(__location__ " Failed to push recdb records to nodes for db 0x%x\n", dbid));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to push recdb records to nodes for db 0x%x\n", dbid));
                talloc_free(recdata);
                talloc_free(tmp_ctx);
                return -1;
@@ -1178,7 +1178,7 @@ static int recover_database(struct ctdb_recoverd *rec,
        /* pull all remote databases onto the recdb */
        ret = pull_remote_database(ctdb, nodemap, recdb, dbid);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to pull remote database 0x%x\n", dbid));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to pull remote database 0x%x\n", dbid));
                return -1;
        }
 
@@ -1194,7 +1194,7 @@ static int recover_database(struct ctdb_recoverd *rec,
        if (ctdb_client_async_control(ctdb, CTDB_CONTROL_WIPE_DATABASE,
                        list_of_active_nodes(ctdb, nodemap, recdb, true),
                        CONTROL_TIMEOUT(), false, data) != 0) {
-               DEBUG(0, (__location__ " Unable to wipe database. Recovery failed.\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to wipe database. Recovery failed.\n"));
                talloc_free(recdb);
                return -1;
        }
@@ -1236,7 +1236,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
        ctdb_set_culprit(rec, culprit);
 
        if (rec->culprit_counter > 2*nodemap->num) {
-               DEBUG(0,("Node %u has caused %u recoveries in %.0f seconds - banning it for %u seconds\n",
+               DEBUG(DEBUG_NOTICE,("Node %u has caused %u recoveries in %.0f seconds - banning it for %u seconds\n",
                         culprit, rec->culprit_counter, timeval_elapsed(&rec->first_recover_time),
                         ctdb->tunable.recovery_ban_period));
                ctdb_ban_node(rec, culprit, ctdb->tunable.recovery_ban_period);
@@ -1244,7 +1244,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
 
        if (!ctdb_recovery_lock(ctdb, true)) {
                ctdb_set_culprit(rec, pnn);
-               DEBUG(0,("Unable to get recovery lock - aborting recovery\n"));
+               DEBUG(DEBUG_ERR,("Unable to get recovery lock - aborting recovery\n"));
                return -1;
        }
 
@@ -1253,7 +1253,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
        /* get a list of all databases */
        ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, &dbmap);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to get dbids from node :%u\n", pnn));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from node :%u\n", pnn));
                return -1;
        }
 
@@ -1263,14 +1263,14 @@ static int do_recovery(struct ctdb_recoverd *rec,
        /* verify that we have all the databases any other node has */
        ret = create_missing_local_databases(ctdb, nodemap, pnn, &dbmap, mem_ctx);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to create missing local databases\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to create missing local databases\n"));
                return -1;
        }
 
        /* verify that all other nodes have all our databases */
        ret = create_missing_remote_databases(ctdb, nodemap, pnn, dbmap, mem_ctx);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to create missing remote databases\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to create missing remote databases\n"));
                return -1;
        }
 
@@ -1280,14 +1280,14 @@ static int do_recovery(struct ctdb_recoverd *rec,
        /* set recovery mode to active on all nodes */
        ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
        if (ret!=0) {
-               DEBUG(0, (__location__ " Unable to set recovery mode to active on cluster\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to active on cluster\n"));
                return -1;
        }
 
        /* execute the "startrecovery" event script on all nodes */
        ret = run_startrecovery_eventscript(ctdb, nodemap);
        if (ret!=0) {
-               DEBUG(0, (__location__ " Unable to run the 'startrecovery' event on cluster\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'startrecovery' event on cluster\n"));
                return -1;
        }
 
@@ -1307,7 +1307,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
        vnnmap->generation = generation;
        ret = ctdb_ctrl_setvnnmap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, vnnmap);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to set vnnmap for node %u\n", pnn));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to set vnnmap for node %u\n", pnn));
                return -1;
        }
 
@@ -1317,7 +1317,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
        if (ctdb_client_async_control(ctdb, CTDB_CONTROL_TRANSACTION_START,
                        list_of_active_nodes(ctdb, nodemap, mem_ctx, true),
                        CONTROL_TIMEOUT(), false, data) != 0) {
-               DEBUG(0, (__location__ " Unable to start transactions. Recovery failed.\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to start transactions. Recovery failed.\n"));
                return -1;
        }
 
@@ -1325,7 +1325,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
 
        for (i=0;i<dbmap->num;i++) {
                if (recover_database(rec, mem_ctx, dbmap->dbs[i].dbid, pnn, nodemap, generation) != 0) {
-                       DEBUG(0, (__location__ " Failed to recover database 0x%x\n", dbmap->dbs[i].dbid));
+                       DEBUG(DEBUG_ERR, (__location__ " Failed to recover database 0x%x\n", dbmap->dbs[i].dbid));
                        return -1;
                }
        }
@@ -1336,7 +1336,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
        if (ctdb_client_async_control(ctdb, CTDB_CONTROL_TRANSACTION_COMMIT,
                        list_of_active_nodes(ctdb, nodemap, mem_ctx, true),
                        CONTROL_TIMEOUT(), false, data) != 0) {
-               DEBUG(0, (__location__ " Unable to commit recovery changes. Recovery failed.\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to commit recovery changes. Recovery failed.\n"));
                return -1;
        }
 
@@ -1360,7 +1360,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
        /* update to the new vnnmap on all nodes */
        ret = update_vnnmap_on_all_nodes(ctdb, nodemap, pnn, vnnmap, mem_ctx);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to update vnnmap on all nodes\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to update vnnmap on all nodes\n"));
                return -1;
        }
 
@@ -1369,7 +1369,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
        /* update recmaster to point to us for all nodes */
        ret = set_recovery_master(ctdb, nodemap, pnn);
        if (ret!=0) {
-               DEBUG(0, (__location__ " Unable to set recovery master\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery master\n"));
                return -1;
        }
 
@@ -1380,7 +1380,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
         */
        ret = update_flags_on_all_nodes(ctdb, nodemap);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to update flags on all nodes\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to update flags on all nodes\n"));
                return -1;
        }
        
@@ -1393,7 +1393,7 @@ static int do_recovery(struct ctdb_recoverd *rec,
                rec->need_takeover_run = false;
                ret = ctdb_takeover_run(ctdb, nodemap);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to setup public takeover addresses\n"));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to setup public takeover addresses\n"));
                        return -1;
                }
                DEBUG(DEBUG_INFO, (__location__ " Recovery - done takeover\n"));
@@ -1402,14 +1402,14 @@ static int do_recovery(struct ctdb_recoverd *rec,
        /* execute the "recovered" event script on all nodes */
        ret = run_recovered_eventscript(ctdb, nodemap);
        if (ret!=0) {
-               DEBUG(0, (__location__ " Unable to run the 'recovered' event on cluster\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'recovered' event on cluster\n"));
                return -1;
        }
 
        /* disable recovery mode */
        ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_NORMAL);
        if (ret!=0) {
-               DEBUG(0, (__location__ " Unable to set recovery mode to normal on cluster\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to normal on cluster\n"));
                return -1;
        }
 
@@ -1461,7 +1461,7 @@ static void ctdb_election_data(struct ctdb_recoverd *rec, struct election_messag
 
        ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, rec, &nodemap);
        if (ret != 0) {
-               DEBUG(0,(__location__ " unable to get election data\n"));
+               DEBUG(DEBUG_ERR,(__location__ " unable to get election data\n"));
                return;
        }
 
@@ -1534,7 +1534,7 @@ static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn)
         */
        ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), pnn, pnn);
        if (ret != 0) {
-               DEBUG(0, (__location__ " failed to send recmaster election request\n"));
+               DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request\n"));
                return -1;
        }
 
@@ -1556,7 +1556,7 @@ static void unban_all_nodes(struct ctdb_context *ctdb)
        
        ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &nodemap);
        if (ret != 0) {
-               DEBUG(0,(__location__ " failed to get nodemap to unban all nodes\n"));
+               DEBUG(DEBUG_ERR,(__location__ " failed to get nodemap to unban all nodes\n"));
                return;
        }
 
@@ -1581,7 +1581,7 @@ static void election_send_request(struct event_context *ev, struct timed_event *
 
        ret = send_election_request(rec, ctdb_get_pnn(rec->ctdb));
        if (ret != 0) {
-               DEBUG(0,("Failed to send election request!\n"));
+               DEBUG(DEBUG_ERR,("Failed to send election request!\n"));
        }
 
        talloc_free(rec->send_election_te);
@@ -1637,7 +1637,7 @@ static void election_handler(struct ctdb_context *ctdb, uint64_t srvid,
        /* ok, let that guy become recmaster then */
        ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), ctdb_get_pnn(ctdb), em->pnn);
        if (ret != 0) {
-               DEBUG(0, (__location__ " failed to send recmaster election request"));
+               DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request"));
                talloc_free(mem_ctx);
                return;
        }
@@ -1665,7 +1665,7 @@ static void force_election(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx, uint3
        /* set all nodes to recovery mode to stop all internode traffic */
        ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
        if (ret!=0) {
-               DEBUG(0, (__location__ " Unable to set recovery mode to active on cluster\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to active on cluster\n"));
                return;
        }
 
@@ -1676,7 +1676,7 @@ static void force_election(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx, uint3
 
        ret = send_election_request(rec, pnn);
        if (ret!=0) {
-               DEBUG(0, (__location__ " failed to initiate recmaster election"));
+               DEBUG(DEBUG_ERR, (__location__ " failed to initiate recmaster election"));
                return;
        }
 
@@ -1701,7 +1701,7 @@ static void monitor_handler(struct ctdb_context *ctdb, uint64_t srvid,
        struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd);
 
        if (data.dsize != sizeof(*c)) {
-               DEBUG(0,(__location__ "Invalid data in ctdb_node_flag_change\n"));
+               DEBUG(DEBUG_ERR,(__location__ "Invalid data in ctdb_node_flag_change\n"));
                return;
        }
 
@@ -1710,7 +1710,7 @@ static void monitor_handler(struct ctdb_context *ctdb, uint64_t srvid,
 
        ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &nodemap);
        if (ret != 0) {
-               DEBUG(0,(__location__ "ctdb_ctrl_getnodemap failed in monitor_handler\n"));
+               DEBUG(DEBUG_ERR,(__location__ "ctdb_ctrl_getnodemap failed in monitor_handler\n"));
                talloc_free(tmp_ctx);
                return;         
        }
@@ -1721,7 +1721,7 @@ static void monitor_handler(struct ctdb_context *ctdb, uint64_t srvid,
        }
 
        if (i == nodemap->num) {
-               DEBUG(0,(__location__ "Flag change for non-existant node %u\n", c->pnn));
+               DEBUG(DEBUG_CRIT,(__location__ "Flag change for non-existant node %u\n", c->pnn));
                talloc_free(tmp_ctx);
                return;
        }
@@ -1738,7 +1738,7 @@ static void monitor_handler(struct ctdb_context *ctdb, uint64_t srvid,
        }
 
        if (nodemap->nodes[i].flags != c->new_flags) {
-               DEBUG(0,("Node %u has changed flags - now 0x%x  was 0x%x\n", c->pnn, c->new_flags, c->old_flags));
+               DEBUG(DEBUG_NOTICE,("Node %u has changed flags - now 0x%x  was 0x%x\n", c->pnn, c->new_flags, c->old_flags));
        }
 
        nodemap->nodes[i].flags = c->new_flags;
@@ -1799,7 +1799,7 @@ static void verify_recmode_normal_callback(struct ctdb_client_control_state *sta
           status field
        */
        if (state->status != CTDB_RECOVERY_NORMAL) {
-               DEBUG(0, (__location__ " Node:%u was in recovery mode. Restart recovery process\n", state->c->hdr.destnode));
+               DEBUG(DEBUG_NOTICE, (__location__ " Node:%u was in recovery mode. Restart recovery process\n", state->c->hdr.destnode));
                rmdata->status = MONITOR_RECOVERY_NEEDED;
        }
 
@@ -1834,7 +1834,7 @@ static enum monitor_result verify_recmode(struct ctdb_context *ctdb, struct ctdb
                        /* we failed to send the control, treat this as 
                           an error and try again next iteration
                        */                      
-                       DEBUG(0,("Failed to call ctdb_ctrl_getrecmode_send during monitoring\n"));
+                       DEBUG(DEBUG_ERR,("Failed to call ctdb_ctrl_getrecmode_send during monitoring\n"));
                        talloc_free(mem_ctx);
                        return MONITOR_FAILED;
                }
@@ -1889,7 +1889,7 @@ static void verify_recmaster_callback(struct ctdb_client_control_state *state)
           status field
        */
        if (state->status != rmdata->pnn) {
-               DEBUG(0,("Node %d does not agree we are the recmaster. Need a new recmaster election\n", state->c->hdr.destnode));
+               DEBUG(DEBUG_ERR,("Node %d does not agree we are the recmaster. Need a new recmaster election\n", state->c->hdr.destnode));
                rmdata->status = MONITOR_ELECTION_NEEDED;
        }
 
@@ -1925,7 +1925,7 @@ static enum monitor_result verify_recmaster(struct ctdb_context *ctdb, struct ct
                        /* we failed to send the control, treat this as 
                           an error and try again next iteration
                        */                      
-                       DEBUG(0,("Failed to call ctdb_ctrl_getrecmaster_send during monitoring\n"));
+                       DEBUG(DEBUG_ERR,("Failed to call ctdb_ctrl_getrecmaster_send during monitoring\n"));
                        talloc_free(mem_ctx);
                        return MONITOR_FAILED;
                }
@@ -1968,7 +1968,7 @@ static void monitor_cluster(struct ctdb_context *ctdb)
        struct ctdb_all_public_ips *ips;
        char c;
 
-       DEBUG(0,("monitor_cluster starting\n"));
+       DEBUG(DEBUG_NOTICE,("monitor_cluster starting\n"));
 
        rec = talloc_zero(ctdb, struct ctdb_recoverd);
        CTDB_NO_MEMORY_FATAL(ctdb, rec);
@@ -2001,7 +2001,7 @@ again:
        }
        mem_ctx = talloc_new(ctdb);
        if (!mem_ctx) {
-               DEBUG(0,("Failed to create temporary context\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " Failed to create temporary context\n"));
                exit(-1);
        }
 
@@ -2010,7 +2010,7 @@ again:
 
        /* verify that the main daemon is still running */
        if (kill(ctdb->ctdbd_pid, 0) != 0) {
-               DEBUG(0,("CTDB daemon is no longer available. Shutting down recovery daemon\n"));
+               DEBUG(DEBUG_CRIT,("CTDB daemon is no longer available. Shutting down recovery daemon\n"));
                exit(-1);
        }
 
@@ -2025,7 +2025,7 @@ again:
           map from the local node. thats why we have the hardcoded value 20
        */
        if (rec->culprit_counter > 20) {
-               DEBUG(0,("Node %u has caused %u failures in %.0f seconds - banning it for %u seconds\n",
+               DEBUG(DEBUG_NOTICE,("Node %u has caused %u failures in %.0f seconds - banning it for %u seconds\n",
                         rec->last_culprit, rec->culprit_counter, timeval_elapsed(&rec->first_recover_time),
                         ctdb->tunable.recovery_ban_period));
                ctdb_ban_node(rec, rec->last_culprit, ctdb->tunable.recovery_ban_period);
@@ -2034,20 +2034,20 @@ again:
        /* get relevant tunables */
        ret = ctdb_ctrl_get_all_tunables(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, &ctdb->tunable);
        if (ret != 0) {
-               DEBUG(0,("Failed to get tunables - retrying\n"));
+               DEBUG(DEBUG_ERR,("Failed to get tunables - retrying\n"));
                goto again;
        }
 
        pnn = ctdb_ctrl_getpnn(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
        if (pnn == (uint32_t)-1) {
-               DEBUG(0,("Failed to get local pnn - retrying\n"));
+               DEBUG(DEBUG_ERR,("Failed to get local pnn - retrying\n"));
                goto again;
        }
 
        /* get the vnnmap */
        ret = ctdb_ctrl_getvnnmap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, &vnnmap);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to get vnnmap from node %u\n", pnn));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to get vnnmap from node %u\n", pnn));
                goto again;
        }
 
@@ -2055,19 +2055,19 @@ again:
        /* get number of nodes */
        ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, &nodemap);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to get nodemap from node %u\n", pnn));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from node %u\n", pnn));
                goto again;
        }
 
        /* check which node is the recovery master */
        ret = ctdb_ctrl_getrecmaster(ctdb, mem_ctx, CONTROL_TIMEOUT(), pnn, &recmaster);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to get recmaster from node %u\n", pnn));
+               DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from node %u\n", pnn));
                goto again;
        }
 
        if (recmaster == (uint32_t)-1) {
-               DEBUG(0,(__location__ " Initial recovery master set - forcing election\n"));
+               DEBUG(DEBUG_NOTICE,(__location__ " Initial recovery master set - forcing election\n"));
                force_election(rec, mem_ctx, pnn, nodemap);
                goto again;
        }
@@ -2078,11 +2078,11 @@ again:
        if (nodemap->nodes[pnn].flags & NODE_FLAGS_BANNED) {
                if (rec->banned_nodes[pnn] == NULL) {
                        if (recmaster == pnn) {
-                               DEBUG(0,("Local ctdb daemon on recmaster thinks this node is BANNED but the recovery master disagrees. Unbanning the node\n"));
+                               DEBUG(DEBUG_NOTICE,("Local ctdb daemon on recmaster thinks this node is BANNED but the recovery master disagrees. Unbanning the node\n"));
 
                                ctdb_unban_node(rec, pnn);
                        } else {
-                               DEBUG(0,("Local ctdb daemon on non-recmaster thinks this node is BANNED but the recovery master disagrees. Re-banning the node\n"));
+                               DEBUG(DEBUG_NOTICE,("Local ctdb daemon on non-recmaster thinks this node is BANNED but the recovery master disagrees. Re-banning the node\n"));
                                ctdb_ban_node(rec, pnn, ctdb->tunable.recovery_ban_period);
                                ctdb_set_culprit(rec, pnn);
                        }
@@ -2091,11 +2091,11 @@ again:
        } else {
                if (rec->banned_nodes[pnn] != NULL) {
                        if (recmaster == pnn) {
-                               DEBUG(0,("Local ctdb daemon on recmaster does not think this node is BANNED but the recovery master disagrees. Unbanning the node\n"));
+                               DEBUG(DEBUG_NOTICE,("Local ctdb daemon on recmaster does not think this node is BANNED but the recovery master disagrees. Unbanning the node\n"));
 
                                ctdb_unban_node(rec, pnn);
                        } else {
-                               DEBUG(0,("Local ctdb daemon on non-recmaster does not think this node is BANNED but the recovery master disagrees. Re-banning the node\n"));
+                               DEBUG(DEBUG_NOTICE,("Local ctdb daemon on non-recmaster does not think this node is BANNED but the recovery master disagrees. Re-banning the node\n"));
 
                                ctdb_ban_node(rec, pnn, ctdb->tunable.recovery_ban_period);
                                ctdb_set_culprit(rec, pnn);
@@ -2124,14 +2124,14 @@ again:
        }
 
        if (j == nodemap->num) {
-               DEBUG(0, ("Recmaster node %u not in list. Force reelection\n", recmaster));
+               DEBUG(DEBUG_ERR, ("Recmaster node %u not in list. Force reelection\n", recmaster));
                force_election(rec, mem_ctx, pnn, nodemap);
                goto again;
        }
 
        /* if recovery master is disconnected we must elect a new recmaster */
        if (nodemap->nodes[j].flags & NODE_FLAGS_DISCONNECTED) {
-               DEBUG(0, ("Recmaster node %u is disconnected. Force reelection\n", nodemap->nodes[j].pnn));
+               DEBUG(DEBUG_NOTICE, ("Recmaster node %u is disconnected. Force reelection\n", nodemap->nodes[j].pnn));
                force_election(rec, mem_ctx, pnn, nodemap);
                goto again;
        }
@@ -2140,14 +2140,14 @@ again:
        ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
                                   mem_ctx, &remote_nodemap);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Unable to get nodemap from recovery master %u\n", 
+               DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from recovery master %u\n", 
                          nodemap->nodes[j].pnn));
                goto again;
        }
 
 
        if (remote_nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
-               DEBUG(0, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].pnn));
+               DEBUG(DEBUG_NOTICE, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].pnn));
                force_election(rec, mem_ctx, pnn, nodemap);
                goto again;
        }
@@ -2156,7 +2156,7 @@ again:
        if (ctdb->vnn != NULL) {
                ret = ctdb_ctrl_get_public_ips(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, mem_ctx, &ips);
                if (ret != 0) {
-                       DEBUG(0, ("Unable to get public ips from node %u\n", i));
+                       DEBUG(DEBUG_ERR, ("Unable to get public ips from node %u\n", i));
                        goto again;
                }
                for (j=0; j<ips->num; j++) {
@@ -2168,29 +2168,29 @@ again:
                        */
                        if (ips->ips[j].pnn == pnn) {
                                if (!ctdb_sys_have_ip(ips->ips[j].sin)) {
-                                       DEBUG(0,("Public address '%s' is missing and we should serve this ip\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
+                                       DEBUG(DEBUG_CRIT,("Public address '%s' is missing and we should serve this ip\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
                                        ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
                                        if (ret != 0) {
-                                               DEBUG(0,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
+                                               DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
                                                goto again;
                                        }
                                        ret = ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
                                        if (ret != 0) {
-                                               DEBUG(0,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
+                                               DEBUG(DEBUG_ERR,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
                                                goto again;
                                        }
                                }
                        } else {
                                if (ctdb_sys_have_ip(ips->ips[j].sin)) {
-                                       DEBUG(0,("We are still serving a public address '%s' that we should not be serving.\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
+                                       DEBUG(DEBUG_CRIT,("We are still serving a public address '%s' that we should not be serving.\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
                                        ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
                                        if (ret != 0) {
-                                               DEBUG(0,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
+                                               DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
                                                goto again;
                                        }
                                        ret = ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
                                        if (ret != 0) {
-                                               DEBUG(0,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
+                                               DEBUG(DEBUG_ERR,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
                                                goto again;
                                        }
                                }
@@ -2209,12 +2209,12 @@ again:
        /* ensure our local copies of flags are right */
        ret = update_local_flags(rec, nodemap);
        if (ret == MONITOR_ELECTION_NEEDED) {
-               DEBUG(0,("update_local_flags() called for a re-election.\n"));
+               DEBUG(DEBUG_NOTICE,("update_local_flags() called for a re-election.\n"));
                force_election(rec, mem_ctx, pnn, nodemap);
                goto again;
        }
        if (ret != MONITOR_OK) {
-               DEBUG(0,("Unable to update local flags\n"));
+               DEBUG(DEBUG_ERR,("Unable to update local flags\n"));
                goto again;
        }
 
@@ -2235,7 +2235,7 @@ again:
                        ctdb->nodes[j]->pnn, 
                        ctdb->nodes,
                        &ctdb->nodes[j]->public_ips)) {
-                       DEBUG(0,("Failed to read public ips from node : %u\n", 
+                       DEBUG(DEBUG_ERR,("Failed to read public ips from node : %u\n", 
                                ctdb->nodes[j]->pnn));
                        goto again;
                }
@@ -2281,13 +2281,13 @@ again:
 
        /* we should have the reclock - check its not stale */
        if (ctdb->recovery_lock_fd == -1) {
-               DEBUG(0,("recovery master doesn't have the recovery lock\n"));
+               DEBUG(DEBUG_CRIT,("recovery master doesn't have the recovery lock\n"));
                do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, ctdb->pnn);
                goto again;
        }
 
        if (read(ctdb->recovery_lock_fd, &c, 1) == -1) {
-               DEBUG(0,("failed read from recovery_lock_fd - %s\n", strerror(errno)));
+               DEBUG(DEBUG_CRIT,("failed read from recovery_lock_fd - %s\n", strerror(errno)));
                close(ctdb->recovery_lock_fd);
                ctdb->recovery_lock_fd = -1;
                do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, ctdb->pnn);
@@ -2308,7 +2308,7 @@ again:
                ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
                                           mem_ctx, &remote_nodemap);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to get nodemap from remote node %u\n", 
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from remote node %u\n", 
                                  nodemap->nodes[j].pnn));
                        goto again;
                }
@@ -2317,7 +2317,7 @@ again:
                   then this is a good reason to try recovery
                 */
                if (remote_nodemap->num != nodemap->num) {
-                       DEBUG(0, (__location__ " Remote node:%u has different node count. %u vs %u of the local node\n",
+                       DEBUG(DEBUG_ERR, (__location__ " Remote node:%u has different node count. %u vs %u of the local node\n",
                                  nodemap->nodes[j].pnn, remote_nodemap->num, nodemap->num));
                        do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, nodemap->nodes[j].pnn);
                        goto again;
@@ -2328,7 +2328,7 @@ again:
                 */
                for (i=0;i<nodemap->num;i++) {
                        if (remote_nodemap->nodes[i].pnn != nodemap->nodes[i].pnn) {
-                               DEBUG(0, (__location__ " Remote node:%u has different nodemap pnn for %d (%u vs %u).\n", 
+                               DEBUG(DEBUG_ERR, (__location__ " Remote node:%u has different nodemap pnn for %d (%u vs %u).\n", 
                                          nodemap->nodes[j].pnn, i, 
                                          remote_nodemap->nodes[i].pnn, nodemap->nodes[i].pnn));
                                do_recovery(rec, mem_ctx, pnn, num_active, nodemap, 
@@ -2337,7 +2337,7 @@ again:
                        }
                        if ((remote_nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE) != 
                            (nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE)) {
-                               DEBUG(0, (__location__ " Remote node:%u has different nodemap flag for %d (0x%x vs 0x%x)\n", 
+                               DEBUG(DEBUG_ERR, (__location__ " Remote node:%u has different nodemap flag for %d (0x%x vs 0x%x)\n", 
                                          nodemap->nodes[j].pnn, i,
                                          remote_nodemap->nodes[i].flags, nodemap->nodes[i].flags));
                                do_recovery(rec, mem_ctx, pnn, num_active, nodemap, 
@@ -2353,7 +2353,7 @@ again:
           as there are active nodes or we will have to do a recovery
         */
        if (vnnmap->size != num_active) {
-               DEBUG(0, (__location__ " The vnnmap count is different from the number of active nodes. %u vs %u\n", 
+               DEBUG(DEBUG_ERR, (__location__ " The vnnmap count is different from the number of active nodes. %u vs %u\n", 
                          vnnmap->size, num_active));
                do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, ctdb->pnn);
                goto again;
@@ -2376,7 +2376,7 @@ again:
                        }
                }
                if (i == vnnmap->size) {
-                       DEBUG(0, (__location__ " Node %u is active in the nodemap but did not exist in the vnnmap\n", 
+                       DEBUG(DEBUG_ERR, (__location__ " Node %u is active in the nodemap but did not exist in the vnnmap\n", 
                                  nodemap->nodes[j].pnn));
                        do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, nodemap->nodes[j].pnn);
                        goto again;
@@ -2398,14 +2398,14 @@ again:
                ret = ctdb_ctrl_getvnnmap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
                                          mem_ctx, &remote_vnnmap);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to get vnnmap from remote node %u\n", 
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to get vnnmap from remote node %u\n", 
                                  nodemap->nodes[j].pnn));
                        goto again;
                }
 
                /* verify the vnnmap generation is the same */
                if (vnnmap->generation != remote_vnnmap->generation) {
-                       DEBUG(0, (__location__ " Remote node %u has different generation of vnnmap. %u vs %u (ours)\n", 
+                       DEBUG(DEBUG_ERR, (__location__ " Remote node %u has different generation of vnnmap. %u vs %u (ours)\n", 
                                  nodemap->nodes[j].pnn, remote_vnnmap->generation, vnnmap->generation));
                        do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, nodemap->nodes[j].pnn);
                        goto again;
@@ -2413,7 +2413,7 @@ again:
 
                /* verify the vnnmap size is the same */
                if (vnnmap->size != remote_vnnmap->size) {
-                       DEBUG(0, (__location__ " Remote node %u has different size of vnnmap. %u vs %u (ours)\n", 
+                       DEBUG(DEBUG_ERR, (__location__ " Remote node %u has different size of vnnmap. %u vs %u (ours)\n", 
                                  nodemap->nodes[j].pnn, remote_vnnmap->size, vnnmap->size));
                        do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, nodemap->nodes[j].pnn);
                        goto again;
@@ -2422,7 +2422,7 @@ again:
                /* verify the vnnmap is the same */
                for (i=0;i<vnnmap->size;i++) {
                        if (remote_vnnmap->map[i] != vnnmap->map[i]) {
-                               DEBUG(0, (__location__ " Remote node %u has different vnnmap.\n", 
+                               DEBUG(DEBUG_ERR, (__location__ " Remote node %u has different vnnmap.\n", 
                                          nodemap->nodes[j].pnn));
                                do_recovery(rec, mem_ctx, pnn, num_active, nodemap, 
                                            vnnmap, nodemap->nodes[j].pnn);
@@ -2438,14 +2438,14 @@ again:
                /* execute the "startrecovery" event script on all nodes */
                ret = run_startrecovery_eventscript(ctdb, nodemap);
                if (ret!=0) {
-                       DEBUG(0, (__location__ " Unable to run the 'startrecovery' event on cluster\n"));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'startrecovery' event on cluster\n"));
                        do_recovery(rec, mem_ctx, pnn, num_active, nodemap, 
                                    vnnmap, ctdb->pnn);
                }
 
                ret = ctdb_takeover_run(ctdb, nodemap);
                if (ret != 0) {
-                       DEBUG(0, (__location__ " Unable to setup public takeover addresses - starting recovery\n"));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to setup public takeover addresses - starting recovery\n"));
                        do_recovery(rec, mem_ctx, pnn, num_active, nodemap, 
                                    vnnmap, ctdb->pnn);
                }
@@ -2453,7 +2453,7 @@ again:
                /* execute the "recovered" event script on all nodes */
                ret = run_recovered_eventscript(ctdb, nodemap);
                if (ret!=0) {
-                       DEBUG(0, (__location__ " Unable to run the 'recovered' event on cluster\n"));
+                       DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'recovered' event on cluster\n"));
                        do_recovery(rec, mem_ctx, pnn, num_active, nodemap, 
                                    vnnmap, ctdb->pnn);
                }
@@ -2469,7 +2469,7 @@ again:
 static void ctdb_recoverd_parent(struct event_context *ev, struct fd_event *fde, 
                                 uint16_t flags, void *private_data)
 {
-       DEBUG(0,("recovery daemon parent died - exiting\n"));
+       DEBUG(DEBUG_ALERT,("recovery daemon parent died - exiting\n"));
        _exit(1);
 }
 
@@ -2522,13 +2522,13 @@ int ctdb_start_recoverd(struct ctdb_context *ctdb)
        /* initialise ctdb */
        ret = ctdb_socket_connect(ctdb);
        if (ret != 0) {
-               DEBUG(0, (__location__ " Failed to init ctdb\n"));
+               DEBUG(DEBUG_ALERT, (__location__ " Failed to init ctdb\n"));
                exit(1);
        }
 
        monitor_cluster(ctdb);
 
-       DEBUG(0,("ERROR: ctdb_recoverd finished!?\n"));
+       DEBUG(DEBUG_ALERT,("ERROR: ctdb_recoverd finished!?\n"));
        return -1;
 }
 
@@ -2541,6 +2541,6 @@ void ctdb_stop_recoverd(struct ctdb_context *ctdb)
                return;
        }
 
-       DEBUG(0,("Shutting down recovery daemon\n"));
+       DEBUG(DEBUG_NOTICE,("Shutting down recovery daemon\n"));
        kill(ctdb->recoverd_pid, SIGTERM);
 }
index f3b1035c4232fe536b72e5714cbc9930af7e2f5e..d97e3cbc4f4e33767c29c507adc5b5954d879554 100644 (file)
@@ -230,7 +230,7 @@ void ctdb_input_pkt(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
        case CTDB_REPLY_DMASTER:
                /* we dont allow these calls when banned */
                if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_BANNED) {
-                       DEBUG(0,(__location__ " ctdb operation %u"
+                       DEBUG(DEBUG_DEBUG,(__location__ " ctdb operation %u"
                                " request %u"
                                " length %u from node %u to %u while node"
                                " is banned\n",
@@ -245,7 +245,7 @@ void ctdb_input_pkt(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
                   same generation instance as this node
                */
                if (ctdb->vnn_map->generation != hdr->generation) {
-                       DEBUG(0,(__location__ " ctdb operation %u"
+                       DEBUG(DEBUG_DEBUG,(__location__ " ctdb operation %u"
                                " request %u"
                                " length %u from node %u to %u had an"
                                " invalid generation id:%u while our"
@@ -304,7 +304,7 @@ void ctdb_input_pkt(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
                break;
 
        default:
-               DEBUG(0,("%s: Packet with unknown operation %u\n", 
+               DEBUG(DEBUG_CRIT,("%s: Packet with unknown operation %u\n", 
                         __location__, hdr->operation));
                break;
        }
@@ -330,7 +330,7 @@ void ctdb_node_dead(struct ctdb_node *node)
        node->rx_cnt = 0;
        node->dead_count = 0;
 
-       DEBUG(0,("%s: node %s is dead: %u connected\n", 
+       DEBUG(DEBUG_NOTICE,("%s: node %s is dead: %u connected\n", 
                 node->ctdb->name, node->name, node->ctdb->num_connected));
        ctdb_daemon_cancel_controls(node->ctdb, node);
 
@@ -382,13 +382,13 @@ static void ctdb_defer_packet(struct ctdb_context *ctdb, struct ctdb_req_header
        struct queue_next *q;
        q = talloc(ctdb, struct queue_next);
        if (q == NULL) {
-               DEBUG(0,(__location__ " Failed to allocate deferred packet\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to allocate deferred packet\n"));
                return;
        }
        q->ctdb = ctdb;
        q->hdr = talloc_memdup(ctdb, hdr, hdr->length);
        if (q->hdr == NULL) {
-               DEBUG(0,("Error copying deferred packet to self\n"));
+               DEBUG(DEBUG_ERR,("Error copying deferred packet to self\n"));
                return;
        }
 #if 0
@@ -463,7 +463,7 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
        ctdb->statistics.node_packets_sent++;
 
        if (!ctdb_validate_pnn(ctdb, hdr->destnode)) {
-               DEBUG(0,(__location__ " cant send to node %u that does not exist\n", 
+               DEBUG(DEBUG_CRIT,(__location__ " cant send to node %u that does not exist\n", 
                         hdr->destnode));
                return;
        }
index 17380f1a9e84be36146f685a0d53b01d5dc1b9c1..4ed3012a30fa6b81be0afd6be38db3b4d1d5d4b7 100644 (file)
@@ -62,7 +62,7 @@ int32_t ctdb_control_register_server_id(struct ctdb_context *ctdb,
 
 
        if (client == NULL) {
-               DEBUG(0,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
                return 1;
        }
 
@@ -125,7 +125,7 @@ static void server_id_count(void *param, void *data)
                                                struct count_server_ids);
 
        if (svid == NULL) {
-               DEBUG(0, (__location__ " Got null pointer for svid\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Got null pointer for svid\n"));
                return;
        }
 
@@ -140,12 +140,12 @@ static void server_id_store(void *param, void *data)
                                                struct ctdb_server_id);
 
        if (svid == NULL) {
-               DEBUG(0, (__location__ " Got null pointer for svid\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Got null pointer for svid\n"));
                return;
        }
 
        if (svid->count >= svid->list->num) {
-               DEBUG(0, (__location__ " size of server id tree changed during traverse\n"));
+               DEBUG(DEBUG_ERR, (__location__ " size of server id tree changed during traverse\n"));
                return;
        }
 
index 15894fce7bfd95db3db4dd0e8f05e2f2bd451cc8..6aaf41dd648df38f851f1c9d143c441f31b441c4 100644 (file)
@@ -75,12 +75,12 @@ static void ctdb_control_send_arp(struct event_context *ev, struct timed_event *
 
        ret = ctdb_sys_send_arp(&arp->sin, arp->vnn->iface);
        if (ret != 0) {
-               DEBUG(0,(__location__ " sending of arp failed (%s)\n", strerror(errno)));
+               DEBUG(DEBUG_CRIT,(__location__ " sending of arp failed (%s)\n", strerror(errno)));
        }
 
        s = ctdb_sys_open_sending_socket();
        if (s == -1) {
-               DEBUG(0,(__location__ " failed to open raw socket for sending tickles\n"));
+               DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket for sending tickles\n"));
                return;
        }
 
@@ -94,7 +94,7 @@ static void ctdb_control_send_arp(struct event_context *ev, struct timed_event *
                        ret = ctdb_sys_send_tcp(s, &tcparray->connections[i].saddr, 
                                                &tcparray->connections[i].daddr, 0, 0, 0);
                        if (ret != 0) {
-                               DEBUG(0,(__location__ " Failed to send tcp tickle ack for %s\n",
+                               DEBUG(DEBUG_CRIT,(__location__ " Failed to send tcp tickle ack for %s\n",
                                         inet_ntoa(tcparray->connections[i].saddr.sin_addr)));
                        }
                }
@@ -134,7 +134,7 @@ static void takeover_ip_callback(struct ctdb_context *ctdb, int status,
        ctdb_enable_monitoring(ctdb);
 
        if (status != 0) {
-               DEBUG(0,(__location__ " Failed to takeover IP %s on interface %s\n",
+               DEBUG(DEBUG_ERR,(__location__ " Failed to takeover IP %s on interface %s\n",
                         ip, state->vnn->iface));
                ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
                talloc_free(state);
@@ -213,7 +213,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
        /* update out vnn list */
        vnn = find_public_ip_vnn(ctdb, pip->sin);
        if (vnn == NULL) {
-               DEBUG(0,("takeoverip called for an ip '%s' that is not a public address\n", 
+               DEBUG(DEBUG_ERR,("takeoverip called for an ip '%s' that is not a public address\n", 
                         inet_ntoa(pip->sin.sin_addr)));
                return 0;
        }
@@ -234,7 +234,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
 
        state->vnn = vnn;
 
-       DEBUG(0,("Takeover of IP %s/%u on interface %s\n", 
+       DEBUG(DEBUG_NOTICE,("Takeover of IP %s/%u on interface %s\n", 
                 inet_ntoa(pip->sin.sin_addr), vnn->public_netmask_bits, 
                 vnn->iface));
 
@@ -250,7 +250,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
 
        if (ret != 0) {
                ctdb_enable_monitoring(ctdb);
-               DEBUG(0,(__location__ " Failed to takeover IP %s on interface %s\n",
+               DEBUG(DEBUG_ERR,(__location__ " Failed to takeover IP %s on interface %s\n",
                         inet_ntoa(pip->sin.sin_addr), vnn->iface));
                talloc_free(state);
                return -1;
@@ -281,7 +281,7 @@ static void release_kill_clients(struct ctdb_context *ctdb, struct sockaddr_in i
                        DEBUG(DEBUG_INFO,("matched client %u with IP %s and pid %u\n", 
                                 ip->client_id, inet_ntoa(ip->ip.sin_addr), client->pid));
                        if (client->pid != 0) {
-                               DEBUG(0,(__location__ " Killing client pid %u for IP %s on client_id %u\n",
+                               DEBUG(DEBUG_INFO,(__location__ " Killing client pid %u for IP %s on client_id %u\n",
                                         (unsigned)client->pid, inet_ntoa(in.sin_addr),
                                         ip->client_id));
                                kill(client->pid, SIGKILL);
@@ -335,7 +335,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
        /* update our vnn list */
        vnn = find_public_ip_vnn(ctdb, pip->sin);
        if (vnn == NULL) {
-               DEBUG(0,("releaseip called for an ip '%s' that is not a public address\n", 
+               DEBUG(DEBUG_ERR,("releaseip called for an ip '%s' that is not a public address\n", 
                         inet_ntoa(pip->sin.sin_addr)));
                return 0;
        }
@@ -352,7 +352,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
                return 0;
        }
 
-       DEBUG(0,("Release of IP %s/%u on interface %s\n", 
+       DEBUG(DEBUG_NOTICE,("Release of IP %s/%u on interface %s\n", 
                 inet_ntoa(pip->sin.sin_addr), vnn->public_netmask_bits, 
                 vnn->iface));
 
@@ -378,7 +378,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
        if (ret != 0) {
                ctdb_enable_monitoring(ctdb);
 
-               DEBUG(0,(__location__ " Failed to release IP %s on interface %s\n",
+               DEBUG(DEBUG_ERR,(__location__ " Failed to release IP %s on interface %s\n",
                         inet_ntoa(pip->sin.sin_addr), vnn->iface));
                talloc_free(state);
                return -1;
@@ -398,7 +398,7 @@ static int add_public_address(struct ctdb_context *ctdb, struct sockaddr_in addr
        /* Verify that we dont have an entry for this ip yet */
        for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
                if (ctdb_same_sockaddr(&addr, &vnn->public_address)) {
-                       DEBUG(0,("Same ip '%s' specified multiple times in the public address list \n", 
+                       DEBUG(DEBUG_CRIT,("Same ip '%s' specified multiple times in the public address list \n", 
                                 inet_ntoa(addr.sin_addr)));
                        exit(1);
                }               
@@ -454,14 +454,14 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist)
 
                tok = strtok(lines[i], " \t");
                if (!tok || !parse_ip_mask(tok, &addr, &mask)) {
-                       DEBUG(0,("Badly formed line %u in public address list\n", i+1));
+                       DEBUG(DEBUG_CRIT,("Badly formed line %u in public address list\n", i+1));
                        talloc_free(lines);
                        return -1;
                }
                tok = strtok(NULL, " \t");
                if (tok == NULL) {
                        if (NULL == ctdb->default_public_interface) {
-                               DEBUG(0,("No default public interface and no interface specified at line %u of public address list\n",
+                               DEBUG(DEBUG_CRIT,("No default public interface and no interface specified at line %u of public address list\n",
                                         i+1));
                                talloc_free(lines);
                                return -1;
@@ -472,7 +472,7 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist)
                }
 
                if (add_public_address(ctdb, addr, mask, iface)) {
-                       DEBUG(0,("Failed to add line %u to the public address list\n", i+1));
+                       DEBUG(DEBUG_CRIT,("Failed to add line %u to the public address list\n", i+1));
                        talloc_free(lines);
                        return -1;
                }
@@ -576,7 +576,7 @@ static int find_takeover_node(struct ctdb_context *ctdb,
                }
        }       
        if (pnn == -1) {
-               DEBUG(0,(__location__ " Could not find node to take over public address '%s'\n", inet_ntoa(ip->sin.sin_addr)));
+               DEBUG(DEBUG_WARNING,(__location__ " Could not find node to take over public address '%s'\n", inet_ntoa(ip->sin.sin_addr)));
                return -1;
        }
 
@@ -687,7 +687,7 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
           available/unavailable nodes.
        */
        if (1 == ctdb->tunable.deterministic_public_ips) {              
-               DEBUG(0,("Deterministic IPs enabled. Resetting all ip allocations\n"));
+               DEBUG(DEBUG_NOTICE,("Deterministic IPs enabled. Resetting all ip allocations\n"));
                for (i=0,tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next,i++) {
                        tmp_ip->pnn = i%nodemap->num;
                }
@@ -718,7 +718,7 @@ try_again:
        for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
                if (tmp_ip->pnn == -1) {
                        if (find_takeover_node(ctdb, nodemap, mask, tmp_ip, all_ips)) {
-                               DEBUG(0,("Failed to find node to cover ip %s\n", inet_ntoa(tmp_ip->sin.sin_addr)));
+                               DEBUG(DEBUG_WARNING,("Failed to find node to cover ip %s\n", inet_ntoa(tmp_ip->sin.sin_addr)));
                        }
                }
        }
@@ -773,7 +773,7 @@ try_again:
                        }
                }
                if (maxnode == -1) {
-                       DEBUG(0,(__location__ " Could not find maxnode. May not be able to serve ip '%s'\n", inet_ntoa(tmp_ip->sin.sin_addr)));
+                       DEBUG(DEBUG_WARNING,(__location__ " Could not find maxnode. May not be able to serve ip '%s'\n", inet_ntoa(tmp_ip->sin.sin_addr)));
                        continue;
                }
 
@@ -844,7 +844,7 @@ try_again:
                                        data, async_data,
                                        &timeout, NULL);
                        if (state == NULL) {
-                               DEBUG(0,(__location__ " Failed to call async control CTDB_CONTROL_RELEASE_IP to node %u\n", nodemap->nodes[i].pnn));
+                               DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_RELEASE_IP to node %u\n", nodemap->nodes[i].pnn));
                                talloc_free(tmp_ctx);
                                return -1;
                        }
@@ -853,7 +853,7 @@ try_again:
                }
        }
        if (ctdb_client_async_wait(ctdb, async_data) != 0) {
-               DEBUG(0,(__location__ " Async control CTDB_CONTROL_RELEASE_IP failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Async control CTDB_CONTROL_RELEASE_IP failed\n"));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -880,7 +880,7 @@ try_again:
                                data, async_data,
                                &timeout, NULL);
                if (state == NULL) {
-                       DEBUG(0,(__location__ " Failed to call async control CTDB_CONTROL_TAKEOVER_IP to node %u\n", tmp_ip->pnn));
+                       DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_TAKEOVER_IP to node %u\n", tmp_ip->pnn));
                        talloc_free(tmp_ctx);
                        return -1;
                }
@@ -888,7 +888,7 @@ try_again:
                ctdb_client_async_add(async_data, state);
        }
        if (ctdb_client_async_wait(ctdb, async_data) != 0) {
-               DEBUG(0,(__location__ " Async control CTDB_CONTROL_TAKEOVER_IP failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Async control CTDB_CONTROL_TAKEOVER_IP failed\n"));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -928,14 +928,14 @@ int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id,
        vnn = find_public_ip_vnn(ctdb, p->dest);
        if (vnn == NULL) {
                if (ntohl(p->dest.sin_addr.s_addr) != INADDR_LOOPBACK) {
-                       DEBUG(0,("Could not add client IP %s. This is not a public address.\n", 
+                       DEBUG(DEBUG_ERR,("Could not add client IP %s. This is not a public address.\n", 
                                 inet_ntoa(p->dest.sin_addr))); 
                }
                return 0;
        }
 
        if (vnn->pnn != ctdb->pnn) {
-               DEBUG(0,("Attempt to register tcp client for IP %s we don't hold - failing (client_id %u pid %u)\n",
+               DEBUG(DEBUG_ERR,("Attempt to register tcp client for IP %s we don't hold - failing (client_id %u pid %u)\n",
                         inet_ntoa(p->dest.sin_addr),
                         client_id, client->pid));
                /* failing this call will tell smbd to die */
@@ -975,7 +975,7 @@ int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id,
                                       CTDB_CONTROL_TCP_ADD,
                                       0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " Failed to send CTDB_CONTROL_TCP_ADD\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to send CTDB_CONTROL_TCP_ADD\n"));
                return -1;
        }
 
@@ -1027,7 +1027,7 @@ int32_t ctdb_control_tcp_add(struct ctdb_context *ctdb, TDB_DATA indata)
 
        vnn = find_public_ip_vnn(ctdb, p->dest);
        if (vnn == NULL) {
-               DEBUG(0,(__location__ " got TCP_ADD control for an address which is not a public address '%s'\n", 
+               DEBUG(DEBUG_ERR,(__location__ " got TCP_ADD control for an address which is not a public address '%s'\n", 
                         inet_ntoa(p->dest.sin_addr)));
                return -1;
        }
@@ -1096,7 +1096,7 @@ static void ctdb_remove_tcp_connection(struct ctdb_context *ctdb, struct ctdb_tc
        struct ctdb_vnn *vnn = find_public_ip_vnn(ctdb, conn->daddr);
 
        if (vnn == NULL) {
-               DEBUG(0,(__location__ " unable to find public address %s\n", inet_ntoa(conn->daddr.sin_addr)));
+               DEBUG(DEBUG_ERR,(__location__ " unable to find public address %s\n", inet_ntoa(conn->daddr.sin_addr)));
                return;
        }
 
@@ -1414,7 +1414,7 @@ static int ctdb_killtcp_add_connection(struct ctdb_context *ctdb,
                }
        }
        if (vnn == NULL) {
-               DEBUG(0,(__location__ " Could not killtcp, not a public address\n")); 
+               DEBUG(DEBUG_ERR,(__location__ " Could not killtcp, not a public address\n")); 
                return -1;
        }
 
@@ -1460,7 +1460,7 @@ static int ctdb_killtcp_add_connection(struct ctdb_context *ctdb,
        if (killtcp->sending_fd == -1) {
                killtcp->sending_fd = ctdb_sys_open_sending_socket();
                if (killtcp->sending_fd == -1) {
-                       DEBUG(0,(__location__ " Failed to open sending socket for killtcp\n"));
+                       DEBUG(DEBUG_CRIT,(__location__ " Failed to open sending socket for killtcp\n"));
                        goto failed;
                }
        }
@@ -1471,7 +1471,7 @@ static int ctdb_killtcp_add_connection(struct ctdb_context *ctdb,
        if (killtcp->capture_fd == -1) {
                killtcp->capture_fd = ctdb_sys_open_capture_socket(vnn->iface, &killtcp->private_data);
                if (killtcp->capture_fd == -1) {
-                       DEBUG(0,(__location__ " Failed to open capturing socket for killtcp\n"));
+                       DEBUG(DEBUG_CRIT,(__location__ " Failed to open capturing socket for killtcp\n"));
                        goto failed;
                }
        }
@@ -1527,7 +1527,7 @@ int32_t ctdb_control_set_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind
         */
        if (indata.dsize < offsetof(struct ctdb_control_tcp_tickle_list, 
                                        tickles.connections)) {
-               DEBUG(0,("Bad indata in ctdb_control_set_tcp_tickle_list. Not enough data for the tickle.num field\n"));
+               DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tcp_tickle_list. Not enough data for the tickle.num field\n"));
                return -1;
        }
 
@@ -1536,13 +1536,13 @@ int32_t ctdb_control_set_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind
                                tickles.connections)
                         + sizeof(struct ctdb_tcp_connection)
                                 * list->tickles.num) {
-               DEBUG(0,("Bad indata in ctdb_control_set_tcp_tickle_list\n"));
+               DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tcp_tickle_list\n"));
                return -1;
        }       
 
        vnn = find_public_ip_vnn(ctdb, list->ip);
        if (vnn == NULL) {
-               DEBUG(0,(__location__ " Could not set tcp tickle list, '%s' is not a public address\n", 
+               DEBUG(DEBUG_ERR,(__location__ " Could not set tcp tickle list, '%s' is not a public address\n", 
                         inet_ntoa(list->ip.sin_addr))); 
                return 1;
        }
@@ -1582,7 +1582,7 @@ int32_t ctdb_control_get_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind
 
        vnn = find_public_ip_vnn(ctdb, *ip);
        if (vnn == NULL) {
-               DEBUG(0,(__location__ " Could not get tcp tickle list, '%s' is not a public address\n", 
+               DEBUG(DEBUG_ERR,(__location__ " Could not get tcp tickle list, '%s' is not a public address\n", 
                         inet_ntoa(ip->sin_addr))); 
                return 1;
        }
@@ -1648,7 +1648,7 @@ static int ctdb_ctrl_set_tcp_tickles(struct ctdb_context *ctdb,
                                       CTDB_CONTROL_SET_TCP_TICKLE_LIST,
                                       0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
        if (ret != 0) {
-               DEBUG(0,(__location__ " ctdb_control for set tcp tickles failed\n"));
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_control for set tcp tickles failed\n"));
                return -1;
        }
 
@@ -1686,7 +1686,7 @@ static void ctdb_update_tcp_tickles(struct event_context *ev,
                                &vnn->public_address,
                                vnn->tcp_array);
                if (ret != 0) {
-                       DEBUG(0,("Failed to send the tickle update for public address %s\n", 
+                       DEBUG(DEBUG_ERR,("Failed to send the tickle update for public address %s\n", 
                                 inet_ntoa(vnn->public_address.sin_addr)));
                }
        }
@@ -1731,7 +1731,7 @@ static void send_gratious_arp(struct event_context *ev, struct timed_event *te,
 
        ret = ctdb_sys_send_arp(&arp->sin, arp->iface);
        if (ret != 0) {
-               DEBUG(0,(__location__ " sending of gratious arp failed (%s)\n", strerror(errno)));
+               DEBUG(DEBUG_ERR,(__location__ " sending of gratious arp failed (%s)\n", strerror(errno)));
        }
 
 
@@ -1758,14 +1758,14 @@ int32_t ctdb_control_send_gratious_arp(struct ctdb_context *ctdb, TDB_DATA indat
 
        /* verify the size of indata */
        if (indata.dsize < offsetof(struct ctdb_control_gratious_arp, iface)) {
-               DEBUG(0,(__location__ " Too small indata to hold a ctdb_control_gratious_arp structure\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Too small indata to hold a ctdb_control_gratious_arp structure\n"));
                return -1;
        }
        if (indata.dsize != 
                ( offsetof(struct ctdb_control_gratious_arp, iface)
                + gratious_arp->len ) ){
 
-               DEBUG(0,(__location__ " Wrong size of indata. Was %u bytes "
+               DEBUG(DEBUG_ERR,(__location__ " Wrong size of indata. Was %u bytes "
                        "but should be %u bytes\n", 
                         (unsigned)indata.dsize, 
                         (unsigned)(offsetof(struct ctdb_control_gratious_arp, iface)+gratious_arp->len)));
index c48387af34c3074a381b7b1294460290eeb04dd6..6c84d024e625d55962643c785b66e4c7531c9b5b 100644 (file)
@@ -283,7 +283,7 @@ static void traverse_all_callback(void *p, TDB_DATA key, TDB_DATA data)
        d = ctdb_marshall_record(state, state->reqid, key, NULL, data);
        if (d == NULL) {
                /* darn .... */
-               DEBUG(0,("Out of memory in traverse_all_callback\n"));
+               DEBUG(DEBUG_ERR,("Out of memory in traverse_all_callback\n"));
                return;
        }
 
@@ -293,7 +293,7 @@ static void traverse_all_callback(void *p, TDB_DATA key, TDB_DATA data)
        ret = ctdb_daemon_send_control(state->ctdb, state->srcnode, 0, CTDB_CONTROL_TRAVERSE_DATA,
                                       0, CTDB_CTRL_FLAG_NOREPLY, cdata, NULL, NULL);
        if (ret != 0) {
-               DEBUG(0,("Failed to send traverse data\n"));
+               DEBUG(DEBUG_ERR,("Failed to send traverse data\n"));
        }
 
        if (key.dsize == 0 && data.dsize == 0) {
@@ -314,7 +314,7 @@ int32_t ctdb_control_traverse_all(struct ctdb_context *ctdb, TDB_DATA data, TDB_
        struct ctdb_db_context *ctdb_db;
 
        if (data.dsize != sizeof(struct ctdb_traverse_all)) {
-               DEBUG(0,("Invalid size in ctdb_control_traverse_all\n"));
+               DEBUG(DEBUG_ERR,("Invalid size in ctdb_control_traverse_all\n"));
                return -1;
        }
 
@@ -355,7 +355,7 @@ int32_t ctdb_control_traverse_data(struct ctdb_context *ctdb, TDB_DATA data, TDB
        void *private_data;
 
        if (data.dsize < sizeof(uint32_t) || data.dsize != d->length) {
-               DEBUG(0,("Bad record size in ctdb_control_traverse_data\n"));
+               DEBUG(DEBUG_ERR,("Bad record size in ctdb_control_traverse_data\n"));
                return -1;
        }
 
@@ -434,7 +434,7 @@ int32_t ctdb_control_traverse_start(struct ctdb_context *ctdb, TDB_DATA data,
        struct ctdb_db_context *ctdb_db;
 
        if (data.dsize != sizeof(*d)) {
-               DEBUG(0,("Bad record size in ctdb_control_traverse_start\n"));
+               DEBUG(DEBUG_ERR,("Bad record size in ctdb_control_traverse_start\n"));
                return -1;
        }
 
index 0fe16c9aaf1299c5f2fb003f4b8dd32968dd7a84..b4f27304cb2069842216f78f34d582500ea7756d 100644 (file)
@@ -73,7 +73,7 @@ int32_t ctdb_control_get_tunable(struct ctdb_context *ctdb, TDB_DATA indata,
 
        if (indata.dsize < sizeof(*t) ||
            t->length > indata.dsize - offsetof(struct ctdb_control_get_tunable, name)) {
-               DEBUG(0,("Bad indata in ctdb_control_get_tunable\n"));
+               DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_get_tunable\n"));
                return -1;
        }
 
@@ -113,7 +113,7 @@ int32_t ctdb_control_set_tunable(struct ctdb_context *ctdb, TDB_DATA indata)
 
        if (indata.dsize < sizeof(*t) ||
            t->length > indata.dsize - offsetof(struct ctdb_control_set_tunable, name)) {
-               DEBUG(0,("Bad indata in ctdb_control_set_tunable\n"));
+               DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tunable\n"));
                return -1;
        }
 
index 449b3f2346c5d9da3f36b5e899ad71e6e35ef502..a40c4efb752371fef14e691929f777fe0b4fa512 100644 (file)
@@ -136,7 +136,7 @@ int main(int argc, const char *argv[])
        }
 
        if (!options.recovery_lock_file) {
-               DEBUG(0,("You must specifiy the location of a recovery lock file with --reclock\n"));
+               DEBUG(DEBUG_ALERT,("You must specifiy the location of a recovery lock file with --reclock\n"));
                exit(1);
        }
 
@@ -155,7 +155,7 @@ int main(int argc, const char *argv[])
                exit(1);
        }
 
-       DEBUG(0,("Starting CTDB daemon\n"));
+       DEBUG(DEBUG_NOTICE,("Starting CTDB daemon\n"));
        gettimeofday(&ctdb->ctdbd_start_time, NULL);
        gettimeofday(&ctdb->last_recovery_time, NULL);
        ctdb->recovery_mode    = CTDB_RECOVERY_NORMAL;
@@ -168,13 +168,13 @@ int main(int argc, const char *argv[])
 
        ret = ctdb_set_recovery_lock_file(ctdb, options.recovery_lock_file);
        if (ret == -1) {
-               DEBUG(0,("ctdb_set_recovery_lock_file failed - %s\n", ctdb_errstr(ctdb)));
+               DEBUG(DEBUG_ALERT,("ctdb_set_recovery_lock_file failed - %s\n", ctdb_errstr(ctdb)));
                exit(1);
        }
 
        ret = ctdb_set_transport(ctdb, options.transport);
        if (ret == -1) {
-               DEBUG(0,("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb)));
+               DEBUG(DEBUG_ALERT,("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb)));
                exit(1);
        }
 
@@ -182,7 +182,7 @@ int main(int argc, const char *argv[])
        if (options.myaddress) {
                ret = ctdb_set_address(ctdb, options.myaddress);
                if (ret == -1) {
-                       DEBUG(0,("ctdb_set_address failed - %s\n", ctdb_errstr(ctdb)));
+                       DEBUG(DEBUG_ALERT,("ctdb_set_address failed - %s\n", ctdb_errstr(ctdb)));
                        exit(1);
                }
        }
@@ -190,7 +190,7 @@ int main(int argc, const char *argv[])
        /* tell ctdb what nodes are available */
        ret = ctdb_set_nlist(ctdb, options.nlist);
        if (ret == -1) {
-               DEBUG(0,("ctdb_set_nlist failed - %s\n", ctdb_errstr(ctdb)));
+               DEBUG(DEBUG_ALERT,("ctdb_set_nlist failed - %s\n", ctdb_errstr(ctdb)));
                exit(1);
        }
 
@@ -198,27 +198,27 @@ int main(int argc, const char *argv[])
           nodes file
        */
        if (options.node_ip != NULL) {
-               DEBUG(0,("IP for this node is %s\n", options.node_ip));
+               DEBUG(DEBUG_NOTICE,("IP for this node is %s\n", options.node_ip));
                ret = ctdb_ip_to_nodeid(ctdb, options.node_ip);
                if (ret == -1) {
-                       DEBUG(0,("The specified node-ip:%s is not a valid node address. Exiting.\n", options.node_ip));
+                       DEBUG(DEBUG_ALERT,("The specified node-ip:%s is not a valid node address. Exiting.\n", options.node_ip));
                        exit(1);
                }
                ctdb->node_ip = options.node_ip;
-               DEBUG(0,("This is node %d\n", ret));
+               DEBUG(DEBUG_NOTICE,("This is node %d\n", ret));
        }
 
        if (options.db_dir) {
                ret = ctdb_set_tdb_dir(ctdb, options.db_dir);
                if (ret == -1) {
-                       DEBUG(0,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb)));
+                       DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb)));
                        exit(1);
                }
        }
        if (options.db_dir_persistent) {
                ret = ctdb_set_tdb_dir_persistent(ctdb, options.db_dir_persistent);
                if (ret == -1) {
-                       DEBUG(0,("ctdb_set_tdb_dir_persistent failed - %s\n", ctdb_errstr(ctdb)));
+                       DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir_persistent failed - %s\n", ctdb_errstr(ctdb)));
                        exit(1);
                }
        }
@@ -232,7 +232,7 @@ int main(int argc, const char *argv[])
                struct ctdb_vnn *svnn;
 
                if (options.public_interface == NULL) {
-                       DEBUG(0,("--single_public_ip used but --public_interface is not specified. You must specify the public interface when using single public ip. Exiting\n"));
+                       DEBUG(DEBUG_ALERT,("--single_public_ip used but --public_interface is not specified. You must specify the public interface when using single public ip. Exiting\n"));
                        exit(10);
                }
 
@@ -245,7 +245,7 @@ int main(int argc, const char *argv[])
 
                if (inet_aton(options.single_public_ip, 
                                &svnn->public_address.sin_addr) == 0) {
-                       DEBUG(0,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
+                       DEBUG(DEBUG_ALERT,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
                        exit(10);
                }
                svnn->public_address.sin_family = AF_INET;
@@ -255,14 +255,14 @@ int main(int argc, const char *argv[])
        if (options.public_address_list) {
                ret = ctdb_set_public_addresses(ctdb, options.public_address_list);
                if (ret == -1) {
-                       DEBUG(0,("Unable to setup public address list\n"));
+                       DEBUG(DEBUG_ALERT,("Unable to setup public address list\n"));
                        exit(1);
                }
        }
 
        ret = ctdb_set_event_script_dir(ctdb, options.event_script_dir);
        if (ret == -1) {
-               DEBUG(0,("Unable to setup event script directory\n"));
+               DEBUG(DEBUG_ALERT,("Unable to setup event script directory\n"));
                exit(1);
        }
 
index 17090975b101d1df775995851a0b994ac96fcddd..705cb4b9a658f47e997dff7feaff8b246f54293c 100644 (file)
@@ -36,7 +36,7 @@ static struct {
  */
 static void sigterm(int sig)
 {
-       DEBUG(0,("Timed out running script '%s' after %.1f seconds\n", 
+       DEBUG(DEBUG_ERR,("Timed out running script '%s' after %.1f seconds\n", 
                 child_state.script_running, timeval_elapsed(&child_state.start)));
        /* all the child processes will be running in the same process group */
        kill(-getpgrp(), SIGKILL);
@@ -61,7 +61,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
        char *script;
 
        if (setpgid(0,0) != 0) {
-               DEBUG(0,("Failed to create process group for event scripts - %s\n",
+               DEBUG(DEBUG_ERR,("Failed to create process group for event scripts - %s\n",
                         strerror(errno)));
                talloc_free(tmp_ctx);
                return -1;              
@@ -77,7 +77,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
        */
        if (stat(ctdb->event_script_dir, &st) != 0 && 
            errno == ENOENT) {
-               DEBUG(0,("No event script directory found at '%s'\n", ctdb->event_script_dir));
+               DEBUG(DEBUG_CRIT,("No event script directory found at '%s'\n", ctdb->event_script_dir));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -90,7 +90,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
        */
        dir = opendir(ctdb->event_script_dir);
        if (dir == NULL) {
-               DEBUG(0,("Failed to open event script directory '%s'\n", ctdb->event_script_dir));
+               DEBUG(DEBUG_CRIT,("Failed to open event script directory '%s'\n", ctdb->event_script_dir));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -122,11 +122,11 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
                /* Make sure the event script is executable */
                str = talloc_asprintf(tree, "%s/%s", ctdb->event_script_dir, de->d_name);
                if (stat(str, &st) != 0) {
-                       DEBUG(0,("Could not stat event script %s. Ignoring this event script\n", str));
+                       DEBUG(DEBUG_ERR,("Could not stat event script %s. Ignoring this event script\n", str));
                        continue;
                }
                if (!(st.st_mode & S_IXUSR)) {
-                       DEBUG(0,("Event script %s is not executable. Ignoring this event script\n", str));
+                       DEBUG(DEBUG_ERR,("Event script %s is not executable. Ignoring this event script\n", str));
                        continue;
                }
                
@@ -134,7 +134,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
                /* store the event script in the tree */                
                script = trbt_insert32(tree, num, talloc_strdup(tree, de->d_name));
                if (script != NULL) {
-                       DEBUG(0,("CONFIG ERROR: Multiple event scripts with the same prefix : '%s' and '%s'. Each event script MUST have a unique prefix\n", script, de->d_name));
+                       DEBUG(DEBUG_CRIT,("CONFIG ERROR: Multiple event scripts with the same prefix : '%s' and '%s'. Each event script MUST have a unique prefix\n", script, de->d_name));
                        talloc_free(tmp_ctx);
                        closedir(dir);
                        return -1;
@@ -170,7 +170,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
                }
                /* return an error if the script failed */
                if (ret != 0) {
-                       DEBUG(0,("Event script %s failed with error %d\n", cmdstr, ret));
+                       DEBUG(DEBUG_ERR,("Event script %s failed with error %d\n", cmdstr, ret));
                        talloc_free(tmp_ctx);
                        return ret;
                }
@@ -224,7 +224,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
        void *private_data = state->private_data;
        struct ctdb_context *ctdb = state->ctdb;
 
-       DEBUG(0,("event script timed out\n"));
+       DEBUG(DEBUG_ERR,("event script timed out\n"));
        talloc_free(state);
        callback(ctdb, -1, private_data);
 }
@@ -234,7 +234,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
  */
 static int event_script_destructor(struct ctdb_event_script_state *state)
 {
-       DEBUG(0,(__location__ " Sending SIGTERM to child pid:%d\n", state->child));
+       DEBUG(DEBUG_ERR,(__location__ " Sending SIGTERM to child pid:%d\n", state->child));
        kill(state->child, SIGTERM);
        waitpid(state->child, NULL, 0);
        return 0;
index 0d1f402c24dc7083c2dbf72f36bd75677d6b24ba..1bad440d01a845db46d860b691a78c5700f896f3 100644 (file)
@@ -217,7 +217,7 @@ static void ctdb_listen_event(struct event_context *ev, struct fd_event *fde,
        nodeid = ctdb_ip_to_nodeid(ctdb, incoming_node);
 
        if (nodeid == -1) {
-               DEBUG(0, ("Refused connection from unknown node %s\n", incoming_node));
+               DEBUG(DEBUG_WARNING, ("Refused connection from unknown node %s\n", incoming_node));
                close(fd);
                return;
        }
@@ -254,7 +254,7 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
           binds if the first socket is in LISTEN state  */
        lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666);
        if (lock_fd == -1) {
-               DEBUG(0,("Unable to open %s\n", lock_path));
+               DEBUG(DEBUG_CRIT,("Unable to open %s\n", lock_path));
                return -1;
        }
 
@@ -265,7 +265,7 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
        lock.l_pid = 0;
 
        if (fcntl(lock_fd, F_SETLKW, &lock) != 0) {
-               DEBUG(0,("Unable to lock %s\n", lock_path));
+               DEBUG(DEBUG_CRIT,("Unable to lock %s\n", lock_path));
                close(lock_fd);
                return -1;
        }
@@ -299,7 +299,7 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
        }
        
        if (i == ctdb->num_nodes) {
-               DEBUG(0,("Unable to bind to any of the node addresses - giving up\n"));
+               DEBUG(DEBUG_CRIT,("Unable to bind to any of the node addresses - giving up\n"));
                goto failed;
        }
        ctdb->address = ctdb->nodes[i]->address;
index a47a18d2989e6b5d7ed5e386630619db1717f615..624f6507efca16edff743db3c74f908f66263e26 100644 (file)
@@ -58,7 +58,7 @@ static int ctdb_tcp_initialise(struct ctdb_context *ctdb)
 
        for (i=0; i<ctdb->num_nodes; i++) {
                if (ctdb_tcp_add_node(ctdb->nodes[i]) != 0) {
-                       DEBUG(0, ("methods->add_node failed at %d\n", i));
+                       DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i));
                        return -1;
                }
        }
@@ -98,7 +98,7 @@ static void ctdb_tcp_restart(struct ctdb_node *node)
        struct ctdb_tcp_node *tnode = talloc_get_type(
                node->private_data, struct ctdb_tcp_node);
 
-       DEBUG(0,("Tearing down connection to dead node :%d\n", node->pnn));
+       DEBUG(DEBUG_NOTICE,("Tearing down connection to dead node :%d\n", node->pnn));
 
        ctdb_tcp_stop_connection(node);
 
index c10afb34259057ce03430ffa15ed8efe15321aa4..10711d1ea188422e8609a7d88cc13dd62c787be8 100644 (file)
@@ -41,31 +41,31 @@ void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
        }
 
        if (cnt < sizeof(*hdr)) {
-               DEBUG(0,(__location__ " Bad packet length %u\n", (unsigned)cnt));
+               DEBUG(DEBUG_ALERT,(__location__ " Bad packet length %u\n", (unsigned)cnt));
                goto failed;
        }
 
        if (cnt & (CTDB_TCP_ALIGNMENT-1)) {
-               DEBUG(0,(__location__ " Length 0x%x not multiple of alignment\n", 
+               DEBUG(DEBUG_ALERT,(__location__ " Length 0x%x not multiple of alignment\n", 
                         (unsigned)cnt));
                goto failed;
        }
 
 
        if (cnt != hdr->length) {
-               DEBUG(0,(__location__ " Bad header length %u expected %u\n", 
+               DEBUG(DEBUG_ALERT,(__location__ " Bad header length %u expected %u\n", 
                         (unsigned)hdr->length, (unsigned)cnt));
                goto failed;
        }
 
        if (hdr->ctdb_magic != CTDB_MAGIC) {
-               DEBUG(0,(__location__ " Non CTDB packet 0x%x rejected\n", 
+               DEBUG(DEBUG_ALERT,(__location__ " Non CTDB packet 0x%x rejected\n", 
                         hdr->ctdb_magic));
                goto failed;
        }
 
        if (hdr->ctdb_version != CTDB_VERSION) {
-               DEBUG(0, (__location__ " Bad CTDB version 0x%x rejected\n", 
+               DEBUG(DEBUG_ALERT, (__location__ " Bad CTDB version 0x%x rejected\n", 
                          hdr->ctdb_version));
                goto failed;
        }
index 775ba0c7ad24be2159164890cac9281d2381d6e5..dd0e27c25077de5c69400067bac207f9f8549b81 100644 (file)
@@ -67,7 +67,7 @@ static void test_store_records(struct ctdb_context *ctdb, struct event_context *
                
                ret = ctdb_record_store(h, data);
                if (ret != 0) {
-                       DEBUG(0,("Failed to store record\n"));
+                       DEBUG(DEBUG_ERR,("Failed to store record\n"));
                        exit(1);
                }
                talloc_free(h);
index d56a09f2ae66494d07b306a8e5db6239f3530273..c3f72eed8c8e1bdd5f11056fd80536b4df23f880 100644 (file)
@@ -51,7 +51,7 @@ static int control_process_exists(struct ctdb_context *ctdb, int argc, const cha
        }
 
        if (sscanf(argv[0], "%u:%u", &pnn, &pid) != 2) {
-               DEBUG(0, ("Badly formed pnn:pid\n"));
+               DEBUG(DEBUG_ERR, ("Badly formed pnn:pid\n"));
                return -1;
        }
 
@@ -154,7 +154,7 @@ static int control_statistics_all(struct ctdb_context *ctdb)
                        offsetof(struct ctdb_statistics, __last_counter) / sizeof(uint32_t);
                ret = ctdb_ctrl_statistics(ctdb, nodes[i], &s1);
                if (ret != 0) {
-                       DEBUG(0, ("Unable to get statistics from node %u\n", nodes[i]));
+                       DEBUG(DEBUG_ERR, ("Unable to get statistics from node %u\n", nodes[i]));
                        return ret;
                }
                for (j=0;j<num_ints;j++) {
@@ -187,7 +187,7 @@ static int control_statistics(struct ctdb_context *ctdb, int argc, const char **
 
        ret = ctdb_ctrl_statistics(ctdb, options.pnn, &statistics);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get statistics from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get statistics from node %u\n", options.pnn));
                return ret;
        }
        show_statistics(&statistics);
@@ -204,7 +204,7 @@ static int control_statistics_reset(struct ctdb_context *ctdb, int argc, const c
 
        ret = ctdb_statistics_reset(ctdb, options.pnn);
        if (ret != 0) {
-               DEBUG(0, ("Unable to reset statistics on node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to reset statistics on node %u\n", options.pnn));
                return ret;
        }
        return 0;
@@ -228,7 +228,7 @@ static int control_uptime(struct ctdb_context *ctdb, int argc, const char **argv
 
        ret = ctdb_ctrl_uptime(ctdb, ctdb, TIMELIMIT(), options.pnn, &uptime);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get uptime from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get uptime from node %u\n", options.pnn));
                return ret;
        }
 
@@ -275,7 +275,7 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
 
        ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get nodemap from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get nodemap from node %u\n", options.pnn));
                return ret;
        }
 
@@ -329,7 +329,7 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
 
        ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &vnnmap);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get vnnmap from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get vnnmap from node %u\n", options.pnn));
                return ret;
        }
        if (vnnmap->generation == INVALID_GENERATION) {
@@ -344,14 +344,14 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
 
        ret = ctdb_ctrl_getrecmode(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmode);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get recmode from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get recmode from node %u\n", options.pnn));
                return ret;
        }
        printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode);
 
        ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get recmaster from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
                return ret;
        }
        printf("Recovery master:%d\n",recmaster);
@@ -374,13 +374,13 @@ static int control_get_tickles(struct ctdb_context *ctdb, int argc, const char *
 
        ip.sin_family = AF_INET;
        if (inet_aton(argv[0], &ip.sin_addr) == 0) {
-               DEBUG(0,("Wrongly formed ip address '%s'\n", argv[0]));
+               DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
                return -1;
        }
 
        ret = ctdb_ctrl_get_tcp_tickles(ctdb, TIMELIMIT(), options.pnn, ctdb, &ip, &list);
        if (ret == -1) {
-               DEBUG(0, ("Unable to list tickles\n"));
+               DEBUG(DEBUG_ERR, ("Unable to list tickles\n"));
                return -1;
        }
 
@@ -409,18 +409,18 @@ static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
        }
 
        if (!parse_ip_port(argv[0], &killtcp.src)) {
-               DEBUG(0, ("Bad IP:port '%s'\n", argv[0]));
+               DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[0]));
                return -1;
        }
 
        if (!parse_ip_port(argv[1], &killtcp.dst)) {
-               DEBUG(0, ("Bad IP:port '%s'\n", argv[1]));
+               DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[1]));
                return -1;
        }
 
        ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.pnn, &killtcp);
        if (ret != 0) {
-               DEBUG(0, ("Unable to killtcp from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to killtcp from node %u\n", options.pnn));
                return ret;
        }
 
@@ -442,13 +442,13 @@ static int control_gratious_arp(struct ctdb_context *ctdb, int argc, const char
 
        sin.sin_family = AF_INET;
        if (inet_aton(argv[0], &sin.sin_addr) == 0) {
-               DEBUG(0,("Wrongly formed ip address '%s'\n", argv[0]));
+               DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
                return -1;
        }
 
        ret = ctdb_ctrl_gratious_arp(ctdb, TIMELIMIT(), options.pnn, &sin, argv[1]);
        if (ret != 0) {
-               DEBUG(0, ("Unable to send gratious_arp from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to send gratious_arp from node %u\n", options.pnn));
                return ret;
        }
 
@@ -473,7 +473,7 @@ static int regsrvid(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_ctrl_register_server_id(ctdb, TIMELIMIT(), &server_id);
        if (ret != 0) {
-               DEBUG(0, ("Unable to register server_id from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to register server_id from node %u\n", options.pnn));
                return ret;
        }
        return -1;
@@ -497,7 +497,7 @@ static int unregsrvid(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_ctrl_unregister_server_id(ctdb, TIMELIMIT(), &server_id);
        if (ret != 0) {
-               DEBUG(0, ("Unable to unregister server_id from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to unregister server_id from node %u\n", options.pnn));
                return ret;
        }
        return -1;
@@ -522,7 +522,7 @@ static int chksrvid(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_ctrl_check_server_id(ctdb, TIMELIMIT(), options.pnn, &server_id, &status);
        if (ret != 0) {
-               DEBUG(0, ("Unable to check server_id from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to check server_id from node %u\n", options.pnn));
                return ret;
        }
 
@@ -544,7 +544,7 @@ static int getsrvids(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_ctrl_get_server_id_list(ctdb, ctdb, TIMELIMIT(), options.pnn, &server_ids);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get server_id list from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get server_id list from node %u\n", options.pnn));
                return ret;
        }
 
@@ -571,18 +571,18 @@ static int tickle_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
        }
 
        if (!parse_ip_port(argv[0], &src)) {
-               DEBUG(0, ("Bad IP:port '%s'\n", argv[0]));
+               DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[0]));
                return -1;
        }
 
        if (!parse_ip_port(argv[1], &dst)) {
-               DEBUG(0, ("Bad IP:port '%s'\n", argv[1]));
+               DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[1]));
                return -1;
        }
 
        s = ctdb_sys_open_sending_socket();
        if (s == -1) {
-               DEBUG(0, ("Failed to open socket for sending tickle\n"));
+               DEBUG(DEBUG_ERR, ("Failed to open socket for sending tickle\n"));
                return 0;
        }
 
@@ -591,7 +591,7 @@ static int tickle_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
        if (ret==0) {
                return 0;
        }
-       DEBUG(0, ("Error while sending tickle ack\n"));
+       DEBUG(DEBUG_ERR, ("Error while sending tickle ack\n"));
 
        return -1;
 }
@@ -609,7 +609,7 @@ static int control_ip(struct ctdb_context *ctdb, int argc, const char **argv)
        /* read the public ip list from this node */
        ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.pnn, tmp_ctx, &ips);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get public ips from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get public ips from node %u\n", options.pnn));
                talloc_free(tmp_ctx);
                return ret;
        }
@@ -638,7 +638,7 @@ static int control_getpid(struct ctdb_context *ctdb, int argc, const char **argv
 
        ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.pnn, &pid);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get daemon pid from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get daemon pid from node %u\n", options.pnn));
                return ret;
        }
        printf("Pid:%d\n", pid);
@@ -655,7 +655,7 @@ static int control_disable(struct ctdb_context *ctdb, int argc, const char **arg
 
        ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
        if (ret != 0) {
-               DEBUG(0, ("Unable to disable node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to disable node %u\n", options.pnn));
                return ret;
        }
 
@@ -671,7 +671,7 @@ static int control_enable(struct ctdb_context *ctdb, int argc, const char **argv
 
        ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
        if (ret != 0) {
-               DEBUG(0, ("Unable to enable node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to enable node %u\n", options.pnn));
                return ret;
        }
 
@@ -702,7 +702,7 @@ static int control_ban(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_send_message(ctdb, options.pnn, CTDB_SRVID_BAN_NODE, data);
        if (ret != 0) {
-               DEBUG(0,("Failed to ban node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR,("Failed to ban node %u\n", options.pnn));
                return -1;
        }
        
@@ -723,7 +723,7 @@ static int control_unban(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_send_message(ctdb, options.pnn, CTDB_SRVID_UNBAN_NODE, data);
        if (ret != 0) {
-               DEBUG(0,("Failed to to unban node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR,("Failed to to unban node %u\n", options.pnn));
                return -1;
        }
        
@@ -740,7 +740,7 @@ static int control_shutdown(struct ctdb_context *ctdb, int argc, const char **ar
 
        ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.pnn);
        if (ret != 0) {
-               DEBUG(0, ("Unable to shutdown node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to shutdown node %u\n", options.pnn));
                return ret;
        }
 
@@ -756,13 +756,13 @@ static int control_recover(struct ctdb_context *ctdb, int argc, const char **arg
 
        ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
        if (ret != 0) {
-               DEBUG(0, ("Unable to freeze node\n"));
+               DEBUG(DEBUG_ERR, ("Unable to freeze node\n"));
                return ret;
        }
 
        ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.pnn, CTDB_RECOVERY_ACTIVE);
        if (ret != 0) {
-               DEBUG(0, ("Unable to set recovery mode\n"));
+               DEBUG(DEBUG_ERR, ("Unable to set recovery mode\n"));
                return ret;
        }
 
@@ -780,7 +780,7 @@ static int control_getmonmode(struct ctdb_context *ctdb, int argc, const char **
 
        ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.pnn, &monmode);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get monmode from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get monmode from node %u\n", options.pnn));
                return ret;
        }
        printf("Monitoring mode:%s (%d)\n",monmode==CTDB_MONITORING_ACTIVE?"ACTIVE":"DISABLED",monmode);
@@ -805,14 +805,14 @@ static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv)
        ctdb_db = ctdb_attach(ctdb, db_name, false);
 
        if (ctdb_db == NULL) {
-               DEBUG(0,("Unable to attach to database '%s'\n", db_name));
+               DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
                return -1;
        }
 
        /* traverse and dump the cluster tdb */
        ret = ctdb_dump_db(ctdb_db, stdout);
        if (ret == -1) {
-               DEBUG(0, ("Unable to dump database\n"));
+               DEBUG(DEBUG_ERR, ("Unable to dump database\n"));
                return -1;
        }
        talloc_free(ctdb_db);
@@ -832,7 +832,7 @@ static int control_getdbmap(struct ctdb_context *ctdb, int argc, const char **ar
 
        ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &dbmap);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get dbids from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get dbids from node %u\n", options.pnn));
                return ret;
        }
 
@@ -917,7 +917,7 @@ static int control_getvar(struct ctdb_context *ctdb, int argc, const char **argv
        name = argv[0];
        ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.pnn, name, &value);
        if (ret == -1) {
-               DEBUG(0, ("Unable to get tunable variable '%s'\n", name));
+               DEBUG(DEBUG_ERR, ("Unable to get tunable variable '%s'\n", name));
                return -1;
        }
 
@@ -943,7 +943,7 @@ static int control_setvar(struct ctdb_context *ctdb, int argc, const char **argv
 
        ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.pnn, name, value);
        if (ret == -1) {
-               DEBUG(0, ("Unable to set tunable variable '%s'\n", name));
+               DEBUG(DEBUG_ERR, ("Unable to set tunable variable '%s'\n", name));
                return -1;
        }
        return 0;
@@ -960,7 +960,7 @@ static int control_listvars(struct ctdb_context *ctdb, int argc, const char **ar
 
        ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.pnn, ctdb, &list, &count);
        if (ret == -1) {
-               DEBUG(0, ("Unable to list tunable variables\n"));
+               DEBUG(DEBUG_ERR, ("Unable to list tunable variables\n"));
                return -1;
        }
 
@@ -983,7 +983,7 @@ static int control_getdebug(struct ctdb_context *ctdb, int argc, const char **ar
 
        ret = ctdb_ctrl_get_debuglevel(ctdb, options.pnn, &level);
        if (ret != 0) {
-         DEBUG(0, ("Unable to get debuglevel response from node %u\n", 
+         DEBUG(DEBUG_ERR, ("Unable to get debuglevel response from node %u\n", 
                       options.pnn));
        } else {
                printf("Node %u is at debug level %u\n", options.pnn, level);
@@ -1008,7 +1008,7 @@ static int control_setdebug(struct ctdb_context *ctdb, int argc, const char **ar
 
        ret = ctdb_ctrl_set_debuglevel(ctdb, options.pnn, level);
        if (ret != 0) {
-               DEBUG(0, ("Unable to set debug level on node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to set debug level on node %u\n", options.pnn));
        }
        return 0;
 }
@@ -1023,7 +1023,7 @@ static int control_freeze(struct ctdb_context *ctdb, int argc, const char **argv
 
        ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
        if (ret != 0) {
-               DEBUG(0, ("Unable to freeze node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to freeze node %u\n", options.pnn));
        }               
        return 0;
 }
@@ -1037,7 +1037,7 @@ static int control_thaw(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.pnn);
        if (ret != 0) {
-               DEBUG(0, ("Unable to thaw node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to thaw node %u\n", options.pnn));
        }               
        return 0;
 }
@@ -1058,7 +1058,7 @@ static int control_attach(struct ctdb_context *ctdb, int argc, const char **argv
 
        ctdb_db = ctdb_attach(ctdb, db_name, false);
        if (ctdb_db == NULL) {
-               DEBUG(0,("Unable to attach to database '%s'\n", db_name));
+               DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
                return -1;
        }
 
@@ -1078,7 +1078,7 @@ static int control_dumpmemory(struct ctdb_context *ctdb, int argc, const char **
        ret = ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_DUMP_MEMORY,
                           0, tdb_null, tmp_ctx, &data, &res, NULL, &errmsg);
        if (ret != 0 || res != 0) {
-               DEBUG(0,("Failed to dump memory - %s\n", errmsg));
+               DEBUG(DEBUG_ERR,("Failed to dump memory - %s\n", errmsg));
                talloc_free(tmp_ctx);
                return -1;
        }
@@ -1199,7 +1199,7 @@ int main(int argc, const char *argv[])
        while ((opt = poptGetNextOpt(pc)) != -1) {
                switch (opt) {
                default:
-                       DEBUG(0, ("Invalid option %s: %s\n", 
+                       DEBUG(DEBUG_ERR, ("Invalid option %s: %s\n", 
                                poptBadOption(pc, 0), poptStrerror(opt)));
                        exit(1);
                }
@@ -1237,7 +1237,7 @@ int main(int argc, const char *argv[])
        /* initialise ctdb */
        ctdb = ctdb_cmdline_client(ev);
        if (ctdb == NULL) {
-               DEBUG(0, ("Failed to init ctdb\n"));
+               DEBUG(DEBUG_ERR, ("Failed to init ctdb\n"));
                exit(1);
        }
 
@@ -1276,7 +1276,7 @@ int main(int argc, const char *argv[])
        }
 
        if (i == ARRAY_SIZE(ctdb_commands)) {
-               DEBUG(0, ("Unknown control '%s'\n", control));
+               DEBUG(DEBUG_ERR, ("Unknown control '%s'\n", control));
                exit(1);
        }
 
index f412c0430386f792ce7f9c89b319d531c1b8f362..5e8550b3218705e602b32f12db6ddcfb71aa1507 100644 (file)
@@ -192,7 +192,7 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
        /* add the record to the blob ready to send to the nodes */
        rec = ctdb_marshall_record(vdata->list[lmaster], vdata->ctdb->pnn, key, NULL, tdb_null);
        if (rec == NULL) {
-               DEBUG(0,(__location__ " Out of memory\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
                vdata->traverse_error = true;
                return -1;
        }
@@ -200,7 +200,7 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
        vdata->list[lmaster] = talloc_realloc_size(NULL, vdata->list[lmaster], 
                                                   old_size + rec->length);
        if (vdata->list[lmaster] == NULL) {
-               DEBUG(0,(__location__ " Failed to expand\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to expand\n"));
                vdata->traverse_error = true;
                return -1;
        }
@@ -231,7 +231,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
 
        vdata = talloc_zero(ctdb, struct vacuum_data);
        if (vdata == NULL) {
-               DEBUG(0,(__location__ " Out of memory\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
                return -1;
        }
 
@@ -239,14 +239,14 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
        vdata->vacuum_limit = vacuum_limit;
 
        if (ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, db_id, vdata, &name) != 0) {
-               DEBUG(0,(__location__ " Failed to get name of db 0x%x\n", db_id));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", db_id));
                talloc_free(vdata);
                return -1;
        }
 
        ctdb_db = ctdb_attach(ctdb, name, persistent);
        if (ctdb_db == NULL) {
-               DEBUG(0,(__location__ " Failed to attach to database '%s'\n", name));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
                talloc_free(vdata);
                return -1;
        }
@@ -254,7 +254,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
        /* the list needs to be of length num_nodes */
        vdata->list = talloc_array(vdata, struct ctdb_control_pulldb_reply *, ctdb->vnn_map->size);
        if (vdata->list == NULL) {
-               DEBUG(0,(__location__ " Out of memory\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
                talloc_free(vdata);
                return -1;
        }
@@ -263,7 +263,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
                        talloc_zero_size(vdata->list, 
                                    offsetof(struct ctdb_control_pulldb_reply, data));
                if (vdata->list[i] == NULL) {
-                       DEBUG(0,(__location__ " Out of memory\n"));
+                       DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
                        talloc_free(vdata);
                        return -1;
                }
@@ -273,7 +273,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
        /* traverse, looking for records that might be able to be vacuumed */
        if (tdb_traverse_read(ctdb_db->ltdb->tdb, vacuum_traverse, vdata) == -1 ||
            vdata->traverse_error) {
-               DEBUG(0,(__location__ " Traverse error in vacuuming '%s'\n", name));
+               DEBUG(DEBUG_ERR,(__location__ " Traverse error in vacuuming '%s'\n", name));
                talloc_free(vdata);
                return -1;              
        }
@@ -292,7 +292,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
                        data.dsize = talloc_get_size(vdata->list[i]);
                        data.dptr  = (void *)vdata->list[i];
                        if (ctdb_send_message(ctdb, ctdb->vnn_map->map[i], CTDB_SRVID_VACUUM_FETCH, data) != 0) {
-                               DEBUG(0,(__location__ " Failed to send vacuum fetch message to %u\n",
+                               DEBUG(DEBUG_ERR,(__location__ " Failed to send vacuum fetch message to %u\n",
                                         ctdb->vnn_map->map[i]));
                                talloc_free(vdata);
                                return -1;              
@@ -310,7 +310,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
 
                /* for records where we are the lmaster, we can try to delete them */
                if (ctdb_vacuum_local(ctdb, vdata->list[i], ctdb_db, &count) != 0) {
-                       DEBUG(0,(__location__ " Deletion error in vacuuming '%s'\n", name));
+                       DEBUG(DEBUG_ERR,(__location__ " Deletion error in vacuuming '%s'\n", name));
                        talloc_free(vdata);
                        return -1;                                      
                }
@@ -344,25 +344,25 @@ int ctdb_vacuum(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &dbmap);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get dbids from local node\n"));
+               DEBUG(DEBUG_ERR, ("Unable to get dbids from local node\n"));
                return ret;
        }
 
        ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get nodemap from local node\n"));
+               DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
                return ret;
        }
 
        ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &ctdb->vnn_map);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get vnnmap from local node\n"));
+               DEBUG(DEBUG_ERR, ("Unable to get vnnmap from local node\n"));
                return ret;
        }
 
        pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE);
        if (pnn == -1) {
-               DEBUG(0, ("Unable to get pnn from local node\n"));
+               DEBUG(DEBUG_ERR, ("Unable to get pnn from local node\n"));
                return -1;
        }
        ctdb->pnn = pnn;
@@ -370,7 +370,7 @@ int ctdb_vacuum(struct ctdb_context *ctdb, int argc, const char **argv)
        for (i=0;i<dbmap->num;i++) {
                if (ctdb_vacuum_db(ctdb, dbmap->dbs[i].dbid, nodemap, 
                                   dbmap->dbs[i].persistent, vacuum_limit) != 0) {
-                       DEBUG(0,("Failed to vacuum db 0x%x\n", dbmap->dbs[i].dbid));
+                       DEBUG(DEBUG_ERR,("Failed to vacuum db 0x%x\n", dbmap->dbs[i].dbid));
                        return -1;
                }
        }
@@ -405,13 +405,13 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
        struct traverse_state state;
 
        if (tdb_transaction_start(tdb) != 0) {
-               DEBUG(0,(__location__ " Failed to start transaction\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to start transaction\n"));
                return -1;
        }
 
        tmp_db = tdb_open("tmpdb", tdb_hash_size(tdb), TDB_INTERNAL, O_RDWR|O_CREAT, 0);
        if (tmp_db == NULL) {
-               DEBUG(0,(__location__ " Failed to create tmp_db\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to create tmp_db\n"));
                tdb_transaction_cancel(tdb);
                return -1;
        }
@@ -420,21 +420,21 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
        state.dest_db = tmp_db;
 
        if (tdb_traverse_read(tdb, repack_traverse, &state) == -1) {
-               DEBUG(0,(__location__ " Failed to traverse copying out\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to traverse copying out\n"));
                tdb_transaction_cancel(tdb);
                tdb_close(tmp_db);
                return -1;              
        }
 
        if (state.error) {
-               DEBUG(0,(__location__ " Error during traversal\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Error during traversal\n"));
                tdb_transaction_cancel(tdb);
                tdb_close(tmp_db);
                return -1;
        }
 
        if (tdb_wipe_all(tdb) != 0) {
-               DEBUG(0,(__location__ " Failed to wipe database\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to wipe database\n"));
                tdb_transaction_cancel(tdb);
                tdb_close(tmp_db);
                return -1;
@@ -444,14 +444,14 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
        state.dest_db = tdb;
 
        if (tdb_traverse_read(tmp_db, repack_traverse, &state) == -1) {
-               DEBUG(0,(__location__ " Failed to traverse copying back\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to traverse copying back\n"));
                tdb_transaction_cancel(tdb);
                tdb_close(tmp_db);
                return -1;              
        }
 
        if (state.error) {
-               DEBUG(0,(__location__ " Error during second traversal\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Error during second traversal\n"));
                tdb_transaction_cancel(tdb);
                tdb_close(tmp_db);
                return -1;
@@ -460,7 +460,7 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
        tdb_close(tmp_db);
 
        if (tdb_transaction_commit(tdb) != 0) {
-               DEBUG(0,(__location__ " Failed to commit\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to commit\n"));
                return -1;
        }
 
@@ -477,19 +477,19 @@ static int ctdb_repack_db(struct ctdb_context *ctdb, uint32_t db_id,
        int size;
 
        if (ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, db_id, ctdb, &name) != 0) {
-               DEBUG(0,(__location__ " Failed to get name of db 0x%x\n", db_id));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", db_id));
                return -1;
        }
 
        ctdb_db = ctdb_attach(ctdb, name, persistent);
        if (ctdb_db == NULL) {
-               DEBUG(0,(__location__ " Failed to attach to database '%s'\n", name));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
                return -1;
        }
 
        size = tdb_freelist_size(ctdb_db->ltdb->tdb);
        if (size == -1) {
-               DEBUG(0,(__location__ " Failed to get freelist size for '%s'\n", name));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get freelist size for '%s'\n", name));
                return -1;
        }
 
@@ -500,7 +500,7 @@ static int ctdb_repack_db(struct ctdb_context *ctdb, uint32_t db_id,
        printf("Repacking %s with %u freelist entries\n", name, size);
 
        if (ctdb_repack_tdb(ctdb_db->ltdb->tdb) != 0) {
-               DEBUG(0,(__location__ " Failed to repack '%s'\n", name));
+               DEBUG(DEBUG_ERR,(__location__ " Failed to repack '%s'\n", name));
                return -1;
        }
 
@@ -524,14 +524,14 @@ int ctdb_repack(struct ctdb_context *ctdb, int argc, const char **argv)
 
        ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &dbmap);
        if (ret != 0) {
-               DEBUG(0, ("Unable to get dbids from local node\n"));
+               DEBUG(DEBUG_ERR, ("Unable to get dbids from local node\n"));
                return ret;
        }
 
        for (i=0;i<dbmap->num;i++) {
                if (ctdb_repack_db(ctdb, dbmap->dbs[i].dbid, 
                                   dbmap->dbs[i].persistent, repack_limit) != 0) {
-                       DEBUG(0,("Failed to repack db 0x%x\n", dbmap->dbs[i].dbid));
+                       DEBUG(DEBUG_ERR,("Failed to repack db 0x%x\n", dbmap->dbs[i].dbid));
                        return -1;
                }
        }