}
if (sscanf(argv[0], "%u:%u", &vnn, &pid) != 2) {
- fprintf(stderr, "Badly formed vnn:pid\n");
+ DEBUG(0, ("Badly formed vnn:pid\n"));
return -1;
}
offsetof(struct ctdb_statistics, __last_counter) / sizeof(uint32_t);
ret = ctdb_ctrl_statistics(ctdb, nodes[i], &s1);
if (ret != 0) {
- fprintf(stderr, "Unable to get statistics from node %u\n", nodes[i]);
+ DEBUG(0, ("Unable to get statistics from node %u\n", nodes[i]));
return ret;
}
for (j=0;j<num_ints;j++) {
ret = ctdb_ctrl_statistics(ctdb, options.vnn, &statistics);
if (ret != 0) {
- fprintf(stderr, "Unable to get statistics from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get statistics from node %u\n", options.vnn));
return ret;
}
show_statistics(&statistics);
ret = ctdb_statistics_reset(ctdb, options.vnn);
if (ret != 0) {
- fprintf(stderr, "Unable to reset statistics on node %u\n", options.vnn);
+ DEBUG(0, ("Unable to reset statistics on node %u\n", options.vnn));
return ret;
}
return 0;
ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.vnn, ctdb, &nodemap);
if (ret != 0) {
- fprintf(stderr, "Unable to get nodemap from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get nodemap from node %u\n", options.vnn));
return ret;
}
ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.vnn, ctdb, &vnnmap);
if (ret != 0) {
- fprintf(stderr, "Unable to get vnnmap from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get vnnmap from node %u\n", options.vnn));
return ret;
}
printf("Generation:%d\n",vnnmap->generation);
ret = ctdb_ctrl_getrecmode(ctdb, TIMELIMIT(), options.vnn, &recmode);
if (ret != 0) {
- fprintf(stderr, "Unable to get recmode from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get recmode from node %u\n", options.vnn));
return ret;
}
printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode);
ret = ctdb_ctrl_getrecmaster(ctdb, TIMELIMIT(), options.vnn, &recmaster);
if (ret != 0) {
- fprintf(stderr, "Unable to get recmaster from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get recmaster from node %u\n", options.vnn));
return ret;
}
printf("Recovery master:%d\n",recmaster);
ret = ctdb_ctrl_get_tcp_tickles(ctdb, TIMELIMIT(), options.vnn, ctdb, vnn, &list);
if (ret == -1) {
- fprintf(stderr, "Unable to list tickles\n");
+ DEBUG(0, ("Unable to list tickles\n"));
return -1;
}
}
if (!parse_ip_port(argv[0], &killtcp.src)) {
- fprintf(stderr, "Bad IP:port '%s'\n", argv[0]);
+ DEBUG(0, ("Bad IP:port '%s'\n", argv[0]));
return -1;
}
if (!parse_ip_port(argv[1], &killtcp.dst)) {
- fprintf(stderr, "Bad IP:port '%s'\n", argv[1]);
+ DEBUG(0, ("Bad IP:port '%s'\n", argv[1]));
return -1;
}
ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.vnn, &killtcp);
if (ret != 0) {
- fprintf(stderr, "Unable to killtcp from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to killtcp from node %u\n", options.vnn));
return ret;
}
}
if (!parse_ip_port(argv[0], &src)) {
- fprintf(stderr, "Bad IP:port '%s'\n", argv[0]);
+ DEBUG(0, ("Bad IP:port '%s'\n", argv[0]));
return -1;
}
if (!parse_ip_port(argv[1], &dst)) {
- fprintf(stderr, "Bad IP:port '%s'\n", argv[1]);
+ DEBUG(0, ("Bad IP:port '%s'\n", argv[1]));
return -1;
}
s = ctdb_sys_open_sending_socket();
if (s == -1) {
- fprintf(stderr, "Failed to open socket for sending tickle\n");
+ DEBUG(0, ("Failed to open socket for sending tickle\n"));
return 0;
}
if (ret==0) {
return 0;
}
- fprintf(stderr, "Error while sending tickle ack\n");
+ DEBUG(0, ("Error while sending tickle ack\n"));
return -1;
}
ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.vnn, ctdb, &ips);
if (ret != 0) {
- fprintf(stderr, "Unable to get public ips from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get public ips from node %u\n", options.vnn));
return ret;
}
ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.vnn, ctdb, &ips);
if (ret != 0) {
- fprintf(stderr, "Unable to get public ips from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get public ips from node %u\n", options.vnn));
return ret;
}
ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.vnn, &pid);
if (ret != 0) {
- fprintf(stderr, "Unable to get daemon pid from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get daemon pid from node %u\n", options.vnn));
return ret;
}
printf("Pid:%d\n", pid);
ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.vnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
if (ret != 0) {
- fprintf(stderr, "Unable to disable node %u\n", options.vnn);
+ DEBUG(0, ("Unable to disable node %u\n", options.vnn));
return ret;
}
ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.vnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
if (ret != 0) {
- fprintf(stderr, "Unable to enable node %u\n", options.vnn);
+ DEBUG(0, ("Unable to enable node %u\n", options.vnn));
return ret;
}
ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.vnn);
if (ret != 0) {
- fprintf(stderr, "Unable to shutdown node %u\n", options.vnn);
+ DEBUG(0, ("Unable to shutdown node %u\n", options.vnn));
return ret;
}
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn);
if (ret != 0) {
- fprintf(stderr, "Unable to freeze node\n");
+ DEBUG(0, ("Unable to freeze node\n"));
return ret;
}
ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.vnn, CTDB_RECOVERY_ACTIVE);
if (ret != 0) {
- fprintf(stderr, "Unable to set recovery mode\n");
+ DEBUG(0, ("Unable to set recovery mode\n"));
return ret;
}
ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.vnn, &monmode);
if (ret != 0) {
- fprintf(stderr, "Unable to get monmode from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get monmode from node %u\n", options.vnn));
return ret;
}
printf("Monitoring mode:%s (%d)\n",monmode==CTDB_MONITORING_ACTIVE?"ACTIVE":"DISABLED",monmode);
ret = ctdb_ctrl_setmonmode(ctdb, TIMELIMIT(), options.vnn, monmode);
if (ret != 0) {
- fprintf(stderr, "Unable to set monmode on node %u\n", options.vnn);
+ DEBUG(0, ("Unable to set monmode on node %u\n", options.vnn));
return ret;
}
/* traverse and dump the cluster tdb */
ret = ctdb_dump_db(ctdb_db, stdout);
if (ret == -1) {
- fprintf(stderr, "Unable to dump database\n");
+ DEBUG(0, ("Unable to dump database\n"));
return -1;
}
talloc_free(ctdb_db);
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.vnn, ctdb, &dbmap);
if (ret != 0) {
- fprintf(stderr, "Unable to get dbids from node %u\n", options.vnn);
+ DEBUG(0, ("Unable to get dbids from node %u\n", options.vnn));
return ret;
}
name = argv[0];
ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.vnn, name, &value);
if (ret == -1) {
- fprintf(stderr, "Unable to get tunable variable '%s'\n", name);
+ DEBUG(0, ("Unable to get tunable variable '%s'\n", name));
return -1;
}
ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.vnn, name, value);
if (ret == -1) {
- fprintf(stderr, "Unable to set tunable variable '%s'\n", name);
+ DEBUG(0, ("Unable to set tunable variable '%s'\n", name));
return -1;
}
return 0;
ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.vnn, ctdb, &list, &count);
if (ret == -1) {
- fprintf(stderr, "Unable to list tunable variables\n");
+ DEBUG(0, ("Unable to list tunable variables\n"));
return -1;
}
ret = ctdb_ctrl_get_debuglevel(ctdb, options.vnn, &level);
if (ret != 0) {
- fprintf(stderr, "Unable to get debuglevel response from node %u\n",
- options.vnn);
+ DEBUG(0, ("Unable to get debuglevel response from node %u\n",
+ options.vnn));
} else {
printf("Node %u is at debug level %u\n", options.vnn, level);
}
ret = ctdb_ctrl_set_debuglevel(ctdb, options.vnn, level);
if (ret != 0) {
- fprintf(stderr, "Unable to set debug level on node %u\n", options.vnn);
+ DEBUG(0, ("Unable to set debug level on node %u\n", options.vnn));
}
return 0;
}
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn);
if (ret != 0) {
- fprintf(stderr, "Unable to freeze node %u\n", options.vnn);
+ DEBUG(0, ("Unable to freeze node %u\n", options.vnn));
}
return 0;
}
ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.vnn);
if (ret != 0) {
- fprintf(stderr, "Unable to thaw node %u\n", options.vnn);
+ DEBUG(0, ("Unable to thaw node %u\n", options.vnn));
}
return 0;
}
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
default:
- fprintf(stderr, "Invalid option %s: %s\n",
- poptBadOption(pc, 0), poptStrerror(opt));
+ DEBUG(0, ("Invalid option %s: %s\n",
+ poptBadOption(pc, 0), poptStrerror(opt)));
exit(1);
}
}
/* initialise ctdb */
ctdb = ctdb_cmdline_client(ev);
if (ctdb == NULL) {
- fprintf(stderr, "Failed to init ctdb\n");
+ DEBUG(0, ("Failed to init ctdb\n"));
exit(1);
}
}
if (i == ARRAY_SIZE(ctdb_commands)) {
- fprintf(stderr, "Unknown control '%s'\n", control);
+ DEBUG(0, ("Unknown control '%s'\n", control));
exit(1);
}