ctdb: add comments to "addip"/"delip" when CTDB_{CONTROL,EVENT,SRVID}_IPREALLOCATED...
authorStefan Metzmacher <metze@samba.org>
Fri, 24 Nov 2023 10:51:54 +0000 (11:51 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 4 Jan 2024 11:39:36 +0000 (11:39 +0000)
"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 <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/tools/ctdb.c

index 119e2bfab0b6adf9b38c843a380d3d5d43cfe353..6e8185ff4951789896bf825f8d058158cd539a59 100644 (file)
@@ -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;
 }