1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-07 17:18:11 +03:00

ctdb-client: Add client code for disable/enable controls

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 6fe6a54e7f)
This commit is contained in:
Martin Schwenke 2021-07-09 14:32:12 +10:00 committed by Jule Anger
parent cb64c64ddb
commit c8d130f139
2 changed files with 80 additions and 0 deletions

View File

@ -2660,3 +2660,71 @@ int ctdb_ctrl_tunnel_deregister(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
return 0;
}
int ctdb_ctrl_disable_node(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct ctdb_client_context *client,
int destnode,
struct timeval timeout)
{
struct ctdb_req_control request;
struct ctdb_reply_control *reply;
int ret;
ctdb_req_control_disable_node(&request);
ret = ctdb_client_control(mem_ctx,
ev,
client,
destnode,
timeout,
&request,
&reply);
if (ret != 0) {
D_ERR("Control DISABLE_NODE failed to node %u, ret=%d\n",
destnode,
ret);
return ret;
}
ret = ctdb_reply_control_disable_node(reply);
if (ret != 0) {
D_ERR("Control DISABLE_NODE failed, ret=%d\n", ret);
return ret;
}
return 0;
}
int ctdb_ctrl_enable_node(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct ctdb_client_context *client,
int destnode,
struct timeval timeout)
{
struct ctdb_req_control request;
struct ctdb_reply_control *reply;
int ret;
ctdb_req_control_enable_node(&request);
ret = ctdb_client_control(mem_ctx,
ev,
client,
destnode,
timeout,
&request,
&reply);
if (ret != 0) {
D_ERR("Control ENABLE_NODE failed to node %u, ret=%d\n",
destnode,
ret);
return ret;
}
ret = ctdb_reply_control_enable_node(reply);
if (ret != 0) {
D_ERR("Control ENABLE_NODE failed, ret=%d\n", ret);
return ret;
}
return 0;
}

View File

@ -482,6 +482,18 @@ int ctdb_ctrl_tunnel_deregister(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
int destnode, struct timeval timeout,
uint64_t tunnel_id);
int ctdb_ctrl_disable_node(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct ctdb_client_context *client,
int destnode,
struct timeval timeout);
int ctdb_ctrl_enable_node(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct ctdb_client_context *client,
int destnode,
struct timeval timeout);
/* from client/client_message_sync.c */
int ctdb_message_recd_update_ip(TALLOC_CTX *mem_ctx, struct tevent_context *ev,