[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Thu Jan 12 22:12:04 UTC 2017


The branch, master has been updated
       via  4d8cba6 ctdb-tests: Add takeover helper tests with banned/disconnected nodes
       via  a5b1872 ctdb-takeover: Handle case where there are no RELEASE_IPs to send
       via  b7cfac7 ctdb-takeover: Known and available IP lists should be the same size as nodemap
      from  d35ff9e lib: talloc: Make it clear that talloc_get_size(NULL) returns 0.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4d8cba6f5db1851a738d74030b6b6a118c535c45
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 11 19:20:08 2017 +1100

    ctdb-tests: Add takeover helper tests with banned/disconnected nodes
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12511
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Thu Jan 12 23:11:28 CET 2017 on sn-devel-144

commit a5b187202fa13661aec14cb9e4cbb3b93d4c33f6
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 12 06:52:32 2017 +1100

    ctdb-takeover: Handle case where there are no RELEASE_IPs to send
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12511
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit b7cfac778e8813b22d29859102bab1598cdb5ff0
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Jan 11 16:49:33 2017 +1100

    ctdb-takeover: Known and available IP lists should be the same size as nodemap
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12511
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/server/ctdb_takeover_helper.c            | 23 ++++++++++++++++++-----
 ctdb/tests/takeover_helper/{010.sh => 027.sh} | 10 +++++-----
 ctdb/tests/takeover_helper/{010.sh => 028.sh} | 10 +++++-----
 3 files changed, 28 insertions(+), 15 deletions(-)
 copy ctdb/tests/takeover_helper/{010.sh => 027.sh} (72%)
 copy ctdb/tests/takeover_helper/{010.sh => 028.sh} (72%)


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdb_takeover_helper.c b/ctdb/server/ctdb_takeover_helper.c
index f83b914..5f537c4 100644
--- a/ctdb/server/ctdb_takeover_helper.c
+++ b/ctdb/server/ctdb_takeover_helper.c
@@ -91,7 +91,7 @@ struct get_public_ips_state {
 	struct tevent_context *ev;
 	struct ctdb_client_context *client;
 	uint32_t *pnns;
-	int count;
+	int count, num_nodes;
 	struct ctdb_public_ip_list *ips;
 };
 
@@ -102,7 +102,7 @@ static struct tevent_req *get_public_ips_send(
 				struct tevent_context *ev,
 				struct ctdb_client_context *client,
 				uint32_t *pnns,
-				int count,
+				int count, int num_nodes,
 				bool available_only)
 {
 	struct tevent_req *req, *subreq;
@@ -116,6 +116,7 @@ static struct tevent_req *get_public_ips_send(
 
 	state->pnns = pnns;
 	state->count = count;
+	state->num_nodes = num_nodes;
 	state->ips = NULL;
 
 	ctdb_req_control_get_public_ips(&request, available_only);
@@ -164,7 +165,7 @@ static void get_public_ips_done(struct tevent_req *subreq)
 	}
 
 	state->ips = talloc_zero_array(state, struct ctdb_public_ip_list,
-				       state->count);
+				       state->num_nodes);
 	if (tevent_req_nomem(state->ips, req)) {
 		return;
 	}
@@ -294,6 +295,12 @@ static struct tevent_req *release_ip_send(TALLOC_CTX *mem_ctx,
 			}
 		}
 
+		if (substate->count == 0) {
+			/* No releases to send for this address... */
+			TALLOC_FREE(substate);
+			continue;
+		}
+
 		ip.pnn = tmp_ip->pnn;
 		ip.addr = tmp_ip->addr;
 		ctdb_req_control_release_ip(&request, &ip);
@@ -310,6 +317,12 @@ static struct tevent_req *release_ip_send(TALLOC_CTX *mem_ctx,
 		state->num_sent++;
 	}
 
+	/* None sent, finished... */
+	if (state->num_sent == 0) {
+		tevent_req_done(req);
+		return tevent_req_post(req, ev);
+	}
+
 	return req;
 }
 
@@ -832,7 +845,7 @@ static void takeover_nodemap_done(struct tevent_req *subreq)
 
 	subreq = get_public_ips_send(state, state->ev, state->client,
 				     state->pnns_active, state->num_active,
-				     false);
+				     state->num_nodes, false);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
 	}
@@ -860,7 +873,7 @@ static void takeover_known_ips_done(struct tevent_req *subreq)
 
 	subreq = get_public_ips_send(state, state->ev, state->client,
 				     state->pnns_active, state->num_active,
-				     true);
+				     state->num_nodes, true);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
 	}
diff --git a/ctdb/tests/takeover_helper/010.sh b/ctdb/tests/takeover_helper/027.sh
similarity index 72%
copy from ctdb/tests/takeover_helper/010.sh
copy to ctdb/tests/takeover_helper/027.sh
index 1275156..1c36d87 100755
--- a/ctdb/tests/takeover_helper/010.sh
+++ b/ctdb/tests/takeover_helper/027.sh
@@ -2,13 +2,13 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-define_test "3 nodes, all ok, IPs all unassigned"
+define_test "3 nodes, 2 banned, IPs all unassigned"
 
 setup_ctdbd <<EOF
 NODEMAP
 0       192.168.20.41   0x0     CURRENT RECMASTER
-1       192.168.20.42   0x0
-2       192.168.20.43   0x0
+1       192.168.20.42   0x8
+2       192.168.20.43   0x8
 
 IFACES
 :Name:LinkStatus:References:
@@ -26,8 +26,8 @@ test_takeover_helper
 
 required_result 0 <<EOF
 Public IPs on ALL nodes
-10.0.0.31 2
-10.0.0.32 1
+10.0.0.31 0
+10.0.0.32 0
 10.0.0.33 0
 EOF
 test_ctdb_ip_all
diff --git a/ctdb/tests/takeover_helper/010.sh b/ctdb/tests/takeover_helper/028.sh
similarity index 72%
copy from ctdb/tests/takeover_helper/010.sh
copy to ctdb/tests/takeover_helper/028.sh
index 1275156..a69cd47 100755
--- a/ctdb/tests/takeover_helper/010.sh
+++ b/ctdb/tests/takeover_helper/028.sh
@@ -2,13 +2,13 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-define_test "3 nodes, all ok, IPs all unassigned"
+define_test "3 nodes, 2 banned, IPs all unassigned"
 
 setup_ctdbd <<EOF
 NODEMAP
 0       192.168.20.41   0x0     CURRENT RECMASTER
-1       192.168.20.42   0x0
-2       192.168.20.43   0x0
+1       192.168.20.42   0x1
+2       192.168.20.43   0x1
 
 IFACES
 :Name:LinkStatus:References:
@@ -26,8 +26,8 @@ test_takeover_helper
 
 required_result 0 <<EOF
 Public IPs on ALL nodes
-10.0.0.31 2
-10.0.0.32 1
+10.0.0.31 0
+10.0.0.32 0
 10.0.0.33 0
 EOF
 test_ctdb_ip_all


-- 
Samba Shared Repository



More information about the samba-cvs mailing list