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_message_recd_update_ip(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
39 struct ctdb_client_context
*client
,
40 int destnode
, struct ctdb_public_ip
*pubip
)
42 struct ctdb_req_message message
;
45 message
.srvid
= CTDB_SRVID_RECD_UPDATE_IP
;
46 message
.data
.pubip
= pubip
;
48 ret
= ctdb_client_message(mem_ctx
, ev
, client
, destnode
, &message
);
51 ("Message RECD_UPDATE_IP failed to node %u\n",
58 int ctdb_message_mem_dump(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
59 struct ctdb_client_context
*client
,
60 int destnode
, struct ctdb_srvid_message
*msg
)
62 struct ctdb_req_message message
;
65 message
.srvid
= CTDB_SRVID_MEM_DUMP
;
66 message
.data
.msg
= msg
;
68 ret
= ctdb_client_message(mem_ctx
, ev
, client
, destnode
, &message
);
71 ("Message MEM_DUMP failed to node %u\n", destnode
));
77 int ctdb_message_reload_nodes(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
78 struct ctdb_client_context
*client
,
81 struct ctdb_req_message message
;
84 message
.srvid
= CTDB_SRVID_RELOAD_NODES
;
86 ret
= ctdb_client_message(mem_ctx
, ev
, client
, destnode
, &message
);
89 ("Message RELOAD_NODES failed to node %u\n", destnode
));
95 int ctdb_message_takeover_run(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
96 struct ctdb_client_context
*client
,
97 int destnode
, struct ctdb_srvid_message
*msg
)
99 struct ctdb_req_message message
;
102 message
.srvid
= CTDB_SRVID_TAKEOVER_RUN
;
103 message
.data
.msg
= msg
;
105 ret
= ctdb_client_message(mem_ctx
, ev
, client
, destnode
, &message
);
108 ("Message TAKEOVER_RUN failed to node %u\n", destnode
));
114 int ctdb_message_rebalance_node(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
115 struct ctdb_client_context
*client
,
116 int destnode
, uint32_t pnn
)
118 struct ctdb_req_message message
;
121 message
.srvid
= CTDB_SRVID_REBALANCE_NODE
;
122 message
.data
.pnn
= pnn
;
124 ret
= ctdb_client_message(mem_ctx
, ev
, client
, destnode
, &message
);
127 ("Message REBALANCE_NODE failed to node %u\n",
134 int ctdb_message_disable_takeover_runs(TALLOC_CTX
*mem_ctx
,
135 struct tevent_context
*ev
,
136 struct ctdb_client_context
*client
,
138 struct ctdb_disable_message
*disable
)
140 struct ctdb_req_message message
;
143 message
.srvid
= CTDB_SRVID_DISABLE_TAKEOVER_RUNS
;
144 message
.data
.disable
= disable
;
146 ret
= ctdb_client_message(mem_ctx
, ev
, client
, destnode
, &message
);
149 ("Message DISABLE_TAKEOVER_RUNS failed to node %u\n",
156 int ctdb_message_disable_recoveries(TALLOC_CTX
*mem_ctx
,
157 struct tevent_context
*ev
,
158 struct ctdb_client_context
*client
,
160 struct ctdb_disable_message
*disable
)
162 struct ctdb_req_message message
;
165 message
.srvid
= CTDB_SRVID_DISABLE_RECOVERIES
;
166 message
.data
.disable
= disable
;
168 ret
= ctdb_client_message(mem_ctx
, ev
, client
, destnode
, &message
);
171 ("Message DISABLE_RECOVERIES failed to node %u\n",