From f635bd8997e2df1ed61429520e19fedb13cad97e Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Mon, 15 Aug 2016 15:54:51 +1000 Subject: [PATCH] ctdb-tools: Addition of IPs is deferred until the next takeover run BUG: https://bugzilla.samba.org/show_bug.cgi?id=12152 This makes the behaviour of "ctdb addip" similar to "ctdb delip". Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/doc/ctdb.1.xml | 13 ++++++++----- ctdb/tests/simple/16_ctdb_config_add_ip.sh | 1 + ctdb/tests/simple/60_recoverd_missing_ip.sh | 1 + ctdb/tools/ctdb.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index 9324813fe51..d2952137d3b 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -1031,13 +1031,16 @@ DB Statistics: locking.tdb addip <parameter>IPADDR</parameter>/<parameter>mask</parameter> <parameter>IFACE</parameter> - This command is used to add a new public ip to a node during runtime. - This allows public addresses to be added to a cluster without having - to restart the ctdb daemons. + This command is used to add a new public ip to a node + during runtime. It should be followed by a ctdb + ipreallocate. This allows public addresses to be + added to a cluster without having to restart the ctdb daemons. - Note that this only updates the runtime instance of ctdb. Any changes will be lost next time ctdb is restarted and the public addresses file is re-read. - If you want this change to be permanent you must also update the public addresses file manually. + Note that this only updates the runtime instance of ctdb. Any + changes will be lost next time ctdb is restarted and the public + addresses file is re-read. If you want this change to be + permanent you must also update the public addresses file manually. diff --git a/ctdb/tests/simple/16_ctdb_config_add_ip.sh b/ctdb/tests/simple/16_ctdb_config_add_ip.sh index d33ec040577..0bc668a906e 100755 --- a/ctdb/tests/simple/16_ctdb_config_add_ip.sh +++ b/ctdb/tests/simple/16_ctdb_config_add_ip.sh @@ -34,4 +34,5 @@ try_command_on_node -v all $CTDB ip echo "Adding IP ${test_ip}/${mask} on ${iface}, node ${test_node}" try_command_on_node $test_node $CTDB addip ${test_ip}/${mask} $iface +try_command_on_node $test_node $CTDB ipreallocate wait_until_ips_are_on_node $test_node $test_ip diff --git a/ctdb/tests/simple/60_recoverd_missing_ip.sh b/ctdb/tests/simple/60_recoverd_missing_ip.sh index cf68b19a515..c6b4de073a8 100755 --- a/ctdb/tests/simple/60_recoverd_missing_ip.sh +++ b/ctdb/tests/simple/60_recoverd_missing_ip.sh @@ -63,6 +63,7 @@ try_command_on_node $test_node $CTDB setifacelink $iface down echo "Adding IP $test_ip to node $test_node" try_command_on_node $test_node $CTDB addip $test_ip/$mask $iface +try_command_on_node $test_node $CTDB ipreallocate echo "Wait long enough for IP verification to have taken place" sleep_for 15 diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 2cb699aadf2..d96ee8800d0 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -3960,7 +3960,7 @@ static int control_addip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, return ret; } - return ipreallocate(mem_ctx, ctdb); + return 0; } static int control_delip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,