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

ctdb: send a CTDB_SRVID_START_IPREALLOCATE message after CTDB_EVENT_START_IPREALLOCATE

Event scripts run the "start_ipreallocate" hook in order to notice
that some ip addresses in the cluster potentially changed.

CTDB_SRVID_START_IPREALLOCATE gives C code a chance to get notified as well
once the event scripts are finished.

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Vinit Agnihotri 2024-02-27 00:13:57 -08:00 committed by Volker Lendecke
parent 2483a2ae20
commit 7dacbcd0ec
4 changed files with 21 additions and 0 deletions

View File

@ -143,6 +143,9 @@ struct ctdb_call {
/* SRVID to inform clients that CTDB_EVENT_IPREALLOCATED finished */
#define CTDB_SRVID_IPREALLOCATED 0xF302000000000000LL
/* SRVID to inform clients that CTDB_EVENT_START_IPREALLOCATE finished */
#define CTDB_SRVID_START_IPREALLOCATE 0xF303000000000000LL
/* SRVID to inform recovery daemon of the node flags - OBSOLETE */
#define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL

View File

@ -304,6 +304,8 @@ static void ctdb_srvid_print(uint64_t srvid, FILE *fp)
fprintf(fp, "TAKE_IP");
} else if (srvid == CTDB_SRVID_IPREALLOCATED) {
fprintf(fp, "IPREALLOCATED");
} else if (srvid == CTDB_SRVID_START_IPREALLOCATE) {
fprintf(fp, "START_IPREALLOCATE");
} else if (srvid == CTDB_SRVID_SET_NODE_FLAGS) {
fprintf(fp, "SET_NODE_FLAGS");
} else if (srvid == CTDB_SRVID_RECD_UPDATE_IP) {

View File

@ -60,6 +60,9 @@ static size_t ctdb_message_data_len(union ctdb_message_data *mdata,
case CTDB_SRVID_IPREALLOCATED:
break;
case CTDB_SRVID_START_IPREALLOCATE:
break;
case CTDB_SRVID_SET_NODE_FLAGS:
len = ctdb_node_flag_change_len(mdata->flag_change);
break;
@ -154,6 +157,9 @@ static void ctdb_message_data_push(union ctdb_message_data *mdata,
case CTDB_SRVID_IPREALLOCATED:
break;
case CTDB_SRVID_START_IPREALLOCATE:
break;
case CTDB_SRVID_SET_NODE_FLAGS:
ctdb_node_flag_change_push(mdata->flag_change, buf, &np);
break;
@ -253,6 +259,9 @@ static int ctdb_message_data_pull(uint8_t *buf, size_t buflen,
case CTDB_SRVID_IPREALLOCATED:
break;
case CTDB_SRVID_START_IPREALLOCATE:
break;
case CTDB_SRVID_SET_NODE_FLAGS:
ret = ctdb_node_flag_change_pull(buf, buflen, mem_ctx,
&mdata->flag_change, &np);

View File

@ -2458,6 +2458,7 @@ static void ctdb_start_ipreallocate_callback(struct ctdb_context *ctdb,
{
struct start_ipreallocate_callback_state *state = talloc_get_type_abort(
p, struct start_ipreallocate_callback_state);
TDB_DATA data = { .dsize = 0, };
if (status != 0) {
D_ERR("\"startipreallocate\" event failed (status %d)\n",
@ -2467,6 +2468,12 @@ static void ctdb_start_ipreallocate_callback(struct ctdb_context *ctdb,
}
}
D_INFO("Sending START_IPREALLOCATE message\n");
ctdb_daemon_send_message(ctdb,
ctdb->pnn,
CTDB_SRVID_START_IPREALLOCATE,
data);
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
talloc_free(state);
}