4 Copyright (C) Amitay Isaacs 2015
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 "system/network.h"
22 #include "system/filesys.h"
28 #include "common/logging.h"
30 #include "lib/util/debug.h"
32 #include "protocol/protocol.h"
33 #include "protocol/protocol_api.h"
34 #include "client/client_private.h"
35 #include "client/client.h"
36 #include "client/client_sync.h"
38 int ctdb_ctrl_process_exists(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
39 struct ctdb_client_context
*client
,
40 int destnode
, struct timeval timeout
,
41 pid_t pid
, int *status
)
43 struct ctdb_req_control request
;
44 struct ctdb_reply_control
*reply
;
47 ctdb_req_control_process_exists(&request
, pid
);
48 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
52 ("Control PROCESS_EXISTS failed to node %u, ret=%d\n",
57 ret
= ctdb_reply_control_process_exists(reply
, status
);
60 ("Control PROCESS_EXISTS failed, ret=%d\n", ret
));
67 int ctdb_ctrl_statistics(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
68 struct ctdb_client_context
*client
,
69 int destnode
, struct timeval timeout
,
70 struct ctdb_statistics
**stats
)
72 struct ctdb_req_control request
;
73 struct ctdb_reply_control
*reply
;
76 ctdb_req_control_statistics(&request
);
77 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
81 ("Control STATISTICS failed to node %u, ret=%d\n",
86 ret
= ctdb_reply_control_statistics(reply
, mem_ctx
, stats
);
89 ("Control STATISTICS failed, ret=%d\n", ret
));
96 int ctdb_ctrl_ping(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
97 struct ctdb_client_context
*client
,
98 int destnode
, struct timeval timeout
,
101 struct ctdb_req_control request
;
102 struct ctdb_reply_control
*reply
;
105 ctdb_req_control_ping(&request
);
106 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
110 ("Control PING failed to node %u, ret=%d\n",
115 ret
= ctdb_reply_control_ping(reply
, num_clients
);
118 ("Control PING failed, ret=%d\n", ret
));
125 int ctdb_ctrl_getdbpath(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
126 struct ctdb_client_context
*client
,
127 int destnode
, struct timeval timeout
,
129 const char **db_path
)
131 struct ctdb_req_control request
;
132 struct ctdb_reply_control
*reply
;
135 ctdb_req_control_getdbpath(&request
, db_id
);
136 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
140 ("Control GETDBPATH failed to node %u, ret=%d\n",
145 ret
= ctdb_reply_control_getdbpath(reply
, mem_ctx
, db_path
);
148 ("Control GETDBPATH failed, ret=%d\n", ret
));
155 int ctdb_ctrl_getvnnmap(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
156 struct ctdb_client_context
*client
,
157 int destnode
, struct timeval timeout
,
158 struct ctdb_vnn_map
**vnnmap
)
160 struct ctdb_req_control request
;
161 struct ctdb_reply_control
*reply
;
164 ctdb_req_control_getvnnmap(&request
);
165 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
169 ("Control GETVNNMAP failed to node %u, ret=%d\n",
174 ret
= ctdb_reply_control_getvnnmap(reply
, mem_ctx
, vnnmap
);
177 ("Control GETVNNMAP failed, ret=%d\n", ret
));
184 int ctdb_ctrl_getdebug(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
185 struct ctdb_client_context
*client
,
186 int destnode
, struct timeval timeout
,
189 struct ctdb_req_control request
;
190 struct ctdb_reply_control
*reply
;
193 ctdb_req_control_get_debug(&request
);
194 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
198 ("Control GET_DEBUG failed to node %u, ret=%d\n",
203 ret
= ctdb_reply_control_get_debug(reply
, loglevel
);
206 ("Control GET_DEBUG failed, ret=%d\n", ret
));
213 int ctdb_ctrl_setdebug(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
214 struct ctdb_client_context
*client
,
215 int destnode
, struct timeval timeout
,
218 struct ctdb_req_control request
;
219 struct ctdb_reply_control
*reply
;
222 ctdb_req_control_set_debug(&request
, loglevel
);
223 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
227 ("Control SET_DEBUG failed to node %u, ret=%d\n",
232 ret
= ctdb_reply_control_set_debug(reply
);
235 ("Control SET_DEBUG failed, ret=%d\n", ret
));
242 int ctdb_ctrl_get_dbmap(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
243 struct ctdb_client_context
*client
,
244 int destnode
, struct timeval timeout
,
245 struct ctdb_dbid_map
**dbmap
)
247 struct ctdb_req_control request
;
248 struct ctdb_reply_control
*reply
;
251 ctdb_req_control_get_dbmap(&request
);
252 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
256 ("Control GET_DBMAP failed to node %u, ret=%d\n",
261 ret
= ctdb_reply_control_get_dbmap(reply
, mem_ctx
, dbmap
);
264 ("Control GET_DBMAP failed, ret=%d\n", ret
));
271 int ctdb_ctrl_pull_db(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
272 struct ctdb_client_context
*client
, int destnode
,
273 struct timeval timeout
, struct ctdb_pulldb
*pulldb
,
274 struct ctdb_rec_buffer
**recbuf
)
276 struct ctdb_req_control request
;
277 struct ctdb_reply_control
*reply
;
280 ctdb_req_control_pull_db(&request
, pulldb
);
281 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
285 ("Control PULL_DB failed to node %u, ret=%d\n",
290 ret
= ctdb_reply_control_pull_db(reply
, mem_ctx
, recbuf
);
293 ("Control PULL_DB failed, ret=%d\n", ret
));
300 int ctdb_ctrl_push_db(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
301 struct ctdb_client_context
*client
, int destnode
,
302 struct timeval timeout
, struct ctdb_rec_buffer
*recbuf
)
304 struct ctdb_req_control request
;
305 struct ctdb_reply_control
*reply
;
308 ctdb_req_control_push_db(&request
, recbuf
);
309 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
313 ("Control PUSH_DB failed to node %u, ret=%d\n",
318 ret
= ctdb_reply_control_push_db(reply
);
321 ("Control PUSH_DB failed, ret=%d\n", ret
));
329 int ctdb_ctrl_get_recmode(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
330 struct ctdb_client_context
*client
,
331 int destnode
, struct timeval timeout
,
334 struct ctdb_req_control request
;
335 struct ctdb_reply_control
*reply
;
338 ctdb_req_control_get_recmode(&request
);
339 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
343 ("Control GET_RECMODE failed to node %u, ret=%d\n",
348 ret
= ctdb_reply_control_get_recmode(reply
, recmode
);
351 ("Control GET_RECMODE failed, ret=%d\n", ret
));
358 int ctdb_ctrl_set_recmode(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
359 struct ctdb_client_context
*client
,
360 int destnode
, struct timeval timeout
,
363 struct ctdb_req_control request
;
364 struct ctdb_reply_control
*reply
;
367 ctdb_req_control_set_recmode(&request
, recmode
);
368 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
372 ("Control SET_RECMODE failed to node %u, ret=%d\n",
377 ret
= ctdb_reply_control_set_recmode(reply
);
380 ("Control SET_RECMODE failed, ret=%d\n", ret
));
387 int ctdb_ctrl_statistics_reset(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
388 struct ctdb_client_context
*client
,
389 int destnode
, struct timeval timeout
)
391 struct ctdb_req_control request
;
392 struct ctdb_reply_control
*reply
;
395 ctdb_req_control_statistics_reset(&request
);
396 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
400 ("Control STATISTICS_RESET failed to node %u, ret=%d\n",
405 ret
= ctdb_reply_control_statistics_reset(reply
);
408 ("Control STATISTICS_RESET failed, ret=%d\n", ret
));
415 int ctdb_ctrl_db_attach(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
416 struct ctdb_client_context
*client
,
417 int destnode
, struct timeval timeout
,
418 const char *db_name
, uint32_t *db_id
)
420 struct ctdb_req_control request
;
421 struct ctdb_reply_control
*reply
;
424 ctdb_req_control_db_attach(&request
, db_name
);
425 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
429 ("Control DB_ATTACH failed to node %u, ret=%d\n",
434 ret
= ctdb_reply_control_db_attach(reply
, db_id
);
437 ("Control DB_ATTACH failed, ret=%d\n", ret
));
444 int ctdb_ctrl_traverse_start(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
445 struct ctdb_client_context
*client
,
446 int destnode
, struct timeval timeout
,
447 struct ctdb_traverse_start
*traverse
)
449 struct ctdb_req_control request
;
450 struct ctdb_reply_control
*reply
;
453 ctdb_req_control_traverse_start(&request
, traverse
);
454 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
458 ("Control TRAVERSE_START failed to node %u, ret=%d\n",
463 ret
= ctdb_reply_control_traverse_start(reply
);
466 ("Control TRAVERSE_START failed, ret=%d\n", ret
));
473 int ctdb_ctrl_register_srvid(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
474 struct ctdb_client_context
*client
,
475 int destnode
, struct timeval timeout
,
478 struct ctdb_req_control request
;
479 struct ctdb_reply_control
*reply
;
482 ctdb_req_control_register_srvid(&request
, srvid
);
483 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
487 ("Control REGISTER_SRVID failed to node %u, ret=%d\n",
492 ret
= ctdb_reply_control_register_srvid(reply
);
495 ("Control REGISTER_SRVID failed, ret=%d\n", ret
));
502 int ctdb_ctrl_deregister_srvid(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
503 struct ctdb_client_context
*client
,
504 int destnode
, struct timeval timeout
,
507 struct ctdb_req_control request
;
508 struct ctdb_reply_control
*reply
;
511 ctdb_req_control_deregister_srvid(&request
, srvid
);
512 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
516 ("Control DEREGISTER_SRVID failed to node %u, ret=%d\n",
521 ret
= ctdb_reply_control_deregister_srvid(reply
);
524 ("Control DEREGISTER_SRVID failed, ret=%d\n", ret
));
531 int ctdb_ctrl_get_dbname(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
532 struct ctdb_client_context
*client
,
533 int destnode
, struct timeval timeout
,
534 uint32_t db_id
, const char **db_name
)
536 struct ctdb_req_control request
;
537 struct ctdb_reply_control
*reply
;
540 ctdb_req_control_get_dbname(&request
, db_id
);
541 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
545 ("Control GET_DBNAME failed to node %u, ret=%d\n",
550 ret
= ctdb_reply_control_get_dbname(reply
, mem_ctx
, db_name
);
553 ("Control GET_DBNAME failed, ret=%d\n", ret
));
560 int ctdb_ctrl_enable_seqnum(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
561 struct ctdb_client_context
*client
,
562 int destnode
, struct timeval timeout
,
565 struct ctdb_req_control request
;
566 struct ctdb_reply_control
*reply
;
569 ctdb_req_control_enable_seqnum(&request
, db_id
);
570 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
574 ("Control ENABLE_SEQNUM failed to node %u, ret=%d\n",
579 ret
= ctdb_reply_control_enable_seqnum(reply
);
582 ("Control ENABLE_SEQNUM failed, ret=%d\n", ret
));
589 int ctdb_ctrl_update_seqnum(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
590 struct ctdb_client_context
*client
,
591 int destnode
, struct timeval timeout
,
594 struct ctdb_req_control request
;
595 struct ctdb_reply_control
*reply
;
598 ctdb_req_control_update_seqnum(&request
, db_id
);
599 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
603 ("Control UPDATE_SEQNUM failed to node %u, ret=%d\n",
608 ret
= ctdb_reply_control_update_seqnum(reply
);
611 ("Control UPDATE_SEQNUM failed, ret=%d\n", ret
));
618 int ctdb_ctrl_dump_memory(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
619 struct ctdb_client_context
*client
,
620 int destnode
, struct timeval timeout
,
621 const char **mem_str
)
623 struct ctdb_req_control request
;
624 struct ctdb_reply_control
*reply
;
627 ctdb_req_control_dump_memory(&request
);
628 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
632 ("Control DUMP_MEMORY failed to node %u, ret=%d\n",
637 ret
= ctdb_reply_control_dump_memory(reply
, mem_ctx
, mem_str
);
640 ("Control DUMP_MEMORY failed, ret=%d\n", ret
));
647 int ctdb_ctrl_get_pid(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
648 struct ctdb_client_context
*client
,
649 int destnode
, struct timeval timeout
,
652 struct ctdb_req_control request
;
653 struct ctdb_reply_control
*reply
;
656 ctdb_req_control_get_pid(&request
);
657 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
661 ("Control GET_PID failed to node %u, ret=%d\n",
666 ret
= ctdb_reply_control_get_pid(reply
, pid
);
669 ("Control GET_PID failed, ret=%d\n", ret
));
676 int ctdb_ctrl_get_recmaster(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
677 struct ctdb_client_context
*client
,
678 int destnode
, struct timeval timeout
,
681 struct ctdb_req_control request
;
682 struct ctdb_reply_control
*reply
;
685 ctdb_req_control_get_recmaster(&request
);
686 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
690 ("Control GET_RECMASTER failed to node %u, ret=%d\n",
695 ret
= ctdb_reply_control_get_recmaster(reply
, recmaster
);
698 ("Control GET_RECMASTER failed, ret=%d\n", ret
));
705 int ctdb_ctrl_set_recmaster(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
706 struct ctdb_client_context
*client
,
707 int destnode
, struct timeval timeout
,
710 struct ctdb_req_control request
;
711 struct ctdb_reply_control
*reply
;
714 ctdb_req_control_set_recmaster(&request
, recmaster
);
715 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
719 ("Control SET_RECMASTER failed to node %u, ret=%d\n",
724 ret
= ctdb_reply_control_set_recmaster(reply
);
727 ("Control SET_RECMASTER failed, ret=%d\n", ret
));
734 int ctdb_ctrl_freeze(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
735 struct ctdb_client_context
*client
,
736 int destnode
, struct timeval timeout
,
739 struct ctdb_req_control request
;
740 struct ctdb_reply_control
*reply
;
743 ctdb_req_control_freeze(&request
, priority
);
744 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
748 ("Control FREEZE failed to node %u, ret=%d\n",
753 ret
= ctdb_reply_control_freeze(reply
);
756 ("Control FREEZE failed, ret=%d\n", ret
));
763 int ctdb_ctrl_get_pnn(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
764 struct ctdb_client_context
*client
,
765 int destnode
, struct timeval timeout
,
768 struct ctdb_req_control request
;
769 struct ctdb_reply_control
*reply
;
772 ctdb_req_control_get_pnn(&request
);
773 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
777 ("Control GET_PNN failed to node %u, ret=%d\n",
782 ret
= ctdb_reply_control_get_pnn(reply
, pnn
);
785 ("Control GET_PNN failed, ret=%d\n", ret
));
792 int ctdb_ctrl_shutdown(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
793 struct ctdb_client_context
*client
,
794 int destnode
, struct timeval timeout
)
796 struct ctdb_req_control request
;
797 struct ctdb_reply_control
*reply
;
800 ctdb_req_control_shutdown(&request
);
801 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
805 ("Control SHUTDOWN failed to node %u, ret=%d\n",
810 ret
= ctdb_reply_control_shutdown(reply
);
813 ("Control SHUTDOWN failed, ret=%d\n", ret
));
820 int ctdb_ctrl_tcp_add(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
821 struct ctdb_client_context
*client
,
822 int destnode
, struct timeval timeout
,
823 struct ctdb_connection
*conn
)
825 struct ctdb_req_control request
;
826 struct ctdb_reply_control
*reply
;
829 ctdb_req_control_tcp_add(&request
, conn
);
830 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
834 ("Control TCP_ADD failed to node %u, ret=%d\n",
839 ret
= ctdb_reply_control_tcp_add(reply
);
842 ("Control TCP_ADD failed, ret=%d\n", ret
));
849 int ctdb_ctrl_tcp_remove(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
850 struct ctdb_client_context
*client
,
851 int destnode
, struct timeval timeout
,
852 struct ctdb_connection
*conn
)
854 struct ctdb_req_control request
;
855 struct ctdb_reply_control
*reply
;
858 ctdb_req_control_tcp_remove(&request
, conn
);
859 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
863 ("Control TCP_REMOVE failed to node %u, ret=%d\n",
868 ret
= ctdb_reply_control_tcp_remove(reply
);
871 ("Control TCP_REMOVE failed, ret=%d\n", ret
));
878 int ctdb_ctrl_set_tunable(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
879 struct ctdb_client_context
*client
,
880 int destnode
, struct timeval timeout
,
881 struct ctdb_tunable
*tunable
)
883 struct ctdb_req_control request
;
884 struct ctdb_reply_control
*reply
;
887 ctdb_req_control_set_tunable(&request
, tunable
);
888 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
892 ("Control SET_TUNABLE failed to node %u, ret=%d\n",
897 ret
= ctdb_reply_control_set_tunable(reply
);
900 ("Control SET_TUNABLE failed, ret=%d\n", ret
));
907 int ctdb_ctrl_get_tunable(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
908 struct ctdb_client_context
*client
,
909 int destnode
, struct timeval timeout
,
910 const char *var
, uint32_t *value
)
912 struct ctdb_req_control request
;
913 struct ctdb_reply_control
*reply
;
916 ctdb_req_control_get_tunable(&request
, var
);
917 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
921 ("Control GET_TUNABLE failed to node %u, ret=%d\n",
926 ret
= ctdb_reply_control_get_tunable(reply
, value
);
929 ("Control GET_TUNABLE failed, ret=%d\n", ret
));
936 int ctdb_ctrl_list_tunables(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
937 struct ctdb_client_context
*client
,
938 int destnode
, struct timeval timeout
,
939 struct ctdb_var_list
**var_list
)
941 struct ctdb_req_control request
;
942 struct ctdb_reply_control
*reply
;
945 ctdb_req_control_list_tunables(&request
);
946 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
950 ("Control LIST_TUNABLES failed to node %u, ret=%d\n",
955 ret
= ctdb_reply_control_list_tunables(reply
, mem_ctx
, var_list
);
958 ("Control LIST_TUNABLES failed, ret=%d\n", ret
));
965 int ctdb_ctrl_modify_flags(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
966 struct ctdb_client_context
*client
,
967 int destnode
, struct timeval timeout
,
968 uint32_t pnn
, uint32_t old_flags
,
971 struct ctdb_req_control request
;
972 struct ctdb_reply_control
*reply
;
973 struct ctdb_node_flag_change flag_change
;
976 flag_change
.pnn
= pnn
;
977 flag_change
.old_flags
= old_flags
;
978 flag_change
.new_flags
= new_flags
;
980 ctdb_req_control_modify_flags(&request
, &flag_change
);
981 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
985 ("Control MODIFY_FLAGS failed to node %u, ret=%d\n",
990 ret
= ctdb_reply_control_modify_flags(reply
);
993 ("Control MODIFY_FLAGS failed, ret=%d\n", ret
));
1000 int ctdb_ctrl_get_all_tunables(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1001 struct ctdb_client_context
*client
,
1002 int destnode
, struct timeval timeout
,
1003 struct ctdb_tunable_list
**tun_list
)
1005 struct ctdb_req_control request
;
1006 struct ctdb_reply_control
*reply
;
1009 ctdb_req_control_get_all_tunables(&request
);
1010 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1014 ("Control GET_ALL_TUNABLES failed to node %u, ret=%d\n",
1019 ret
= ctdb_reply_control_get_all_tunables(reply
, mem_ctx
, tun_list
);
1022 ("Control GET_ALL_TUNABLES failed, ret=%d\n", ret
));
1029 int ctdb_ctrl_get_tcp_tickle_list(TALLOC_CTX
*mem_ctx
,
1030 struct tevent_context
*ev
,
1031 struct ctdb_client_context
*client
,
1032 int destnode
, struct timeval timeout
,
1033 ctdb_sock_addr
*addr
,
1034 struct ctdb_tickle_list
**tickles
)
1036 struct ctdb_req_control request
;
1037 struct ctdb_reply_control
*reply
;
1040 ctdb_req_control_get_tcp_tickle_list(&request
, addr
);
1041 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1045 ("Control GET_TCP_TICKLE_LIST failed to node %u, ret=%d\n",
1050 ret
= ctdb_reply_control_get_tcp_tickle_list(reply
, mem_ctx
, tickles
);
1053 ("Control GET_TCP_TICKLE_LIST failed, ret=%d\n", ret
));
1060 int ctdb_ctrl_set_tcp_tickle_list(TALLOC_CTX
*mem_ctx
,
1061 struct tevent_context
*ev
,
1062 struct ctdb_client_context
*client
,
1063 int destnode
, struct timeval timeout
,
1064 struct ctdb_tickle_list
*tickles
)
1066 struct ctdb_req_control request
;
1067 struct ctdb_reply_control
*reply
;
1070 ctdb_req_control_set_tcp_tickle_list(&request
, tickles
);
1071 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1075 ("Control SET_TCP_TICKLE_LIST failed to node %u, ret=%d\n",
1080 ret
= ctdb_reply_control_set_tcp_tickle_list(reply
);
1083 ("Control SET_TCP_TICKLE_LIST failed, ret=%d\n", ret
));
1090 int ctdb_ctrl_db_attach_persistent(TALLOC_CTX
*mem_ctx
,
1091 struct tevent_context
*ev
,
1092 struct ctdb_client_context
*client
,
1093 int destnode
, struct timeval timeout
,
1094 const char *db_name
, uint32_t *db_id
)
1096 struct ctdb_req_control request
;
1097 struct ctdb_reply_control
*reply
;
1100 ctdb_req_control_db_attach_persistent(&request
, db_name
);
1101 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1105 ("Control DB_ATTACH_PERSISTENT failed to node %u, ret=%d\n",
1110 ret
= ctdb_reply_control_db_attach_persistent(reply
, db_id
);
1113 ("Control DB_ATTACH_PERSISTENT failed, ret=%d\n", ret
));
1120 int ctdb_ctrl_send_gratuitous_arp(TALLOC_CTX
*mem_ctx
,
1121 struct tevent_context
*ev
,
1122 struct ctdb_client_context
*client
,
1123 int destnode
, struct timeval timeout
,
1124 struct ctdb_addr_info
*addr_info
)
1126 struct ctdb_req_control request
;
1127 struct ctdb_reply_control
*reply
;
1130 ctdb_req_control_send_gratuitous_arp(&request
, addr_info
);
1131 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1135 ("Control SEND_GRATUITOUS_ARP failed to node %u, ret=%d\n",
1140 ret
= ctdb_reply_control_send_gratuitous_arp(reply
);
1143 ("Control SEND_GRATUITOUS_ARP failed, ret=%d\n", ret
));
1150 int ctdb_ctrl_wipe_database(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1151 struct ctdb_client_context
*client
,
1152 int destnode
, struct timeval timeout
,
1153 uint32_t db_id
, uint32_t tid
)
1155 struct ctdb_req_control request
;
1156 struct ctdb_reply_control
*reply
;
1157 struct ctdb_transdb transdb
;
1160 transdb
.db_id
= db_id
;
1163 ctdb_req_control_wipe_database(&request
, &transdb
);
1164 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1168 ("Control WIPE_DATABASE failed to node %u, ret=%d\n",
1173 ret
= ctdb_reply_control_wipe_database(reply
);
1176 ("Control WIPE_DATABASE failed, ret=%d\n", ret
));
1183 int ctdb_ctrl_uptime(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1184 struct ctdb_client_context
*client
,
1185 int destnode
, struct timeval timeout
,
1186 struct ctdb_uptime
**uptime
)
1188 struct ctdb_req_control request
;
1189 struct ctdb_reply_control
*reply
;
1192 ctdb_req_control_uptime(&request
);
1193 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1197 ("Control UPTIME failed to node %u, ret=%d\n",
1202 ret
= ctdb_reply_control_uptime(reply
, mem_ctx
, uptime
);
1205 ("Control UPTIME failed, ret=%d\n", ret
));
1212 int ctdb_ctrl_start_recovery(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1213 struct ctdb_client_context
*client
,
1214 int destnode
, struct timeval timeout
)
1216 struct ctdb_req_control request
;
1217 struct ctdb_reply_control
*reply
;
1220 ctdb_req_control_start_recovery(&request
);
1221 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1225 ("Control START_RECOVERY failed to node %u, ret=%d\n",
1230 ret
= ctdb_reply_control_start_recovery(reply
);
1233 ("Control START_RECOVERY failed, ret=%d\n", ret
));
1240 int ctdb_ctrl_end_recovery(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1241 struct ctdb_client_context
*client
,
1242 int destnode
, struct timeval timeout
)
1244 struct ctdb_req_control request
;
1245 struct ctdb_reply_control
*reply
;
1248 ctdb_req_control_end_recovery(&request
);
1249 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1253 ("Control END_RECOVERY failed to node %u, ret=%d\n",
1258 ret
= ctdb_reply_control_end_recovery(reply
);
1261 ("Control END_RECOVERY failed, ret=%d\n", ret
));
1268 int ctdb_ctrl_reload_nodes_file(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1269 struct ctdb_client_context
*client
,
1270 int destnode
, struct timeval timeout
)
1272 struct ctdb_req_control request
;
1273 struct ctdb_reply_control
*reply
;
1276 ctdb_req_control_reload_nodes_file(&request
);
1277 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1281 ("Control RELOAD_NODES_FILE failed to node %u, ret=%d\n",
1286 ret
= ctdb_reply_control_reload_nodes_file(reply
);
1289 ("Control RELOAD_NODES_FILE failed, ret=%d\n", ret
));
1296 int ctdb_ctrl_add_public_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1297 struct ctdb_client_context
*client
,
1298 int destnode
, struct timeval timeout
,
1299 struct ctdb_addr_info
*addr_info
)
1301 struct ctdb_req_control request
;
1302 struct ctdb_reply_control
*reply
;
1305 ctdb_req_control_add_public_ip(&request
, addr_info
);
1306 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1310 ("Control ADD_PUBLIC_IP failed to node %u, ret=%d\n",
1315 ret
= ctdb_reply_control_add_public_ip(reply
);
1318 ("Control ADD_PUBLIC_IP failed, ret=%d\n", ret
));
1325 int ctdb_ctrl_del_public_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1326 struct ctdb_client_context
*client
,
1327 int destnode
, struct timeval timeout
,
1328 struct ctdb_addr_info
*addr_info
)
1330 struct ctdb_req_control request
;
1331 struct ctdb_reply_control
*reply
;
1334 ctdb_req_control_del_public_ip(&request
, addr_info
);
1335 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1339 ("Control DEL_PUBLIC_IP failed to node %u, ret=%d\n",
1344 ret
= ctdb_reply_control_del_public_ip(reply
);
1347 ("Control DEL_PUBLIC_IP failed, ret=%d\n", ret
));
1354 int ctdb_ctrl_get_capabilities(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1355 struct ctdb_client_context
*client
,
1356 int destnode
, struct timeval timeout
,
1359 struct ctdb_req_control request
;
1360 struct ctdb_reply_control
*reply
;
1363 ctdb_req_control_get_capabilities(&request
);
1364 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1368 ("Control GET_CAPABILITIES failed to node %u, ret=%d\n",
1373 ret
= ctdb_reply_control_get_capabilities(reply
, caps
);
1376 ("Control GET_CAPABILITIES failed, ret=%d\n", ret
));
1383 int ctdb_ctrl_release_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1384 struct ctdb_client_context
*client
,
1385 int destnode
, struct timeval timeout
,
1386 struct ctdb_public_ip
*pubip
)
1388 struct ctdb_req_control request
;
1389 struct ctdb_reply_control
*reply
;
1392 ctdb_req_control_release_ip(&request
, pubip
);
1393 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1397 ("Control RELEASE_IP failed to node %u, ret=%d\n",
1402 ret
= ctdb_reply_control_release_ip(reply
);
1405 ("Control RELEASE_IP failed, ret=%d\n", ret
));
1412 int ctdb_ctrl_takeover_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1413 struct ctdb_client_context
*client
,
1414 int destnode
, struct timeval timeout
,
1415 struct ctdb_public_ip
*pubip
)
1417 struct ctdb_req_control request
;
1418 struct ctdb_reply_control
*reply
;
1421 ctdb_req_control_takeover_ip(&request
, pubip
);
1422 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1426 ("Control TAKEOVER_IP failed to node %u, ret=%d\n",
1431 ret
= ctdb_reply_control_takeover_ip(reply
);
1434 ("Control TAKEOVER_IP failed, ret=%d\n", ret
));
1441 int ctdb_ctrl_get_public_ips(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1442 struct ctdb_client_context
*client
,
1443 int destnode
, struct timeval timeout
,
1444 bool available_only
,
1445 struct ctdb_public_ip_list
**pubip_list
)
1447 struct ctdb_req_control request
;
1448 struct ctdb_reply_control
*reply
;
1451 ctdb_req_control_get_public_ips(&request
, available_only
);
1452 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1456 ("Control GET_PUBLIC_IPS failed to node %u, ret=%d\n",
1461 ret
= ctdb_reply_control_get_public_ips(reply
, mem_ctx
, pubip_list
);
1464 ("Control GET_PUBLIC_IPS failed, ret=%d\n", ret
));
1471 int ctdb_ctrl_get_nodemap(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1472 struct ctdb_client_context
*client
,
1473 int destnode
, struct timeval timeout
,
1474 struct ctdb_node_map
**nodemap
)
1476 struct ctdb_req_control request
;
1477 struct ctdb_reply_control
*reply
;
1480 ctdb_req_control_get_nodemap(&request
);
1481 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1485 ("Control GET_NODEMAP failed to node %u, ret=%d\n",
1490 ret
= ctdb_reply_control_get_nodemap(reply
, mem_ctx
, nodemap
);
1493 ("Control GET_NODEMAP failed, ret=%d\n", ret
));
1500 int ctdb_ctrl_traverse_kill(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1501 struct ctdb_client_context
*client
,
1502 int destnode
, struct timeval timeout
,
1503 struct ctdb_traverse_start
*traverse
)
1505 struct ctdb_req_control request
;
1506 struct ctdb_reply_control
*reply
;
1509 ctdb_req_control_traverse_kill(&request
, traverse
);
1510 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1514 ("Control TRAVERSE_KILL failed to node %u, ret=%d\n",
1519 ret
= ctdb_reply_control_traverse_kill(reply
);
1522 ("Control TRAVERSE_KILL failed, ret=%d\n", ret
));
1529 int ctdb_ctrl_get_reclock_file(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1530 struct ctdb_client_context
*client
,
1531 int destnode
, struct timeval timeout
,
1532 const char **reclock_file
)
1534 struct ctdb_req_control request
;
1535 struct ctdb_reply_control
*reply
;
1538 ctdb_req_control_get_reclock_file(&request
);
1539 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1543 ("Control GET_RECLOCK_FILE failed to node %u, ret=%d\n",
1548 ret
= ctdb_reply_control_get_reclock_file(reply
, mem_ctx
, reclock_file
);
1551 ("Control GET_RECLOCK_FILE failed, ret=%d\n", ret
));
1558 int ctdb_ctrl_stop_node(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1559 struct ctdb_client_context
*client
,
1560 int destnode
, struct timeval timeout
)
1562 struct ctdb_req_control request
;
1563 struct ctdb_reply_control
*reply
;
1566 ctdb_req_control_stop_node(&request
);
1567 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1571 ("Control STOP_NODE failed to node %u, ret=%d\n",
1576 ret
= ctdb_reply_control_stop_node(reply
);
1579 ("Control STOP_NODE failed, ret=%d\n", ret
));
1586 int ctdb_ctrl_continue_node(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1587 struct ctdb_client_context
*client
,
1588 int destnode
, struct timeval timeout
)
1590 struct ctdb_req_control request
;
1591 struct ctdb_reply_control
*reply
;
1594 ctdb_req_control_continue_node(&request
);
1595 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1599 ("Control CONTINUE_NODE failed to node %u, ret=%d\n",
1604 ret
= ctdb_reply_control_continue_node(reply
);
1607 ("Control CONTINUE_NODE failed, ret=%d\n", ret
));
1614 int ctdb_ctrl_set_lmasterrole(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1615 struct ctdb_client_context
*client
,
1616 int destnode
, struct timeval timeout
,
1617 uint32_t lmaster_role
)
1619 struct ctdb_req_control request
;
1620 struct ctdb_reply_control
*reply
;
1623 ctdb_req_control_set_lmasterrole(&request
, lmaster_role
);
1624 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1628 ("Control SET_LMASTERROLE failed to node %u, ret=%d\n",
1633 ret
= ctdb_reply_control_set_lmasterrole(reply
);
1636 ("Control SET_LMASTERROLE failed, ret=%d\n", ret
));
1643 int ctdb_ctrl_set_recmasterrole(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1644 struct ctdb_client_context
*client
,
1645 int destnode
, struct timeval timeout
,
1646 uint32_t recmaster_role
)
1648 struct ctdb_req_control request
;
1649 struct ctdb_reply_control
*reply
;
1652 ctdb_req_control_set_recmasterrole(&request
, recmaster_role
);
1653 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1657 ("Control SET_RECMASTERROLE failed to node %u, ret=%d\n",
1662 ret
= ctdb_reply_control_set_recmasterrole(reply
);
1665 ("Control SET_RECMASTERROLE failed, ret=%d\n", ret
));
1672 int ctdb_ctrl_set_ban_state(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1673 struct ctdb_client_context
*client
,
1674 int destnode
, struct timeval timeout
,
1675 struct ctdb_ban_state
*ban_state
)
1677 struct ctdb_req_control request
;
1678 struct ctdb_reply_control
*reply
;
1681 ctdb_req_control_set_ban_state(&request
, ban_state
);
1682 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1686 ("Control SET_BAN_STATE failed to node %u, ret=%d\n",
1691 ret
= ctdb_reply_control_set_ban_state(reply
);
1694 ("Control SET_BAN_STATE failed, ret=%d\n", ret
));
1701 int ctdb_ctrl_get_ban_state(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1702 struct ctdb_client_context
*client
,
1703 int destnode
, struct timeval timeout
,
1704 struct ctdb_ban_state
**ban_state
)
1706 struct ctdb_req_control request
;
1707 struct ctdb_reply_control
*reply
;
1710 ctdb_req_control_get_ban_state(&request
);
1711 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1715 ("Control GET_BAN_STATE failed to node %u, ret=%d\n",
1720 ret
= ctdb_reply_control_get_ban_state(reply
, mem_ctx
, ban_state
);
1723 ("Control GET_BAN_STATE failed, ret=%d\n", ret
));
1730 int ctdb_ctrl_register_notify(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1731 struct ctdb_client_context
*client
,
1732 int destnode
, struct timeval timeout
,
1733 struct ctdb_notify_data
*notify
)
1735 struct ctdb_req_control request
;
1736 struct ctdb_reply_control
*reply
;
1739 ctdb_req_control_register_notify(&request
, notify
);
1740 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1744 ("Control REGISTER_NOTIFY failed to node %u, ret=%d\n",
1749 ret
= ctdb_reply_control_register_notify(reply
);
1752 ("Control REGISTER_NOTIFY failed, ret=%d\n", ret
));
1759 int ctdb_ctrl_deregister_notify(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1760 struct ctdb_client_context
*client
,
1761 int destnode
, struct timeval timeout
,
1764 struct ctdb_req_control request
;
1765 struct ctdb_reply_control
*reply
;
1768 ctdb_req_control_deregister_notify(&request
, srvid
);
1769 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1773 ("Control DEREGISTER_NOTIFY failed to node %u, ret=%d\n",
1778 ret
= ctdb_reply_control_deregister_notify(reply
);
1781 ("Control DEREGISTER_NOTIFY failed, ret=%d\n", ret
));
1788 int ctdb_ctrl_trans3_commit(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1789 struct ctdb_client_context
*client
,
1790 int destnode
, struct timeval timeout
,
1791 struct ctdb_rec_buffer
*recbuf
)
1793 struct ctdb_req_control request
;
1794 struct ctdb_reply_control
*reply
;
1797 ctdb_req_control_trans3_commit(&request
, recbuf
);
1798 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1802 ("Control TRANS3_COMMIT failed to node %u, ret=%d\n",
1807 ret
= ctdb_reply_control_trans3_commit(reply
);
1810 ("Control TRANS3_COMMIT failed, ret=%d\n", ret
));
1817 int ctdb_ctrl_get_db_seqnum(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1818 struct ctdb_client_context
*client
,
1819 int destnode
, struct timeval timeout
,
1820 uint32_t db_id
, uint64_t *seqnum
)
1822 struct ctdb_req_control request
;
1823 struct ctdb_reply_control
*reply
;
1826 ctdb_req_control_get_db_seqnum(&request
, db_id
);
1827 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1831 ("Control GET_DB_SEQNUM failed to node %u, ret=%d\n",
1836 ret
= ctdb_reply_control_get_db_seqnum(reply
, seqnum
);
1839 ("Control GET_DB_SEQNUM failed, ret=%d\n", ret
));
1846 int ctdb_ctrl_db_set_healthy(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1847 struct ctdb_client_context
*client
,
1848 int destnode
, struct timeval timeout
,
1851 struct ctdb_req_control request
;
1852 struct ctdb_reply_control
*reply
;
1855 ctdb_req_control_db_set_healthy(&request
, db_id
);
1856 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1860 ("Control DB_SET_HEALTHY failed to node %u, ret=%d\n",
1865 ret
= ctdb_reply_control_db_set_healthy(reply
);
1868 ("Control DB_SET_HEALTHY failed, ret=%d\n", ret
));
1875 int ctdb_ctrl_db_get_health(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1876 struct ctdb_client_context
*client
,
1877 int destnode
, struct timeval timeout
,
1878 uint32_t db_id
, const char **reason
)
1880 struct ctdb_req_control request
;
1881 struct ctdb_reply_control
*reply
;
1884 ctdb_req_control_db_get_health(&request
, db_id
);
1885 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1889 ("Control DB_GET_HEALTH failed to node %u, ret=%d\n",
1894 ret
= ctdb_reply_control_db_get_health(reply
, mem_ctx
, reason
);
1897 ("Control DB_GET_HEALTH failed, ret=%d\n", ret
));
1904 int ctdb_ctrl_get_public_ip_info(TALLOC_CTX
*mem_ctx
,
1905 struct tevent_context
*ev
,
1906 struct ctdb_client_context
*client
,
1907 int destnode
, struct timeval timeout
,
1908 ctdb_sock_addr
*addr
,
1909 struct ctdb_public_ip_info
**ipinfo
)
1911 struct ctdb_req_control request
;
1912 struct ctdb_reply_control
*reply
;
1915 ctdb_req_control_get_public_ip_info(&request
, addr
);
1916 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1920 ("Control GET_PUBLIC_IP_INFO failed to node %u, ret=%d\n",
1925 ret
= ctdb_reply_control_get_public_ip_info(reply
, mem_ctx
, ipinfo
);
1928 ("Control GET_PUBLIC_IP_INFO failed, ret=%d\n", ret
));
1935 int ctdb_ctrl_get_ifaces(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1936 struct ctdb_client_context
*client
,
1937 int destnode
, struct timeval timeout
,
1938 struct ctdb_iface_list
**iface_list
)
1940 struct ctdb_req_control request
;
1941 struct ctdb_reply_control
*reply
;
1944 ctdb_req_control_get_ifaces(&request
);
1945 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1949 ("Control GET_IFACES failed to node %u, ret=%d\n",
1954 ret
= ctdb_reply_control_get_ifaces(reply
, mem_ctx
, iface_list
);
1957 ("Control GET_IFACES failed, ret=%d\n", ret
));
1964 int ctdb_ctrl_set_iface_link_state(TALLOC_CTX
*mem_ctx
,
1965 struct tevent_context
*ev
,
1966 struct ctdb_client_context
*client
,
1967 int destnode
, struct timeval timeout
,
1968 struct ctdb_iface
*iface
)
1970 struct ctdb_req_control request
;
1971 struct ctdb_reply_control
*reply
;
1974 ctdb_req_control_set_iface_link_state(&request
, iface
);
1975 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
1979 ("Control SET_IFACE_LINK_STATE failed to node %u, ret=%d\n",
1984 ret
= ctdb_reply_control_set_iface_link_state(reply
);
1987 ("Control SET_IFACE_LINK_STATE failed, ret=%d\n", ret
));
1994 int ctdb_ctrl_tcp_add_delayed_update(TALLOC_CTX
*mem_ctx
,
1995 struct tevent_context
*ev
,
1996 struct ctdb_client_context
*client
,
1997 int destnode
, struct timeval timeout
,
1998 struct ctdb_connection
*conn
)
2000 struct ctdb_req_control request
;
2001 struct ctdb_reply_control
*reply
;
2004 ctdb_req_control_tcp_add_delayed_update(&request
, conn
);
2005 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2009 ("Control TCP_ADD_DELAYED_UPDATE failed to node %u, ret=%d\n",
2014 ret
= ctdb_reply_control_tcp_add_delayed_update(reply
);
2017 ("Control TCP_ADD_DELAYED_UPDATE failed, ret=%d\n", ret
));
2024 int ctdb_ctrl_get_stat_history(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2025 struct ctdb_client_context
*client
,
2026 int destnode
, struct timeval timeout
,
2027 struct ctdb_statistics_list
**stats_list
)
2029 struct ctdb_req_control request
;
2030 struct ctdb_reply_control
*reply
;
2033 ctdb_req_control_get_stat_history(&request
);
2034 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2038 ("Control GET_STAT_HISTORY failed to node %u, ret=%d\n",
2043 ret
= ctdb_reply_control_get_stat_history(reply
, mem_ctx
, stats_list
);
2046 ("Control GET_STAT_HISTORY failed, ret=%d\n", ret
));
2053 int ctdb_ctrl_schedule_for_deletion(TALLOC_CTX
*mem_ctx
,
2054 struct tevent_context
*ev
,
2055 struct ctdb_client_context
*client
,
2056 int destnode
, struct timeval timeout
,
2057 struct ctdb_key_data
*key
)
2059 struct ctdb_req_control request
;
2060 struct ctdb_reply_control
*reply
;
2063 ctdb_req_control_schedule_for_deletion(&request
, key
);
2064 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2068 ("Control SCHEDULE_FOR_DELETION failed to node %u, ret=%d\n",
2073 ret
= ctdb_reply_control_schedule_for_deletion(reply
);
2076 ("Control SCHEDULE_FOR_DELETION failed, ret=%d\n", ret
));
2083 int ctdb_ctrl_set_db_readonly(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2084 struct ctdb_client_context
*client
,
2085 int destnode
, struct timeval timeout
,
2088 struct ctdb_req_control request
;
2089 struct ctdb_reply_control
*reply
;
2092 ctdb_req_control_set_db_readonly(&request
, db_id
);
2093 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2097 ("Control SET_DB_READONY failed to node %u, ret=%d\n",
2102 ret
= ctdb_reply_control_set_db_readonly(reply
);
2105 ("Control SET_DB_READONY failed, ret=%d\n", ret
));
2112 int ctdb_ctrl_traverse_start_ext(TALLOC_CTX
*mem_ctx
,
2113 struct tevent_context
*ev
,
2114 struct ctdb_client_context
*client
,
2115 int destnode
, struct timeval timeout
,
2116 struct ctdb_traverse_start_ext
*traverse
)
2118 struct ctdb_req_control request
;
2119 struct ctdb_reply_control
*reply
;
2122 ctdb_req_control_traverse_start_ext(&request
, traverse
);
2123 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2127 ("Control TRAVERSE_START_EXT failed to node %u, ret=%d\n",
2132 ret
= ctdb_reply_control_traverse_start_ext(reply
);
2135 ("Control TRAVERSE_START_EXT failed, ret=%d\n", ret
));
2142 int ctdb_ctrl_get_db_statistics(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2143 struct ctdb_client_context
*client
,
2144 int destnode
, struct timeval timeout
,
2146 struct ctdb_db_statistics
**dbstats
)
2148 struct ctdb_req_control request
;
2149 struct ctdb_reply_control
*reply
;
2152 ctdb_req_control_get_db_statistics(&request
, db_id
);
2153 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2157 ("Control GET_DB_STATISTICS failed to node %u, ret=%d\n",
2162 ret
= ctdb_reply_control_get_db_statistics(reply
, mem_ctx
, dbstats
);
2165 ("Control GET_DB_STATISTICS failed, ret=%d\n", ret
));
2172 int ctdb_ctrl_set_db_sticky(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2173 struct ctdb_client_context
*client
,
2174 int destnode
, struct timeval timeout
,
2177 struct ctdb_req_control request
;
2178 struct ctdb_reply_control
*reply
;
2181 ctdb_req_control_set_db_sticky(&request
, db_id
);
2182 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2186 ("Control SET_DB_STICKY failed to node %u, ret=%d\n",
2191 ret
= ctdb_reply_control_set_db_sticky(reply
);
2194 ("Control SET_DB_STICKY failed, ret=%d\n", ret
));
2201 int ctdb_ctrl_reload_public_ips(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2202 struct ctdb_client_context
*client
,
2203 int destnode
, struct timeval timeout
)
2205 struct ctdb_req_control request
;
2206 struct ctdb_reply_control
*reply
;
2209 ctdb_req_control_reload_public_ips(&request
);
2210 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2214 ("Control RELOAD_PUBLIC_IPS failed to node %u, ret=%d\n",
2219 ret
= ctdb_reply_control_reload_public_ips(reply
);
2222 ("Control RELOAD_PUBLIC_IPS failed, ret=%d\n", ret
));
2229 int ctdb_ctrl_ipreallocated(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2230 struct ctdb_client_context
*client
,
2231 int destnode
, struct timeval timeout
)
2233 struct ctdb_req_control request
;
2234 struct ctdb_reply_control
*reply
;
2237 ctdb_req_control_ipreallocated(&request
);
2238 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2242 ("Control IPREALLOCATED failed to node %u, ret=%d\n",
2247 ret
= ctdb_reply_control_ipreallocated(reply
);
2250 ("Control IPREALLOCATED failed, ret=%d\n", ret
));
2257 int ctdb_ctrl_get_runstate(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2258 struct ctdb_client_context
*client
,
2259 int destnode
, struct timeval timeout
,
2260 enum ctdb_runstate
*runstate
)
2262 struct ctdb_req_control request
;
2263 struct ctdb_reply_control
*reply
;
2266 ctdb_req_control_get_runstate(&request
);
2267 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2271 ("Control GET_RUNSTATE failed to node %u, ret=%d\n",
2276 ret
= ctdb_reply_control_get_runstate(reply
, runstate
);
2279 ("Control GET_RUNSTATE failed, ret=%d\n", ret
));
2286 int ctdb_ctrl_db_detach(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2287 struct ctdb_client_context
*client
,
2288 int destnode
, struct timeval timeout
,
2291 struct ctdb_req_control request
;
2292 struct ctdb_reply_control
*reply
;
2295 ctdb_req_control_db_detach(&request
, db_id
);
2296 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2300 ("Control DB_DETACH failed to node %u, ret=%d\n",
2305 ret
= ctdb_reply_control_db_detach(reply
);
2308 ("Control DB_DETACH failed, ret=%d\n", ret
));
2315 int ctdb_ctrl_get_nodes_file(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2316 struct ctdb_client_context
*client
,
2317 int destnode
, struct timeval timeout
,
2318 struct ctdb_node_map
**nodemap
)
2320 struct ctdb_req_control request
;
2321 struct ctdb_reply_control
*reply
;
2324 ctdb_req_control_get_nodes_file(&request
);
2325 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2329 ("Control GET_NODES_FILE failed to node %u, ret=%d\n",
2334 ret
= ctdb_reply_control_get_nodes_file(reply
, mem_ctx
, nodemap
);
2337 ("Control GET_NODES_FILE failed, ret=%d\n", ret
));
2344 int ctdb_ctrl_db_freeze(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2345 struct ctdb_client_context
*client
,
2346 int destnode
, struct timeval timeout
, uint32_t db_id
)
2348 struct ctdb_req_control request
;
2349 struct ctdb_reply_control
*reply
;
2352 ctdb_req_control_db_freeze(&request
, db_id
);
2353 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2357 ("Control DB_FREEZE failed to node %u, ret=%d\n",
2362 ret
= ctdb_reply_control_db_freeze(reply
);
2365 ("Control DB_FREEZE failed, ret=%d\n", ret
));
2372 int ctdb_ctrl_db_thaw(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2373 struct ctdb_client_context
*client
,
2374 int destnode
, struct timeval timeout
, uint32_t db_id
)
2376 struct ctdb_req_control request
;
2377 struct ctdb_reply_control
*reply
;
2380 ctdb_req_control_db_thaw(&request
, db_id
);
2381 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2385 ("Control DB_THAW failed to node %u, ret=%d\n",
2390 ret
= ctdb_reply_control_db_thaw(reply
);
2393 ("Control DB_THAW failed, ret=%d\n", ret
));
2400 int ctdb_ctrl_db_transaction_start(TALLOC_CTX
*mem_ctx
,
2401 struct tevent_context
*ev
,
2402 struct ctdb_client_context
*client
,
2403 int destnode
, struct timeval timeout
,
2404 struct ctdb_transdb
*transdb
)
2406 struct ctdb_req_control request
;
2407 struct ctdb_reply_control
*reply
;
2410 ctdb_req_control_db_transaction_start(&request
, transdb
);
2411 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2415 ("Control DB_TRANSACTION_START failed to node %u, ret=%d\n",
2420 ret
= ctdb_reply_control_db_transaction_start(reply
);
2423 ("Control DB_TRANSACTION_START failed, ret=%d\n", ret
));
2430 int ctdb_ctrl_db_transaction_commit(TALLOC_CTX
*mem_ctx
,
2431 struct tevent_context
*ev
,
2432 struct ctdb_client_context
*client
,
2433 int destnode
, struct timeval timeout
,
2434 struct ctdb_transdb
*transdb
)
2436 struct ctdb_req_control request
;
2437 struct ctdb_reply_control
*reply
;
2440 ctdb_req_control_db_transaction_commit(&request
, transdb
);
2441 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2445 ("Control DB_TRANSACTION_COMMIT failed to node %u, ret=%d\n",
2450 ret
= ctdb_reply_control_db_transaction_commit(reply
);
2453 ("Control DB_TRANSACTION_COMMIT failed, ret=%d\n", ret
));
2460 int ctdb_ctrl_db_transaction_cancel(TALLOC_CTX
*mem_ctx
,
2461 struct tevent_context
*ev
,
2462 struct ctdb_client_context
*client
,
2463 int destnode
, struct timeval timeout
,
2466 struct ctdb_req_control request
;
2467 struct ctdb_reply_control
*reply
;
2470 ctdb_req_control_db_transaction_cancel(&request
, db_id
);
2471 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2475 ("Control DB_TRANSACTION_CANCEL failed to node %u, ret=%d\n",
2480 ret
= ctdb_reply_control_db_transaction_cancel(reply
);
2483 ("Control DB_TRANSACTION_CANCEL failed, ret=%d\n", ret
));
2490 int ctdb_ctrl_db_pull(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2491 struct ctdb_client_context
*client
,
2492 int destnode
, struct timeval timeout
,
2493 struct ctdb_pulldb_ext
*pulldb
, uint32_t *num_records
)
2495 struct ctdb_req_control request
;
2496 struct ctdb_reply_control
*reply
;
2499 ctdb_req_control_db_pull(&request
, pulldb
);
2500 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2504 ("Control DB_PULL failed to node %u, ret=%d\n",
2509 ret
= ctdb_reply_control_db_pull(reply
, num_records
);
2511 DEBUG(DEBUG_ERR
, ("Control DB_PULL failed, ret=%d\n", ret
));
2518 int ctdb_ctrl_db_push_start(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2519 struct ctdb_client_context
*client
,
2520 int destnode
, struct timeval timeout
,
2521 struct ctdb_pulldb_ext
*pulldb
)
2523 struct ctdb_req_control request
;
2524 struct ctdb_reply_control
*reply
;
2527 ctdb_req_control_db_push_start(&request
, pulldb
);
2528 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2532 ("Control DB_PUSH_START failed to node %u, ret=%d\n",
2537 ret
= ctdb_reply_control_db_push_start(reply
);
2540 ("Control DB_PUSH_START failed, ret=%d\n", ret
));
2547 int ctdb_ctrl_db_push_confirm(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2548 struct ctdb_client_context
*client
,
2549 int destnode
, struct timeval timeout
,
2550 uint32_t db_id
, uint32_t *num_records
)
2552 struct ctdb_req_control request
;
2553 struct ctdb_reply_control
*reply
;
2556 ctdb_req_control_db_push_confirm(&request
, db_id
);
2557 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2561 ("Control DB_PUSH_CONFIRM failed to node %u, ret=%d\n",
2566 ret
= ctdb_reply_control_db_push_confirm(reply
, num_records
);
2569 ("Control DB_PUSH_CONFIRM failed, ret=%d\n", ret
));
2576 int ctdb_ctrl_db_open_flags(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2577 struct ctdb_client_context
*client
,
2578 int destnode
, struct timeval timeout
,
2579 uint32_t db_id
, int *tdb_flags
)
2581 struct ctdb_req_control request
;
2582 struct ctdb_reply_control
*reply
;
2585 ctdb_req_control_db_open_flags(&request
, db_id
);
2586 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2590 ("Control DB_OPEN_FLAGS failed to node %u, ret=%d\n",
2595 ret
= ctdb_reply_control_db_open_flags(reply
, tdb_flags
);
2598 ("Control DB_OPEN_FLAGS failed, ret=%d\n", ret
));
2605 int ctdb_ctrl_db_attach_replicated(TALLOC_CTX
*mem_ctx
,
2606 struct tevent_context
*ev
,
2607 struct ctdb_client_context
*client
,
2608 int destnode
, struct timeval timeout
,
2609 const char *db_name
, uint32_t *db_id
)
2611 struct ctdb_req_control request
;
2612 struct ctdb_reply_control
*reply
;
2615 ctdb_req_control_db_attach_replicated(&request
, db_name
);
2616 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2620 ("Control DB_ATTACH_REPLICATED failed to node %u,"
2621 " ret=%d\n", destnode
, ret
));
2625 ret
= ctdb_reply_control_db_attach_replicated(reply
, db_id
);
2628 ("Control DB_ATTACH_REPLICATED failed, ret=%d\n", ret
));
2635 int ctdb_ctrl_check_pid_srvid(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2636 struct ctdb_client_context
*client
,
2637 int destnode
, struct timeval timeout
,
2638 struct ctdb_pid_srvid
*pid_srvid
, int *status
)
2640 struct ctdb_req_control request
;
2641 struct ctdb_reply_control
*reply
;
2644 ctdb_req_control_check_pid_srvid(&request
, pid_srvid
);
2645 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2649 ("Control CHECK_PID_SRVID failed to node %u, ret=%d\n",
2654 ret
= ctdb_reply_control_check_pid_srvid(reply
, status
);
2657 ("Control CHECK_PID_SRVID failed, ret=%d\n", ret
));
2664 int ctdb_ctrl_tunnel_register(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2665 struct ctdb_client_context
*client
,
2666 int destnode
, struct timeval timeout
,
2669 struct ctdb_req_control request
;
2670 struct ctdb_reply_control
*reply
;
2673 ctdb_req_control_tunnel_register(&request
, tunnel_id
);
2674 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2678 ("Control TUNNEL_REGISTER failed to node %u, ret=%d\n",
2683 ret
= ctdb_reply_control_tunnel_register(reply
);
2686 ("Control TUNNEL_REGISTER failed, ret=%d\n", ret
));
2693 int ctdb_ctrl_tunnel_deregister(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
2694 struct ctdb_client_context
*client
,
2695 int destnode
, struct timeval timeout
,
2698 struct ctdb_req_control request
;
2699 struct ctdb_reply_control
*reply
;
2702 ctdb_req_control_tunnel_deregister(&request
, tunnel_id
);
2703 ret
= ctdb_client_control(mem_ctx
, ev
, client
, destnode
, timeout
,
2707 ("Control TUNNEL_DEREGISTER failed to node %u, ret=%d\n",
2712 ret
= ctdb_reply_control_tunnel_deregister(reply
);
2715 ("Control TUNNEL_DEREGISTER failed, ret=%d\n", ret
));