From: Amitay Isaacs Date: Thu, 17 Mar 2016 06:16:09 +0000 (+1100) Subject: ctdb-protocol: Add srvid for assigning banning credits X-Git-Tag: tdb-1.3.9~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fc63eae80b7b521598560b970a4ce10a0838a3ce;p=thirdparty%2Fsamba.git ctdb-protocol: Add srvid for assigning banning credits Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h index 28f036eff55..3914c692091 100644 --- a/ctdb/protocol/protocol.h +++ b/ctdb/protocol/protocol.h @@ -124,6 +124,9 @@ struct ctdb_call { /* SRVID prefix used during recovery for pulling and pushing databases */ #define CTDB_SRVID_RECOVERY 0xF001000000000000LL +/* SRVID to assign of banning credits */ +#define CTDB_SRVID_BANNING 0xF002000000000000LL + /* SRVID to inform of election data */ #define CTDB_SRVID_ELECTION 0xF100000000000000LL @@ -992,7 +995,7 @@ union ctdb_message_data { uint32_t db_id; /* SRVID_MEM_DUMP, SRVID_TAKEOVER_RUN */ struct ctdb_srvid_message *msg; - /* SRVID_REBALANCE_NODE */ + /* SRVID_BANNING, SRVID_REBALANCE_NODE */ uint32_t pnn; /* SRVID_DISABLE_TAKEOVER_RUNS, SRVID_DISABLE_RECOVERIES */ struct ctdb_disable_message *disable; diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c index 889ebec377f..c54e014e2d5 100644 --- a/ctdb/protocol/protocol_debug.c +++ b/ctdb/protocol/protocol_debug.c @@ -282,6 +282,8 @@ static void ctdb_srvid_print(uint64_t srvid, FILE *fp) } else if ((srvid & prefix) == CTDB_SRVID_RECOVERY) { srvid = srvid & ~CTDB_SRVID_RECOVERY; fprintf(fp, "RECOVERY-%"PRIx64"", srvid); + } else if (srvid == CTDB_SRVID_BANNING) { + fprintf(fp, "BANNING"); } else if (srvid == CTDB_SRVID_ELECTION) { fprintf(fp, "ELECTION"); } else if (srvid == CTDB_SRVID_RECONFIGURE) { diff --git a/ctdb/protocol/protocol_message.c b/ctdb/protocol/protocol_message.c index b6701092c85..920cd1cd14a 100644 --- a/ctdb/protocol/protocol_message.c +++ b/ctdb/protocol/protocol_message.c @@ -40,6 +40,10 @@ static size_t ctdb_message_data_len(union ctdb_message_data *mdata, size_t len = 0; switch (srvid) { + case CTDB_SRVID_BANNING: + len = ctdb_uint32_len(mdata->pnn); + break; + case CTDB_SRVID_ELECTION: len = ctdb_election_message_len(mdata->election); break; @@ -114,6 +118,10 @@ static void ctdb_message_data_push(union ctdb_message_data *mdata, uint64_t srvid, uint8_t *buf) { switch (srvid) { + case CTDB_SRVID_BANNING: + ctdb_uint32_push(mdata->pnn, buf); + break; + case CTDB_SRVID_ELECTION: ctdb_election_message_push(mdata->election, buf); break; @@ -189,6 +197,10 @@ static int ctdb_message_data_pull(uint8_t *buf, size_t buflen, int ret = 0; switch (srvid) { + case CTDB_SRVID_BANNING: + ret = ctdb_uint32_pull(buf, buflen, mem_ctx, &mdata->pnn); + break; + case CTDB_SRVID_ELECTION: ret = ctdb_election_message_pull(buf, buflen, mem_ctx, &mdata->election);