1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-client: Add available-only option public IP fetching

Update tool accordingly.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-11-10 16:11:12 +11:00 committed by Amitay Isaacs
parent 44465817dd
commit 7d1b39cf80
5 changed files with 19 additions and 8 deletions

View File

@ -470,6 +470,7 @@ int ctdb_ctrl_takeover_ip(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
int ctdb_ctrl_get_public_ips(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
struct ctdb_client_context *client,
int destnode, struct timeval timeout,
bool available_only,
struct ctdb_public_ip_list **pubip_list);
int ctdb_ctrl_get_nodemap(TALLOC_CTX *mem_ctx, struct tevent_context *ev,

View File

@ -1527,13 +1527,14 @@ int ctdb_ctrl_takeover_ip(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
int ctdb_ctrl_get_public_ips(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
struct ctdb_client_context *client,
int destnode, struct timeval timeout,
bool available_only,
struct ctdb_public_ip_list **pubip_list)
{
struct ctdb_req_control request;
struct ctdb_reply_control *reply;
int ret;
ctdb_req_control_get_public_ips(&request);
ctdb_req_control_get_public_ips(&request, available_only);
ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
&request, &reply);
if (ret != 0) {

View File

@ -412,7 +412,8 @@ void ctdb_req_control_takeover_ip(struct ctdb_req_control *request,
struct ctdb_public_ip *pubip);
int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply);
void ctdb_req_control_get_public_ips(struct ctdb_req_control *request);
void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
bool available_only);
int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,
TALLOC_CTX *mem_ctx,
struct ctdb_public_ip_list **pubip_list);

View File

@ -1358,7 +1358,8 @@ int ctdb_reply_control_takeover_ip(struct ctdb_reply_control *reply)
/* CTDB_CONTROL_GET_PUBLIC_IPS */
void ctdb_req_control_get_public_ips(struct ctdb_req_control *request)
void ctdb_req_control_get_public_ips(struct ctdb_req_control *request,
bool available_only)
{
request->opcode = CTDB_CONTROL_GET_PUBLIC_IPS;
request->pad = 0;
@ -1367,6 +1368,9 @@ void ctdb_req_control_get_public_ips(struct ctdb_req_control *request)
request->flags = 0;
request->rdata.opcode = CTDB_CONTROL_GET_PUBLIC_IPS;
if (available_only) {
request->flags = CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE;
}
}
int ctdb_reply_control_get_public_ips(struct ctdb_reply_control *reply,

View File

@ -1552,7 +1552,8 @@ static int get_all_public_ips(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
for (i=0; i<count; i++) {
ret = ctdb_ctrl_get_public_ips(mem_ctx, ctdb->ev, ctdb->client,
pnn_list[i], TIMEOUT(), &ips);
pnn_list[i], TIMEOUT(),
false, &ips);
if (ret != 0) {
goto failed;
}
@ -1657,7 +1658,8 @@ static int control_ip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
ret = get_all_public_ips(ctdb, mem_ctx, &ips);
} else {
ret = ctdb_ctrl_get_public_ips(mem_ctx, ctdb->ev, ctdb->client,
ctdb->cmd_pnn, TIMEOUT(), &ips);
ctdb->cmd_pnn, TIMEOUT(),
false, &ips);
}
if (ret != 0) {
return ret;
@ -3809,7 +3811,7 @@ static int moveip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
}
ret = ctdb_ctrl_get_public_ips(mem_ctx, ctdb->ev, ctdb->client,
pnn, TIMEOUT(), &pubip_list);
pnn, TIMEOUT(), false, &pubip_list);
if (ret != 0) {
fprintf(stderr, "Failed to get Public IPs from node %u\n",
pnn);
@ -3937,7 +3939,8 @@ static int control_addip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
}
ret = ctdb_ctrl_get_public_ips(mem_ctx, ctdb->ev, ctdb->client,
ctdb->cmd_pnn, TIMEOUT(), &pubip_list);
ctdb->cmd_pnn, TIMEOUT(),
false, &pubip_list);
if (ret != 0) {
fprintf(stderr, "Failed to get Public IPs from node %u\n",
ctdb->cmd_pnn);
@ -4000,7 +4003,8 @@ static int control_delip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
}
ret = ctdb_ctrl_get_public_ips(mem_ctx, ctdb->ev, ctdb->client,
ctdb->cmd_pnn, TIMEOUT(), &pubip_list);
ctdb->cmd_pnn, TIMEOUT(),
false, &pubip_list);
if (ret != 0) {
fprintf(stderr, "Failed to get Public IPs from node %u\n",
ctdb->cmd_pnn);