static struct {
int timelimit;
- uint32_t vnn;
+ uint32_t pnn;
int machinereadable;
} options;
*/
static int control_process_exists(struct ctdb_context *ctdb, int argc, const char **argv)
{
- uint32_t vnn, pid;
+ uint32_t pnn, pid;
int ret;
if (argc < 1) {
usage();
}
- if (sscanf(argv[0], "%u:%u", &vnn, &pid) != 2) {
- DEBUG(0, ("Badly formed vnn:pid\n"));
+ if (sscanf(argv[0], "%u:%u", &pnn, &pid) != 2) {
+ DEBUG(0, ("Badly formed pnn:pid\n"));
return -1;
}
- ret = ctdb_ctrl_process_exists(ctdb, vnn, pid);
+ ret = ctdb_ctrl_process_exists(ctdb, pnn, pid);
if (ret == 0) {
- printf("%u:%u exists\n", vnn, pid);
+ printf("%u:%u exists\n", pnn, pid);
} else {
- printf("%u:%u does not exist\n", vnn, pid);
+ printf("%u:%u does not exist\n", pnn, pid);
}
return ret;
}
int ret;
struct ctdb_statistics statistics;
- if (options.vnn == CTDB_BROADCAST_ALL) {
+ if (options.pnn == CTDB_BROADCAST_ALL) {
return control_statistics_all(ctdb);
}
- ret = ctdb_ctrl_statistics(ctdb, options.vnn, &statistics);
+ ret = ctdb_ctrl_statistics(ctdb, options.pnn, &statistics);
if (ret != 0) {
- DEBUG(0, ("Unable to get statistics from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to get statistics from node %u\n", options.pnn));
return ret;
}
show_statistics(&statistics);
{
int ret;
- ret = ctdb_statistics_reset(ctdb, options.vnn);
+ ret = ctdb_statistics_reset(ctdb, options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to reset statistics on node %u\n", options.vnn));
+ DEBUG(0, ("Unable to reset statistics on node %u\n", options.pnn));
return ret;
}
return 0;
struct ctdb_vnn_map *vnnmap=NULL;
struct ctdb_node_map *nodemap=NULL;
uint32_t recmode, recmaster;
- int myvnn;
+ int mypnn;
- myvnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);
- if (myvnn == -1) {
+ mypnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.pnn);
+ if (mypnn == -1) {
return -1;
}
- ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.vnn, ctdb, &nodemap);
+ ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap);
if (ret != 0) {
- DEBUG(0, ("Unable to get nodemap from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to get nodemap from node %u\n", options.pnn));
return ret;
}
printf("pnn:%d %-16s %s%s\n", nodemap->nodes[i].pnn,
inet_ntoa(nodemap->nodes[i].sin.sin_addr),
flags_str,
- nodemap->nodes[i].pnn == myvnn?" (THIS NODE)":"");
+ nodemap->nodes[i].pnn == mypnn?" (THIS NODE)":"");
talloc_free(flags_str);
}
- ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.vnn, ctdb, &vnnmap);
+ ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &vnnmap);
if (ret != 0) {
- DEBUG(0, ("Unable to get vnnmap from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to get vnnmap from node %u\n", options.pnn));
return ret;
}
if (vnnmap->generation == INVALID_GENERATION) {
printf("hash:%d lmaster:%d\n", i, vnnmap->map[i]);
}
- ret = ctdb_ctrl_getrecmode(ctdb, ctdb, TIMELIMIT(), options.vnn, &recmode);
+ ret = ctdb_ctrl_getrecmode(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmode);
if (ret != 0) {
- DEBUG(0, ("Unable to get recmode from node %u\n", options.vnn));
+ DEBUG(0, ("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.vnn, &recmaster);
+ ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
if (ret != 0) {
- DEBUG(0, ("Unable to get recmaster from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to get recmaster from node %u\n", options.pnn));
return ret;
}
printf("Recovery master:%d\n",recmaster);
}
/*
- get a list of all tickles for this vnn
+ get a list of all tickles for this pnn
*/
static int control_get_tickles(struct ctdb_context *ctdb, int argc, const char **argv)
{
return -1;
}
- ret = ctdb_ctrl_get_tcp_tickles(ctdb, TIMELIMIT(), options.vnn, ctdb, &ip, &list);
+ ret = ctdb_ctrl_get_tcp_tickles(ctdb, TIMELIMIT(), options.pnn, ctdb, &ip, &list);
if (ret == -1) {
DEBUG(0, ("Unable to list tickles\n"));
return -1;
return -1;
}
- ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.vnn, &killtcp);
+ ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.pnn, &killtcp);
if (ret != 0) {
- DEBUG(0, ("Unable to killtcp from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to killtcp from node %u\n", options.pnn));
return ret;
}
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.vnn));
+ DEBUG(0, ("Unable to register server_id from node %u\n", options.pnn));
return ret;
}
return -1;
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.vnn));
+ DEBUG(0, ("Unable to unregister server_id from node %u\n", options.pnn));
return ret;
}
return -1;
server_id.type = strtoul(argv[1], NULL, 0);
server_id.server_id = strtoul(argv[2], NULL, 0);
- ret = ctdb_ctrl_check_server_id(ctdb, TIMELIMIT(), options.vnn, &server_id, &status);
+ 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.vnn));
+ DEBUG(0, ("Unable to check server_id from node %u\n", options.pnn));
return ret;
}
int i, ret;
struct ctdb_server_id_list *server_ids;
- ret = ctdb_ctrl_get_server_id_list(ctdb, ctdb, TIMELIMIT(), options.vnn, &server_ids);
+ 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.vnn));
+ DEBUG(0, ("Unable to get server_id list from node %u\n", options.pnn));
return ret;
}
{
int i, ret;
struct ctdb_all_public_ips *ips;
- int myvnn;
+ int mypnn;
- myvnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);
- if (myvnn == -1) {
+ mypnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.pnn);
+ if (mypnn == -1) {
return -1;
}
- ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.vnn, ctdb, &ips);
+ ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.pnn, ctdb, &ips);
if (ret != 0) {
- DEBUG(0, ("Unable to get public ips from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to get public ips from node %u\n", options.pnn));
return ret;
}
{
int ret;
struct ctdb_all_public_ips *ips;
- int myvnn;
+ int mypnn;
- myvnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);
- if (myvnn == -1) {
+ mypnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.pnn);
+ if (mypnn == -1) {
return -1;
}
- ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.vnn, ctdb, &ips);
+ ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.pnn, ctdb, &ips);
if (ret != 0) {
- DEBUG(0, ("Unable to get public ips from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to get public ips from node %u\n", options.pnn));
return ret;
}
- printf("%-16s\n", inet_ntoa(ips->ips[myvnn].sin.sin_addr));
+ printf("%-16s\n", inet_ntoa(ips->ips[mypnn].sin.sin_addr));
return 0;
}
uint32_t pid;
int ret;
- ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.vnn, &pid);
+ ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.pnn, &pid);
if (ret != 0) {
- DEBUG(0, ("Unable to get daemon pid from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to get daemon pid from node %u\n", options.pnn));
return ret;
}
printf("Pid:%d\n", pid);
{
int ret;
- ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.vnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
+ 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.vnn));
+ DEBUG(0, ("Unable to disable node %u\n", options.pnn));
return ret;
}
{
int ret;
- ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.vnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
+ 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.vnn));
+ DEBUG(0, ("Unable to enable node %u\n", options.pnn));
return ret;
}
ban_time = strtoul(argv[0], NULL, 0);
- ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.vnn, &recmaster);
+ ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
if (ret != 0) {
DEBUG(0,("Failed to find the recmaster\n"));
return -1;
}
- b.vnn = options.vnn;
+ b.vnn = options.pnn;
b.ban_time = ban_time;
data.dptr = (uint8_t *)&b;
ret = ctdb_send_message(ctdb, recmaster, CTDB_SRVID_BAN_NODE, data);
if (ret != 0) {
- DEBUG(0,("Failed to tell the recmaster to ban node %u\n", options.vnn));
+ DEBUG(0,("Failed to tell the recmaster to ban node %u\n", options.pnn));
return -1;
}
uint32_t recmaster;
TDB_DATA data;
- ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.vnn, &recmaster);
+ ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
if (ret != 0) {
DEBUG(0,("Failed to find the recmaster\n"));
return -1;
}
- data.dptr = (uint8_t *)&options.vnn;
+ data.dptr = (uint8_t *)&options.pnn;
data.dsize = sizeof(uint32_t);
ret = ctdb_send_message(ctdb, recmaster, CTDB_SRVID_UNBAN_NODE, data);
if (ret != 0) {
- DEBUG(0,("Failed to tell the recmaster to unban node %u\n", options.vnn));
+ DEBUG(0,("Failed to tell the recmaster to unban node %u\n", options.pnn));
return -1;
}
{
int ret;
- ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.vnn);
+ ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to shutdown node %u\n", options.vnn));
+ DEBUG(0, ("Unable to shutdown node %u\n", options.pnn));
return ret;
}
{
int ret;
- ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn);
+ ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
DEBUG(0, ("Unable to freeze node\n"));
return ret;
}
- ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.vnn, CTDB_RECOVERY_ACTIVE);
+ ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.pnn, CTDB_RECOVERY_ACTIVE);
if (ret != 0) {
DEBUG(0, ("Unable to set recovery mode\n"));
return ret;
uint32_t monmode;
int ret;
- ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.vnn, &monmode);
+ ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.pnn, &monmode);
if (ret != 0) {
- DEBUG(0, ("Unable to get monmode from node %u\n", options.vnn));
+ DEBUG(0, ("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);
monmode = strtoul(argv[0], NULL, 0);
- ret = ctdb_ctrl_setmonmode(ctdb, TIMELIMIT(), options.vnn, monmode);
+ ret = ctdb_ctrl_setmonmode(ctdb, TIMELIMIT(), options.pnn, monmode);
if (ret != 0) {
- DEBUG(0, ("Unable to set monmode on node %u\n", options.vnn));
+ DEBUG(0, ("Unable to set monmode on node %u\n", options.pnn));
return ret;
}
int i, ret;
struct ctdb_dbid_map *dbmap=NULL;
- ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.vnn, ctdb, &dbmap);
+ ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &dbmap);
if (ret != 0) {
- DEBUG(0, ("Unable to get dbids from node %u\n", options.vnn));
+ DEBUG(0, ("Unable to get dbids from node %u\n", options.pnn));
return ret;
}
const char *path;
const char *name;
- ctdb_ctrl_getdbpath(ctdb, TIMELIMIT(), options.vnn, dbmap->dbids[i], ctdb, &path);
- ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.vnn, dbmap->dbids[i], ctdb, &name);
+ ctdb_ctrl_getdbpath(ctdb, TIMELIMIT(), options.pnn, dbmap->dbids[i], ctdb, &path);
+ ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.pnn, dbmap->dbids[i], ctdb, &name);
printf("dbid:0x%08x name:%s path:%s\n", dbmap->dbids[i], name, path);
}
{
int ret;
struct timeval tv = timeval_current();
- ret = ctdb_ctrl_ping(ctdb, options.vnn);
+ ret = ctdb_ctrl_ping(ctdb, options.pnn);
if (ret == -1) {
- printf("Unable to get ping response from node %u\n", options.vnn);
+ printf("Unable to get ping response from node %u\n", options.pnn);
} else {
printf("response from %u time=%.6f sec (%d clients)\n",
- options.vnn, timeval_elapsed(&tv), ret);
+ options.pnn, timeval_elapsed(&tv), ret);
}
return 0;
}
}
name = argv[0];
- ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.vnn, name, &value);
+ ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.pnn, name, &value);
if (ret == -1) {
DEBUG(0, ("Unable to get tunable variable '%s'\n", name));
return -1;
name = argv[0];
value = strtoul(argv[1], NULL, 0);
- ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.vnn, name, value);
+ ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.pnn, name, value);
if (ret == -1) {
DEBUG(0, ("Unable to set tunable variable '%s'\n", name));
return -1;
const char **list;
int ret, i;
- ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.vnn, ctdb, &list, &count);
+ ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.pnn, ctdb, &list, &count);
if (ret == -1) {
DEBUG(0, ("Unable to list tunable variables\n"));
return -1;
int ret;
uint32_t level;
- ret = ctdb_ctrl_get_debuglevel(ctdb, options.vnn, &level);
+ ret = ctdb_ctrl_get_debuglevel(ctdb, options.pnn, &level);
if (ret != 0) {
DEBUG(0, ("Unable to get debuglevel response from node %u\n",
- options.vnn));
+ options.pnn));
} else {
- printf("Node %u is at debug level %u\n", options.vnn, level);
+ printf("Node %u is at debug level %u\n", options.pnn, level);
}
return 0;
}
level = strtoul(argv[0], NULL, 0);
- ret = ctdb_ctrl_set_debuglevel(ctdb, options.vnn, level);
+ ret = ctdb_ctrl_set_debuglevel(ctdb, options.pnn, level);
if (ret != 0) {
- DEBUG(0, ("Unable to set debug level on node %u\n", options.vnn));
+ DEBUG(0, ("Unable to set debug level on node %u\n", options.pnn));
}
return 0;
}
{
int ret;
- ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn);
+ ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to freeze node %u\n", options.vnn));
+ DEBUG(0, ("Unable to freeze node %u\n", options.pnn));
}
return 0;
}
{
int ret;
- ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.vnn);
+ ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to thaw node %u\n", options.vnn));
+ DEBUG(0, ("Unable to thaw node %u\n", options.pnn));
}
return 0;
}
*/
static int control_dumpmemory(struct ctdb_context *ctdb, int argc, const char **argv)
{
- return ctdb_control(ctdb, options.vnn, 0, CTDB_CONTROL_DUMP_MEMORY,
+ return ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_DUMP_MEMORY,
CTDB_CTRL_FLAG_NOREPLY, tdb_null, NULL, NULL, NULL, NULL, NULL);
}
{ "tickle", tickle_tcp, false, "send a tcp tickle ack", "<srcip:port> <dstip:port>" },
{ "gettickles", control_get_tickles, false, "get the list of tickles registered for this ip", "<ip>" },
- { "regsrvid", regsrvid, false, "register a server id", "<vnn> <type> <id>" },
- { "unregsrvid", unregsrvid, false, "unregister a server id", "<vnn> <type> <id>" },
- { "chksrvid", chksrvid, false, "check if a server id exists", "<vnn> <type> <id>" },
+ { "regsrvid", regsrvid, false, "register a server id", "<pnn> <type> <id>" },
+ { "unregsrvid", unregsrvid, false, "unregister a server id", "<pnn> <type> <id>" },
+ { "chksrvid", chksrvid, false, "check if a server id exists", "<pnn> <type> <id>" },
{ "getsrvids", getsrvids, false, "get a list of all server ids"},
};
/* set some defaults */
options.timelimit = 3;
- options.vnn = CTDB_CURRENT_NODE;
+ options.pnn = CTDB_CURRENT_NODE;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
/* setup the node number to contact */
if (nodestring != NULL) {
if (strcmp(nodestring, "all") == 0) {
- options.vnn = CTDB_BROADCAST_ALL;
+ options.pnn = CTDB_BROADCAST_ALL;
} else {
- options.vnn = strtoul(nodestring, NULL, 0);
+ options.pnn = strtoul(nodestring, NULL, 0);
}
}
if (strcmp(control, ctdb_commands[i].name) == 0) {
int j;
- if (options.vnn == CTDB_CURRENT_NODE) {
- int vnn;
- vnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);
- if (vnn == -1) {
+ if (options.pnn == CTDB_CURRENT_NODE) {
+ int pnn;
+ pnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.pnn);
+ if (pnn == -1) {
return -1;
}
- options.vnn = vnn;
+ options.pnn = pnn;
}
if (ctdb_commands[i].auto_all &&
- options.vnn == CTDB_BROADCAST_ALL) {
+ options.pnn == CTDB_BROADCAST_ALL) {
uint32_t *nodes;
uint32_t num_nodes;
ret = 0;
CTDB_NO_MEMORY(ctdb, nodes);
for (j=0;j<num_nodes;j++) {
- options.vnn = nodes[j];
+ options.pnn = nodes[j];
ret |= ctdb_commands[i].fn(ctdb, extra_argc-1, extra_argv+1);
}
talloc_free(nodes);