s3:winbindd: call process_set_title() for locator child
[Samba.git] / ctdb / client / client_message_sync.c
bloba23cd6cfd2afad892365170daa7a2ca495eb7787
1 /*
2 CTDB client code
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/>.
20 #include "replace.h"
21 #include "system/network.h"
22 #include "system/filesys.h"
24 #include <talloc.h>
25 #include <tevent.h>
26 #include <tdb.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;
43 int ret;
45 message.srvid = CTDB_SRVID_RECD_UPDATE_IP;
46 message.data.pubip = pubip;
48 ret = ctdb_client_message(mem_ctx, ev, client, destnode, &message);
49 if (ret != 0) {
50 DEBUG(DEBUG_ERR,
51 ("Message RECD_UPDATE_IP failed to node %u\n",
52 destnode));
55 return ret;
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;
63 int ret;
65 message.srvid = CTDB_SRVID_MEM_DUMP;
66 message.data.msg = msg;
68 ret = ctdb_client_message(mem_ctx, ev, client, destnode, &message);
69 if (ret != 0) {
70 DEBUG(DEBUG_ERR,
71 ("Message MEM_DUMP failed to node %u\n", destnode));
74 return ret;
77 int ctdb_message_reload_nodes(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
78 struct ctdb_client_context *client,
79 int destnode)
81 struct ctdb_req_message message;
82 int ret;
84 message.srvid = CTDB_SRVID_RELOAD_NODES;
86 ret = ctdb_client_message(mem_ctx, ev, client, destnode, &message);
87 if (ret != 0) {
88 DEBUG(DEBUG_ERR,
89 ("Message RELOAD_NODES failed to node %u\n", destnode));
92 return ret;
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;
100 int ret;
102 message.srvid = CTDB_SRVID_TAKEOVER_RUN;
103 message.data.msg = msg;
105 ret = ctdb_client_message(mem_ctx, ev, client, destnode, &message);
106 if (ret != 0) {
107 DEBUG(DEBUG_ERR,
108 ("Message TAKEOVER_RUN failed to node %u\n", destnode));
111 return ret;
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;
119 int ret;
121 message.srvid = CTDB_SRVID_REBALANCE_NODE;
122 message.data.pnn = pnn;
124 ret = ctdb_client_message(mem_ctx, ev, client, destnode, &message);
125 if (ret != 0) {
126 DEBUG(DEBUG_ERR,
127 ("Message REBALANCE_NODE failed to node %u\n",
128 destnode));
131 return ret;
134 int ctdb_message_disable_takeover_runs(TALLOC_CTX *mem_ctx,
135 struct tevent_context *ev,
136 struct ctdb_client_context *client,
137 int destnode,
138 struct ctdb_disable_message *disable)
140 struct ctdb_req_message message;
141 int ret;
143 message.srvid = CTDB_SRVID_DISABLE_TAKEOVER_RUNS;
144 message.data.disable = disable;
146 ret = ctdb_client_message(mem_ctx, ev, client, destnode, &message);
147 if (ret != 0) {
148 DEBUG(DEBUG_ERR,
149 ("Message DISABLE_TAKEOVER_RUNS failed to node %u\n",
150 destnode));
153 return ret;
156 int ctdb_message_disable_recoveries(TALLOC_CTX *mem_ctx,
157 struct tevent_context *ev,
158 struct ctdb_client_context *client,
159 int destnode,
160 struct ctdb_disable_message *disable)
162 struct ctdb_req_message message;
163 int ret;
165 message.srvid = CTDB_SRVID_DISABLE_RECOVERIES;
166 message.data.disable = disable;
168 ret = ctdb_client_message(mem_ctx, ev, client, destnode, &message);
169 if (ret != 0) {
170 DEBUG(DEBUG_ERR,
171 ("Message DISABLE_RECOVERIES failed to node %u\n",
172 destnode));
175 return ret;