4 Copyright (C) Andrew Tridgell 2007
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include "lib/events/events.h"
22 #include "system/filesys.h"
23 #include "system/network.h"
26 #include "../include/ctdb.h"
27 #include "../include/ctdb_private.h"
29 static void usage(void);
37 #define TIMELIMIT() timeval_current_ofs(options.timelimit, 0)
40 see if a process exists
42 static int control_process_exists(struct ctdb_context *ctdb, int argc, const char **argv)
50 if (sscanf(argv[0], "%u:%u", &vnn, &pid) != 2) {
51 printf("Badly formed vnn:pid\n");
55 ret = ctdb_ctrl_process_exists(ctdb, vnn, pid);
57 printf("%u:%u exists\n", vnn, pid);
59 printf("%u:%u does not exist\n", vnn, pid);
65 display statistics structure
67 static void show_statistics(struct ctdb_statistics *s)
69 TALLOC_CTX *tmp_ctx = talloc_new(NULL);
71 const char *prefix=NULL;
77 #define STATISTICS_FIELD(n) { #n, offsetof(struct ctdb_statistics, n) }
78 STATISTICS_FIELD(num_clients),
79 STATISTICS_FIELD(frozen),
80 STATISTICS_FIELD(recovering),
81 STATISTICS_FIELD(client_packets_sent),
82 STATISTICS_FIELD(client_packets_recv),
83 STATISTICS_FIELD(node_packets_sent),
84 STATISTICS_FIELD(node_packets_recv),
85 STATISTICS_FIELD(keepalive_packets_sent),
86 STATISTICS_FIELD(keepalive_packets_recv),
87 STATISTICS_FIELD(node.req_call),
88 STATISTICS_FIELD(node.reply_call),
89 STATISTICS_FIELD(node.req_dmaster),
90 STATISTICS_FIELD(node.reply_dmaster),
91 STATISTICS_FIELD(node.reply_error),
92 STATISTICS_FIELD(node.req_message),
93 STATISTICS_FIELD(node.req_control),
94 STATISTICS_FIELD(node.reply_control),
95 STATISTICS_FIELD(client.req_call),
96 STATISTICS_FIELD(client.req_message),
97 STATISTICS_FIELD(client.req_control),
98 STATISTICS_FIELD(timeouts.call),
99 STATISTICS_FIELD(timeouts.control),
100 STATISTICS_FIELD(timeouts.traverse),
101 STATISTICS_FIELD(total_calls),
102 STATISTICS_FIELD(pending_calls),
103 STATISTICS_FIELD(lockwait_calls),
104 STATISTICS_FIELD(pending_lockwait_calls),
105 STATISTICS_FIELD(memory_used),
106 STATISTICS_FIELD(max_hop_count),
108 printf("CTDB version %u\n", CTDB_VERSION);
109 for (i=0;i<ARRAY_SIZE(fields);i++) {
110 if (strchr(fields[i].name, '.')) {
111 preflen = strcspn(fields[i].name, ".")+1;
112 if (!prefix || strncmp(prefix, fields[i].name, preflen) != 0) {
113 prefix = fields[i].name;
114 printf(" %*.*s\n", preflen-1, preflen-1, fields[i].name);
119 printf(" %*s%-22s%*s%10u\n",
121 fields[i].name+preflen,
123 *(uint32_t *)(fields[i].offset+(uint8_t *)s));
125 printf(" %-30s %.6f sec\n", "max_call_latency", s->max_call_latency);
126 printf(" %-30s %.6f sec\n", "max_lockwait_latency", s->max_lockwait_latency);
127 talloc_free(tmp_ctx);
131 display remote ctdb statistics combined from all nodes
133 static int control_statistics_all(struct ctdb_context *ctdb)
136 struct ctdb_statistics statistics;
140 nodes = ctdb_get_connected_nodes(ctdb, TIMELIMIT(), ctdb, &num_nodes);
141 CTDB_NO_MEMORY(ctdb, nodes);
143 ZERO_STRUCT(statistics);
145 for (i=0;i<num_nodes;i++) {
146 struct ctdb_statistics s1;
148 uint32_t *v1 = (uint32_t *)&s1;
149 uint32_t *v2 = (uint32_t *)&statistics;
151 offsetof(struct ctdb_statistics, __last_counter) / sizeof(uint32_t);
152 ret = ctdb_ctrl_statistics(ctdb, nodes[i], &s1);
154 printf("Unable to get statistics from node %u\n", nodes[i]);
157 for (j=0;j<num_ints;j++) {
160 statistics.max_hop_count =
161 MAX(statistics.max_hop_count, s1.max_hop_count);
162 statistics.max_call_latency =
163 MAX(statistics.max_call_latency, s1.max_call_latency);
164 statistics.max_lockwait_latency =
165 MAX(statistics.max_lockwait_latency, s1.max_lockwait_latency);
168 printf("Gathered statistics for %u nodes\n", num_nodes);
169 show_statistics(&statistics);
174 display remote ctdb statistics
176 static int control_statistics(struct ctdb_context *ctdb, int argc, const char **argv)
179 struct ctdb_statistics statistics;
181 if (options.vnn == CTDB_BROADCAST_ALL) {
182 return control_statistics_all(ctdb);
185 ret = ctdb_ctrl_statistics(ctdb, options.vnn, &statistics);
187 printf("Unable to get statistics from node %u\n", options.vnn);
190 show_statistics(&statistics);
196 reset remote ctdb statistics
198 static int control_statistics_reset(struct ctdb_context *ctdb, int argc, const char **argv)
202 ret = ctdb_statistics_reset(ctdb, options.vnn);
204 printf("Unable to reset statistics on node %u\n", options.vnn);
212 display remote ctdb status
214 static int control_status(struct ctdb_context *ctdb, int argc, const char **argv)
217 struct ctdb_vnn_map *vnnmap=NULL;
218 struct ctdb_node_map *nodemap=NULL;
219 uint32_t recmode, recmaster;
222 myvnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);
224 ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.vnn, ctdb, &nodemap);
226 printf("Unable to get nodemap from node %u\n", options.vnn);
230 if(options.machinereadable){
231 printf(":Node:IP:Disonnected:Disabled:Permanently Disabled:\n");
232 for(i=0;i<nodemap->num;i++){
233 printf(":%d:%s:%d:%d:%d:\n", nodemap->nodes[i].vnn,
234 inet_ntoa(nodemap->nodes[i].sin.sin_addr),
235 !!(nodemap->nodes[i].flags&NODE_FLAGS_DISCONNECTED),
236 !!(nodemap->nodes[i].flags&NODE_FLAGS_UNHEALTHY),
237 !!(nodemap->nodes[i].flags&NODE_FLAGS_PERMANENTLY_DISABLED));
242 printf("Number of nodes:%d\n", nodemap->num);
243 for(i=0;i<nodemap->num;i++){
244 static const struct {
248 { NODE_FLAGS_DISCONNECTED, "DISCONNECTED" },
249 { NODE_FLAGS_PERMANENTLY_DISABLED, "DISABLED" },
250 { NODE_FLAGS_BANNED, "BANNED" },
251 { NODE_FLAGS_UNHEALTHY, "UNHEALTHY" },
253 char *flags_str = NULL;
255 for (j=0;j<ARRAY_SIZE(flag_names);j++) {
256 if (nodemap->nodes[i].flags & flag_names[j].flag) {
257 if (flags_str == NULL) {
258 flags_str = talloc_strdup(ctdb, flag_names[j].name);
260 flags_str = talloc_asprintf_append(flags_str, "|%s",
263 CTDB_NO_MEMORY_FATAL(ctdb, flags_str);
266 if (flags_str == NULL) {
267 flags_str = talloc_strdup(ctdb, "OK");
268 CTDB_NO_MEMORY_FATAL(ctdb, flags_str);
270 printf("vnn:%d %-16s %s%s\n", nodemap->nodes[i].vnn,
271 inet_ntoa(nodemap->nodes[i].sin.sin_addr),
273 nodemap->nodes[i].vnn == myvnn?" (THIS NODE)":"");
274 talloc_free(flags_str);
277 ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.vnn, ctdb, &vnnmap);
279 printf("Unable to get vnnmap from node %u\n", options.vnn);
282 printf("Generation:%d\n",vnnmap->generation);
283 printf("Size:%d\n",vnnmap->size);
284 for(i=0;i<vnnmap->size;i++){
285 printf("hash:%d lmaster:%d\n", i, vnnmap->map[i]);
288 ret = ctdb_ctrl_getrecmode(ctdb, TIMELIMIT(), options.vnn, &recmode);
290 printf("Unable to get recmode from node %u\n", options.vnn);
293 printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode);
295 ret = ctdb_ctrl_getrecmaster(ctdb, TIMELIMIT(), options.vnn, &recmaster);
297 printf("Unable to get recmaster from node %u\n", options.vnn);
300 printf("Recovery master:%d\n",recmaster);
306 kill a tcp connection
308 static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
311 struct sockaddr_in src, dst;
317 if (!parse_ip_port(argv[0], &src)) {
318 printf("Bad IP:port '%s'\n", argv[0]);
322 if (!parse_ip_port(argv[1], &dst)) {
323 printf("Bad IP:port '%s'\n", argv[1]);
327 numrst = strtoul(argv[2], NULL, 0);
329 for (i=0;i<numrst;i++) {
330 ret = ctdb_sys_kill_tcp(ctdb->ev, &src, &dst);
332 printf("ret:%d\n", ret);
342 send a tcp tickle ack
344 static int tickle_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
347 struct sockaddr_in src, dst;
353 if (!parse_ip_port(argv[0], &src)) {
354 printf("Bad IP:port '%s'\n", argv[0]);
358 if (!parse_ip_port(argv[1], &dst)) {
359 printf("Bad IP:port '%s'\n", argv[1]);
363 ret = ctdb_sys_send_tcp(&src, &dst, 0, 0, 0);
367 printf("Error while sending tickle ack\n");
373 display public ip status
375 static int control_ip(struct ctdb_context *ctdb, int argc, const char **argv)
378 struct ctdb_all_public_ips *ips;
381 myvnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);
383 ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.vnn, ctdb, &ips);
385 printf("Unable to get public ips from node %u\n", options.vnn);
389 if(options.machinereadable){
390 printf(":Public IP:Node:\n");
391 for(i=0;i<ips->num;i++){
393 inet_ntoa(ips->ips[i].sin.sin_addr),
394 ips->ips[i].takeover_vnn);
400 printf("Number of nodes:%d\n", ips->num);
401 for(i=0;i<ips->num;i++){
403 inet_ntoa(ips->ips[i].sin.sin_addr),
404 ips->ips[i].takeover_vnn);
411 display pid of a ctdb daemon
413 static int control_getpid(struct ctdb_context *ctdb, int argc, const char **argv)
418 ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.vnn, &pid);
420 printf("Unable to get daemon pid from node %u\n", options.vnn);
423 printf("Pid:%d\n", pid);
429 disable a remote node
431 static int control_disable(struct ctdb_context *ctdb, int argc, const char **argv)
435 ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.vnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
437 printf("Unable to disable node %u\n", options.vnn);
445 enable a disabled remote node
447 static int control_enable(struct ctdb_context *ctdb, int argc, const char **argv)
451 ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.vnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
453 printf("Unable to enable node %u\n", options.vnn);
461 ban a node from the cluster
463 static int control_ban(struct ctdb_context *ctdb, int argc, const char **argv)
467 struct ctdb_ban_info b;
475 ban_time = strtoul(argv[0], NULL, 0);
477 ret = ctdb_ctrl_getrecmaster(ctdb, TIMELIMIT(), options.vnn, &recmaster);
479 DEBUG(0,("Failed to find the recmaster\n"));
484 b.ban_time = ban_time;
486 data.dptr = (uint8_t *)&b;
487 data.dsize = sizeof(b);
489 ret = ctdb_send_message(ctdb, recmaster, CTDB_SRVID_BAN_NODE, data);
491 DEBUG(0,("Failed to tell the recmaster to ban node %u\n", options.vnn));
500 unban a node from the cluster
502 static int control_unban(struct ctdb_context *ctdb, int argc, const char **argv)
508 ret = ctdb_ctrl_getrecmaster(ctdb, TIMELIMIT(), options.vnn, &recmaster);
510 DEBUG(0,("Failed to find the recmaster\n"));
514 data.dptr = (uint8_t *)&options.vnn;
515 data.dsize = sizeof(uint32_t);
517 ret = ctdb_send_message(ctdb, recmaster, CTDB_SRVID_UNBAN_NODE, data);
519 DEBUG(0,("Failed to tell the recmaster to unban node %u\n", options.vnn));
530 static int control_shutdown(struct ctdb_context *ctdb, int argc, const char **argv)
534 ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.vnn);
536 printf("Unable to shutdown node %u\n", options.vnn);
546 static int control_recover(struct ctdb_context *ctdb, int argc, const char **argv)
550 ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn);
552 printf("Unable to freeze node\n");
556 ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.vnn, CTDB_RECOVERY_ACTIVE);
558 printf("Unable to set recovery mode\n");
567 display monitoring mode of a remote node
569 static int control_getmonmode(struct ctdb_context *ctdb, int argc, const char **argv)
574 ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.vnn, &monmode);
576 printf("Unable to get monmode from node %u\n", options.vnn);
579 printf("Monitoring mode:%s (%d)\n",monmode==CTDB_MONITORING_ACTIVE?"ACTIVE":"DISABLED",monmode);
585 set the monitoring mode of a remote node
587 static int control_setmonmode(struct ctdb_context *ctdb, int argc, const char **argv)
596 monmode = strtoul(argv[0], NULL, 0);
598 ret = ctdb_ctrl_setmonmode(ctdb, TIMELIMIT(), options.vnn, monmode);
600 printf("Unable to set monmode on node %u\n", options.vnn);
608 display remote list of keys/data for a db
610 static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv)
613 struct ctdb_db_context *ctdb_db;
621 ctdb_db = ctdb_attach(ctdb, db_name);
623 if (ctdb_db == NULL) {
624 DEBUG(0,("Unable to attach to database '%s'\n", db_name));
628 /* traverse and dump the cluster tdb */
629 ret = ctdb_dump_db(ctdb_db, stdout);
631 printf("Unable to dump database\n");
634 talloc_free(ctdb_db);
636 printf("Dumped %d records\n", ret);
642 display a list of the databases on a remote ctdb
644 static int control_getdbmap(struct ctdb_context *ctdb, int argc, const char **argv)
647 struct ctdb_dbid_map *dbmap=NULL;
649 ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.vnn, ctdb, &dbmap);
651 printf("Unable to get dbids from node %u\n", options.vnn);
655 printf("Number of databases:%d\n", dbmap->num);
656 for(i=0;i<dbmap->num;i++){
660 ctdb_ctrl_getdbpath(ctdb, TIMELIMIT(), options.vnn, dbmap->dbids[i], ctdb, &path);
661 ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), options.vnn, dbmap->dbids[i], ctdb, &name);
662 printf("dbid:0x%08x name:%s path:%s\n", dbmap->dbids[i], name, path);
671 static int control_ping(struct ctdb_context *ctdb, int argc, const char **argv)
674 struct timeval tv = timeval_current();
675 ret = ctdb_ctrl_ping(ctdb, options.vnn);
677 printf("Unable to get ping response from node %u\n", options.vnn);
679 printf("response from %u time=%.6f sec (%d clients)\n",
680 options.vnn, timeval_elapsed(&tv), ret);
689 static int control_getvar(struct ctdb_context *ctdb, int argc, const char **argv)
700 ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.vnn, name, &value);
702 printf("Unable to get tunable variable '%s'\n", name);
706 printf("%-19s = %u\n", name, value);
713 static int control_setvar(struct ctdb_context *ctdb, int argc, const char **argv)
724 value = strtoul(argv[1], NULL, 0);
726 ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.vnn, name, value);
728 printf("Unable to set tunable variable '%s'\n", name);
737 static int control_listvars(struct ctdb_context *ctdb, int argc, const char **argv)
743 ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.vnn, ctdb, &list, &count);
745 printf("Unable to list tunable variables\n");
749 for (i=0;i<count;i++) {
750 control_getvar(ctdb, 1, &list[i]);
759 display debug level on a node
761 static int control_getdebug(struct ctdb_context *ctdb, int argc, const char **argv)
766 ret = ctdb_ctrl_get_debuglevel(ctdb, options.vnn, &level);
768 printf("Unable to get debuglevel response from node %u\n",
771 printf("Node %u is at debug level %u\n", options.vnn, level);
778 set debug level on a node or all nodes
780 static int control_setdebug(struct ctdb_context *ctdb, int argc, const char **argv)
789 level = strtoul(argv[0], NULL, 0);
791 ret = ctdb_ctrl_set_debuglevel(ctdb, options.vnn, level);
793 printf("Unable to set debug level on node %u\n", options.vnn);
802 static int control_freeze(struct ctdb_context *ctdb, int argc, const char **argv)
806 ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.vnn);
808 printf("Unable to freeze node %u\n", options.vnn);
816 static int control_thaw(struct ctdb_context *ctdb, int argc, const char **argv)
820 ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.vnn);
822 printf("Unable to thaw node %u\n", options.vnn);
831 static int control_attach(struct ctdb_context *ctdb, int argc, const char **argv)
834 struct ctdb_db_context *ctdb_db;
841 ctdb_db = ctdb_attach(ctdb, db_name);
842 if (ctdb_db == NULL) {
843 DEBUG(0,("Unable to attach to database '%s'\n", db_name));
853 static int control_dumpmemory(struct ctdb_context *ctdb, int argc, const char **argv)
855 return ctdb_control(ctdb, options.vnn, 0, CTDB_CONTROL_DUMP_MEMORY,
856 CTDB_CTRL_FLAG_NOREPLY, tdb_null, NULL, NULL, NULL, NULL, NULL);
860 static const struct {
862 int (*fn)(struct ctdb_context *, int, const char **);
866 } ctdb_commands[] = {
867 { "status", control_status, true, "show node status" },
868 { "ping", control_ping, true, "ping all nodes" },
869 { "getvar", control_getvar, true, "get a tunable variable", "<name>"},
870 { "setvar", control_setvar, true, "set a tunable variable", "<name> <value>"},
871 { "listvars", control_listvars, true, "list tunable variables"},
872 { "statistics", control_statistics, false, "show statistics" },
873 { "statisticsreset", control_statistics_reset, true, "reset statistics"},
874 { "ip", control_ip, true, "show which public ip's that ctdb manages" },
875 { "process-exists", control_process_exists, true, "check if a process exists on a node", "<pid>"},
876 { "getdbmap", control_getdbmap, true, "show the database map" },
877 { "catdb", control_catdb, true, "dump a database" , "<dbname>"},
878 { "getmonmode", control_getmonmode, true, "show monitoring mode" },
879 { "setmonmode", control_setmonmode, true, "set monitoring mode", "<0|1>" },
880 { "setdebug", control_setdebug, true, "set debug level", "<debuglevel>" },
881 { "getdebug", control_getdebug, true, "get debug level" },
882 { "attach", control_attach, true, "attach to a database", "<dbname>" },
883 { "dumpmemory", control_dumpmemory, true, "dump memory map to logs" },
884 { "getpid", control_getpid, true, "get ctdbd process ID" },
885 { "disable", control_disable, true, "disable a nodes public IP" },
886 { "enable", control_enable, true, "enable a nodes public IP" },
887 { "ban", control_ban, true, "ban a node from the cluster", "<bantime|0>"},
888 { "unban", control_unban, true, "unban a node from the cluster" },
889 { "shutdown", control_shutdown, true, "shutdown ctdbd" },
890 { "recover", control_recover, true, "force recovery" },
891 { "freeze", control_freeze, true, "freeze all databases" },
892 { "thaw", control_thaw, true, "thaw all databases" },
893 { "killtcp", kill_tcp, false, "kill a tcp connection. Try <num> times.", "<srcip:port> <dstip:port> <num>" },
894 { "tickle", tickle_tcp, false, "send a tcp tickle ack", "<srcip:port> <dstip:port>" },
900 static void usage(void)
904 "Usage: ctdb [options] <control>\n" \
906 " -n <node> choose node number, or 'all' (defaults to local node)\n"
907 " -Y generate machinereadable output\n"
908 " -t <timelimit> set timelimit for control in seconds (default %u)\n", options.timelimit);
909 printf("Controls:\n");
910 for (i=0;i<ARRAY_SIZE(ctdb_commands);i++) {
911 printf(" %-15s %-27s %s\n",
912 ctdb_commands[i].name,
913 ctdb_commands[i].args?ctdb_commands[i].args:"",
914 ctdb_commands[i].msg);
923 int main(int argc, const char *argv[])
925 struct ctdb_context *ctdb;
926 char *nodestring = NULL;
927 struct poptOption popt_options[] = {
930 { "timelimit", 't', POPT_ARG_INT, &options.timelimit, 0, "timelimit", "integer" },
931 { "node", 'n', POPT_ARG_STRING, &nodestring, 0, "node", "integer|all" },
932 { "machinereadable", 'Y', POPT_ARG_NONE, &options.machinereadable, 0, "enable machinereadable output", NULL },
936 const char **extra_argv;
940 struct event_context *ev;
943 /* set some defaults */
944 options.timelimit = 3;
945 options.vnn = CTDB_CURRENT_NODE;
947 pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
949 while ((opt = poptGetNextOpt(pc)) != -1) {
952 fprintf(stderr, "Invalid option %s: %s\n",
953 poptBadOption(pc, 0), poptStrerror(opt));
958 /* setup the remaining options for the main program to use */
959 extra_argv = poptGetArgs(pc);
962 while (extra_argv[extra_argc]) extra_argc++;
965 if (extra_argc < 1) {
969 /* setup the node number to contact */
970 if (nodestring != NULL) {
971 if (strcmp(nodestring, "all") == 0) {
972 options.vnn = CTDB_BROADCAST_ALL;
974 options.vnn = strtoul(nodestring, NULL, 0);
978 control = extra_argv[0];
980 ev = event_context_init(NULL);
982 /* initialise ctdb */
983 ctdb = ctdb_cmdline_client(ev);
985 printf("Failed to init ctdb\n");
989 for (i=0;i<ARRAY_SIZE(ctdb_commands);i++) {
990 if (strcmp(control, ctdb_commands[i].name) == 0) {
993 if (options.vnn == CTDB_CURRENT_NODE) {
994 options.vnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);
997 if (ctdb_commands[i].auto_all &&
998 options.vnn == CTDB_BROADCAST_ALL) {
1003 nodes = ctdb_get_connected_nodes(ctdb, TIMELIMIT(), ctdb, &num_nodes);
1004 CTDB_NO_MEMORY(ctdb, nodes);
1006 for (j=0;j<num_nodes;j++) {
1007 options.vnn = nodes[j];
1008 ret |= ctdb_commands[i].fn(ctdb, extra_argc-1, extra_argv+1);
1012 ret = ctdb_commands[i].fn(ctdb, extra_argc-1, extra_argv+1);
1018 if (i == ARRAY_SIZE(ctdb_commands)) {
1019 printf("Unknown control '%s'\n", control);