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

ctdb-protocol: Add marshalling for controls DISABLE_NODE/ENABLE_NODE

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>
This commit is contained in:
Martin Schwenke 2021-07-09 12:10:12 +10:00 committed by Amitay Isaacs
parent 49dc5d8cd2
commit 6845dca87e
7 changed files with 82 additions and 2 deletions

View File

@ -605,6 +605,12 @@ void ctdb_req_control_echo_data(struct ctdb_req_control *request,
struct ctdb_echo_data *echo_data); struct ctdb_echo_data *echo_data);
int ctdb_reply_control_echo_data(struct ctdb_reply_control *reply); int ctdb_reply_control_echo_data(struct ctdb_reply_control *reply);
void ctdb_req_control_disable_node(struct ctdb_req_control *request);
int ctdb_reply_control_disable_node(struct ctdb_reply_control *reply);
void ctdb_req_control_enable_node(struct ctdb_req_control *request);
int ctdb_reply_control_enable_node(struct ctdb_reply_control *reply);
/* From protocol/protocol_debug.c */ /* From protocol/protocol_debug.c */
void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp); void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);

View File

@ -2360,3 +2360,39 @@ int ctdb_reply_control_echo_data(struct ctdb_reply_control *reply)
return reply->status; return reply->status;
} }
/* CTDB_CONTROL_DISABLE_NODE */
void ctdb_req_control_disable_node(struct ctdb_req_control *request)
{
request->opcode = CTDB_CONTROL_DISABLE_NODE;
request->pad = 0;
request->srvid = 0;
request->client_id = 0;
request->flags = 0;
request->rdata.opcode = CTDB_CONTROL_DISABLE_NODE;
}
int ctdb_reply_control_disable_node(struct ctdb_reply_control *reply)
{
return ctdb_reply_control_generic(reply, CTDB_CONTROL_DISABLE_NODE);
}
/* CTDB_CONTROL_ENABLE_NODE */
void ctdb_req_control_enable_node(struct ctdb_req_control *request)
{
request->opcode = CTDB_CONTROL_ENABLE_NODE;
request->pad = 0;
request->srvid = 0;
request->client_id = 0;
request->flags = 0;
request->rdata.opcode = CTDB_CONTROL_ENABLE_NODE;
}
int ctdb_reply_control_enable_node(struct ctdb_reply_control *reply)
{
return ctdb_reply_control_generic(reply, CTDB_CONTROL_ENABLE_NODE);
}

View File

@ -411,6 +411,12 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
case CTDB_CONTROL_ECHO_DATA: case CTDB_CONTROL_ECHO_DATA:
len = ctdb_echo_data_len(cd->data.echo_data); len = ctdb_echo_data_len(cd->data.echo_data);
break; break;
case CTDB_CONTROL_DISABLE_NODE:
break;
case CTDB_CONTROL_ENABLE_NODE:
break;
} }
return len; return len;
@ -1385,6 +1391,12 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd)
case CTDB_CONTROL_ECHO_DATA: case CTDB_CONTROL_ECHO_DATA:
len = ctdb_echo_data_len(cd->data.echo_data); len = ctdb_echo_data_len(cd->data.echo_data);
break; break;
case CTDB_CONTROL_DISABLE_NODE:
break;
case CTDB_CONTROL_ENABLE_NODE:
break;
} }
return len; return len;

View File

@ -243,6 +243,8 @@ static void ctdb_opcode_print(uint32_t opcode, FILE *fp)
{ CTDB_CONTROL_VACUUM_FETCH, "VACUUM_FETCH" }, { CTDB_CONTROL_VACUUM_FETCH, "VACUUM_FETCH" },
{ CTDB_CONTROL_DB_VACUUM, "DB_VACUUM" }, { CTDB_CONTROL_DB_VACUUM, "DB_VACUUM" },
{ CTDB_CONTROL_ECHO_DATA, "ECHO_DATA" }, { CTDB_CONTROL_ECHO_DATA, "ECHO_DATA" },
{ CTDB_CONTROL_DISABLE_NODE, "DISABLE_NODE" },
{ CTDB_CONTROL_ENABLE_NODE, "ENABLE_NODE" },
{ MAP_END, "" }, { MAP_END, "" },
}; };

View File

@ -2,7 +2,7 @@
. "${TEST_SCRIPTS_DIR}/unit.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
last_control=156 last_control=158
generate_control_output () generate_control_output ()
{ {

View File

@ -594,6 +594,12 @@ void fill_ctdb_req_control_data(TALLOC_CTX *mem_ctx,
assert(cd->data.echo_data != NULL); assert(cd->data.echo_data != NULL);
fill_ctdb_echo_data(mem_ctx, cd->data.echo_data); fill_ctdb_echo_data(mem_ctx, cd->data.echo_data);
break; break;
case CTDB_CONTROL_DISABLE_NODE:
break;
case CTDB_CONTROL_ENABLE_NODE:
break;
} }
} }
@ -984,6 +990,12 @@ void verify_ctdb_req_control_data(struct ctdb_req_control_data *cd,
case CTDB_CONTROL_ECHO_DATA: case CTDB_CONTROL_ECHO_DATA:
verify_ctdb_echo_data(cd->data.echo_data, cd2->data.echo_data); verify_ctdb_echo_data(cd->data.echo_data, cd2->data.echo_data);
break; break;
case CTDB_CONTROL_DISABLE_NODE:
break;
case CTDB_CONTROL_ENABLE_NODE:
break;
} }
} }
@ -1380,6 +1392,12 @@ void fill_ctdb_reply_control_data(TALLOC_CTX *mem_ctx,
assert(cd->data.echo_data != NULL); assert(cd->data.echo_data != NULL);
fill_ctdb_echo_data(mem_ctx, cd->data.echo_data); fill_ctdb_echo_data(mem_ctx, cd->data.echo_data);
break; break;
case CTDB_CONTROL_DISABLE_NODE:
break;
case CTDB_CONTROL_ENABLE_NODE:
break;
} }
} }
@ -1717,6 +1735,12 @@ void verify_ctdb_reply_control_data(struct ctdb_reply_control_data *cd,
case CTDB_CONTROL_ECHO_DATA: case CTDB_CONTROL_ECHO_DATA:
verify_ctdb_echo_data(cd->data.echo_data, cd2->data.echo_data); verify_ctdb_echo_data(cd->data.echo_data, cd2->data.echo_data);
break; break;
case CTDB_CONTROL_DISABLE_NODE:
break;
case CTDB_CONTROL_ENABLE_NODE:
break;
} }
} }

View File

@ -284,7 +284,7 @@ PROTOCOL_CTDB4_TEST(struct ctdb_req_dmaster, ctdb_req_dmaster,
PROTOCOL_CTDB4_TEST(struct ctdb_reply_dmaster, ctdb_reply_dmaster, PROTOCOL_CTDB4_TEST(struct ctdb_reply_dmaster, ctdb_reply_dmaster,
CTDB_REPLY_DMASTER); CTDB_REPLY_DMASTER);
#define NUM_CONTROLS 157 #define NUM_CONTROLS 159
PROTOCOL_CTDB2_TEST(struct ctdb_req_control_data, ctdb_req_control_data); PROTOCOL_CTDB2_TEST(struct ctdb_req_control_data, ctdb_req_control_data);
PROTOCOL_CTDB2_TEST(struct ctdb_reply_control_data, ctdb_reply_control_data); PROTOCOL_CTDB2_TEST(struct ctdb_reply_control_data, ctdb_reply_control_data);