}
if (sscanf(argv[0], "%u:%u", &vnn, &pid) != 2) {
- printf("Badly formed vnn:pid\n");
+ fprintf(stderr, "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) {
- printf("Unable to get statistics from node %u\n", nodes[i]);
+ fprintf(stderr, "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) {
- printf("Unable to get statistics from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to reset statistics on node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to get nodemap from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to get vnnmap from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to get recmode from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to get recmaster from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to list tickles\n");
+ fprintf(stderr, "Unable to list tickles\n");
return -1;
}
}
if (!parse_ip_port(argv[0], &killtcp.src)) {
- printf("Bad IP:port '%s'\n", argv[0]);
+ fprintf(stderr, "Bad IP:port '%s'\n", argv[0]);
return -1;
}
if (!parse_ip_port(argv[1], &killtcp.dst)) {
- printf("Bad IP:port '%s'\n", argv[1]);
+ fprintf(stderr, "Bad IP:port '%s'\n", argv[1]);
return -1;
}
ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.vnn, &killtcp);
if (ret != 0) {
- printf("Unable to killtcp from node %u\n", options.vnn);
+ fprintf(stderr, "Unable to killtcp from node %u\n", options.vnn);
return ret;
}
}
if (!parse_ip_port(argv[0], &src)) {
- printf("Bad IP:port '%s'\n", argv[0]);
+ fprintf(stderr, "Bad IP:port '%s'\n", argv[0]);
return -1;
}
if (!parse_ip_port(argv[1], &dst)) {
- printf("Bad IP:port '%s'\n", argv[1]);
+ fprintf(stderr, "Bad IP:port '%s'\n", argv[1]);
return -1;
}
s = ctdb_sys_open_sending_socket();
if (s == -1) {
- printf("Failed to open socket for sending tickle\n");
+ fprintf(stderr, "Failed to open socket for sending tickle\n");
return 0;
}
if (ret==0) {
return 0;
}
- printf("Error while sending tickle ack\n");
+ fprintf(stderr, "Error while sending tickle ack\n");
return -1;
}
ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.vnn, ctdb, &ips);
if (ret != 0) {
- printf("Unable to get public ips from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to get public ips from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to get daemon pid from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to disable node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to enable node %u\n", options.vnn);
+ fprintf(stderr, "Unable to enable node %u\n", options.vnn);
return ret;
}
ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.vnn);
if (ret != 0) {
- printf("Unable to shutdown node %u\n", options.vnn);
+ fprintf(stderr, "Unable to shutdown node %u\n", options.vnn);
return ret;
}
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn);
if (ret != 0) {
- printf("Unable to freeze node\n");
+ fprintf(stderr, "Unable to freeze node\n");
return ret;
}
ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.vnn, CTDB_RECOVERY_ACTIVE);
if (ret != 0) {
- printf("Unable to set recovery mode\n");
+ fprintf(stderr, "Unable to set recovery mode\n");
return ret;
}
ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.vnn, &monmode);
if (ret != 0) {
- printf("Unable to get monmode from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to set monmode on node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to dump database\n");
+ fprintf(stderr, "Unable to dump database\n");
return -1;
}
talloc_free(ctdb_db);
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.vnn, ctdb, &dbmap);
if (ret != 0) {
- printf("Unable to get dbids from node %u\n", options.vnn);
+ fprintf(stderr, "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) {
- printf("Unable to get tunable variable '%s'\n", name);
+ fprintf(stderr, "Unable to get tunable variable '%s'\n", name);
return -1;
}
ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.vnn, name, value);
if (ret == -1) {
- printf("Unable to set tunable variable '%s'\n", name);
+ fprintf(stderr, "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) {
- printf("Unable to list tunable variables\n");
+ fprintf(stderr, "Unable to list tunable variables\n");
return -1;
}
ret = ctdb_ctrl_get_debuglevel(ctdb, options.vnn, &level);
if (ret != 0) {
- printf("Unable to get debuglevel response from node %u\n",
+ fprintf(stderr, "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) {
- printf("Unable to set debug level on node %u\n", options.vnn);
+ fprintf(stderr, "Unable to set debug level on node %u\n", options.vnn);
}
return 0;
}
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn);
if (ret != 0) {
- printf("Unable to freeze node %u\n", options.vnn);
+ fprintf(stderr, "Unable to freeze node %u\n", options.vnn);
}
return 0;
}
ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.vnn);
if (ret != 0) {
- printf("Unable to thaw node %u\n", options.vnn);
+ fprintf(stderr, "Unable to thaw node %u\n", options.vnn);
}
return 0;
}
/* initialise ctdb */
ctdb = ctdb_cmdline_client(ev);
if (ctdb == NULL) {
- printf("Failed to init ctdb\n");
+ fprintf(stderr, "Failed to init ctdb\n");
exit(1);
}
}
if (i == ARRAY_SIZE(ctdb_commands)) {
- printf("Unknown control '%s'\n", control);
+ fprintf(stderr, "Unknown control '%s'\n", control);
exit(1);
}