From b6a4bd09ff2c4e7aca5d8cb9f046b3c8d9f1c174 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 24 Nov 2023 11:51:54 +0100 Subject: [PATCH] ctdb: add comments to "addip"/"delip" when CTDB_{CONTROL,EVENT,SRVID}_IPREALLOCATED happens "addip"/"delip" are different from "moveip" so they don't need to call ipreallocate() nor send_ipreallocated_control_to_nodes(). Signed-off-by: Stefan Metzmacher Reviewed-by: Martin Schwenke (cherry picked from commit 62654f0aeb1909129e87df061186509560859bed) --- ctdb/tools/ctdb.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 119e2bfab0b6..6e8185ff4951 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -4080,6 +4080,17 @@ static int control_addip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, return ret; } + /* + * CTDB_CONTROL_ADD_PUBLIC_IP will implicitly trigger + * CTDB_SRVID_TAKEOVER_RUN broadcast to all connected nodes. + * + * That means CTDB_{CONTROL,EVENT,SRVID}_IPREALLOCATED is + * triggered at the end of the takeover run... + * + * So we don't need to call ipreallocate() nor + * send_ipreallocated_control_to_nodes() here... + */ + return 0; } @@ -4135,6 +4146,21 @@ static int control_delip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, return ret; } + /* + * CTDB_CONTROL_DEL_PUBLIC_IP only marks the public ip + * with pending_delete if it's still in use. + * + * Any later takeover run will really move the public ip + * away from the local node and finally removes it. + * + * That means CTDB_{CONTROL,EVENT,SRVID}_IPREALLOCATED is + * triggered at the end of the takeover run that actually + * moves the public ip away. + * + * So we don't need to call ipreallocate() nor + * send_ipreallocated_control_to_nodes() here... + */ + return 0; } -- 2.34.1