[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Wed Sep 14 10:31:03 UTC 2016


The branch, master has been updated
       via  9f6015f ctdb-tests: Add new public IP takeover no-op test
       via  3adf9ca ctdb-tests: Factor out new local daemons functions ps_ctdbd
       via  7ec7d4f ctdb-ipalloc: ipalloc_set_public_ips() can't fail
       via  7522a7a ctdb-ipalloc: Move merged IP list creation to ipalloc()
       via  c1efb80 ctdb-ipalloc: Drop known_ips argument from merged IP list creation
       via  fed2517 ctdb-ipalloc: Optimise check to see if IPs can be hosted
       via  dfc3b88 ctdb-ipalloc: Whether IPs can be hosted need not depend on merged IP list
       via  0e5c62d ctdb-ipalloc: Store known public IPs in IP allocation state
       via  35dcaad ctdb-packaging: Fix systemd network dependency
       via  93535da ctdb-daemon: Remove NUM_DB_PRIORITIES
       via  67351e6 ctdb-recoverd: Drop code to freeze databases from set_recovery_mode()
       via  b9f120d s3-ctdb: Use correct db_id size in marshalling record buffer
       via  682676a ctdb-common: Use correct db_id size in marshalling record buffer
       via  bdff625 ctdb-protocol: Fix marshalling for GET_DB_SEQNUM control request
      from  b0dadbe s3:libsmb fix a typo

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


- Log -----------------------------------------------------------------
commit 9f6015f8a61f71db7239fb8dce94781629b1d4cc
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Sep 13 13:48:19 2016 +1000

    ctdb-tests: Add new public IP takeover no-op test
    
    Test with DisableIPFailover=1 and with no public IP addresses
    configured.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254
    
    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): Wed Sep 14 12:30:30 CEST 2016 on sn-devel-144

commit 3adf9cad47532d9ebf7ae3e4e618dfe7100008fb
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Sep 13 13:44:04 2016 +1000

    ctdb-tests: Factor out new local daemons functions ps_ctdbd
    
    Useful for being able to ensure that tests are doing what is expected.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 7ec7d4f3c08799fa128401f08f2f810672b98ae8
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Sep 12 16:04:18 2016 +1000

    ctdb-ipalloc: ipalloc_set_public_ips() can't fail
    
    So make it a void function.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 7522a7aee8f4756639311d2450b723debd674c6b
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Sep 12 15:59:09 2016 +1000

    ctdb-ipalloc: Move merged IP list creation to ipalloc()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit c1efb801a41f5b870317b14703b8a1cfecc5c68c
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Sep 12 15:57:23 2016 +1000

    ctdb-ipalloc: Drop known_ips argument from merged IP list creation
    
    This is available in the IP allocation state.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit fed251726facf30225a131d43658975d5f4befb5
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Sep 12 15:51:58 2016 +1000

    ctdb-ipalloc: Optimise check to see if IPs can be hosted
    
    Add an early return if there are no known IP addresses.
    
    Also add an extra comment for clarification.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit dfc3b8855d0a740d4f5218fcda4b3f64d4d6cd17
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Sep 12 15:49:03 2016 +1000

    ctdb-ipalloc: Whether IPs can be hosted need not depend on merged IP list
    
    Merged IP list won't be available here...
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 0e5c62d8fc7fa51b4fb1dd435fe9c776586e5947
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Sep 12 15:41:06 2016 +1000

    ctdb-ipalloc: Store known public IPs in IP allocation state
    
    This was dropped because it wasn't used, but it will be needed again.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 35dcaadc8ebc9ec80e04f1d2eee694ebc6914a31
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Sep 8 12:28:00 2016 +1000

    ctdb-packaging: Fix systemd network dependency
    
    https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ says:
    
      network.target has very little meaning during start-up. [...]
      Whether any network interfaces are already configured when it is
      reached is undefined. [...]
    
      network-online.target is a target that actively waits until the
      ne[t]work is "up",
    
    CTDB expects to be able to bind a socket to a node address and expects
    interfaces for public IP addresses to exist.  CTDB also doesn't expect
    time to jump, so also wait until time is synchronised.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12255
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Steve French <sfrench at samba.org>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    Tested-by: Steve French <sfrench at samba.org>

commit 93535da2961f6c76a95c2f5888df3e02877f928d
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Sep 13 13:08:58 2016 +1000

    ctdb-daemon: Remove NUM_DB_PRIORITIES
    
    It's not used anymore.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 67351e61ee632ab16cda0167ce9a08b72488b5dc
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Sep 13 15:45:54 2016 +1000

    ctdb-recoverd: Drop code to freeze databases from set_recovery_mode()
    
    This function is called only once from force_election() and does not
    require freezing of databases.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit b9f120dfa161b4156567e441cc7b167c1bfc8fb7
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jun 28 14:35:43 2016 +1000

    s3-ctdb: Use correct db_id size in marshalling record buffer
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 682676a89f3425efc7449fa6ec55ab8bdf534645
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jun 28 14:35:11 2016 +1000

    ctdb-common: Use correct db_id size in marshalling record buffer
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit bdff6255af113827340adc3da609e127503d9ba5
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Sep 13 16:05:14 2016 +1000

    ctdb-protocol: Fix marshalling for GET_DB_SEQNUM control request
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12259
    
    Even though database id is 32-bit, it's sent on wire as 64-bits.
    The database id is the first 32-bits on the wire.  This needs fixing
    eventually, but for now keep the same wire format.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 ctdb/common/common.h                         |  2 +-
 ctdb/common/ctdb_util.c                      |  2 +-
 ctdb/config/ctdb.service                     |  2 +-
 ctdb/include/ctdb_private.h                  |  1 -
 ctdb/protocol/protocol_control.c             | 14 ++----
 ctdb/server/ctdb_recoverd.c                  | 31 +-----------
 ctdb/server/ctdb_takeover.c                  |  6 +--
 ctdb/server/ipalloc.c                        | 48 ++++++++++++-------
 ctdb/server/ipalloc.h                        |  2 +-
 ctdb/server/ipalloc_private.h                |  1 +
 ctdb/tests/simple/19_ip_takeover_noop.sh     | 71 ++++++++++++++++++++++++++++
 ctdb/tests/simple/28_zero_eventscripts.sh    |  7 +--
 ctdb/tests/simple/scripts/local_daemons.bash | 10 ++++
 ctdb/tests/src/ctdb_takeover_tests.c         |  5 +-
 source3/lib/dbwrap/dbwrap_ctdb.c             |  2 +-
 15 files changed, 127 insertions(+), 77 deletions(-)
 create mode 100755 ctdb/tests/simple/19_ip_takeover_noop.sh


Changeset truncated at 500 lines:

diff --git a/ctdb/common/common.h b/ctdb/common/common.h
index 113816d..cca48c9 100644
--- a/ctdb/common/common.h
+++ b/ctdb/common/common.h
@@ -104,7 +104,7 @@ struct ctdb_rec_data_old *ctdb_marshall_record(TALLOC_CTX *mem_ctx,
 
 struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
 					       struct ctdb_marshall_buffer *m,
-					       uint64_t db_id,
+					       uint32_t db_id,
 					       uint32_t reqid,
 					       TDB_DATA key,
 					       struct ctdb_ltdb_header *header,
diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c
index 154878b..72358ca 100644
--- a/ctdb/common/ctdb_util.c
+++ b/ctdb/common/ctdb_util.c
@@ -273,7 +273,7 @@ struct ctdb_rec_data_old *ctdb_marshall_record(TALLOC_CTX *mem_ctx,
 /* helper function for marshalling multiple records */
 struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx,
 					       struct ctdb_marshall_buffer *m,
-					       uint64_t db_id,
+					       uint32_t db_id,
 					       uint32_t reqid,
 					       TDB_DATA key,
 					       struct ctdb_ltdb_header *header,
diff --git a/ctdb/config/ctdb.service b/ctdb/config/ctdb.service
index ea37c30..63cdfa9 100644
--- a/ctdb/config/ctdb.service
+++ b/ctdb/config/ctdb.service
@@ -1,6 +1,6 @@
 [Unit]
 Description=CTDB
-After=network.target
+After=network-online.target time-sync.target
 
 [Service]
 Type=forking
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 532ae0a..d63b194 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -251,7 +251,6 @@ struct ctdb_cluster_mutex_handle;
 
 enum ctdb_freeze_mode {CTDB_FREEZE_NONE, CTDB_FREEZE_PENDING, CTDB_FREEZE_FROZEN};
 
-#define NUM_DB_PRIORITIES 3
 /* main state of the ctdb daemon */
 struct ctdb_context {
 	struct tevent_context *ev;
diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c
index d5237ec..a909fc6 100644
--- a/ctdb/protocol/protocol_control.c
+++ b/ctdb/protocol/protocol_control.c
@@ -49,7 +49,6 @@ struct ctdb_reply_control_wire {
 static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
 {
 	size_t len = 0;
-	uint64_t u64;
 
 	if (cd == NULL) {
 		return 0;
@@ -335,8 +334,7 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
 		break;
 
 	case CTDB_CONTROL_GET_DB_SEQNUM:
-		u64 = cd->data.db_id;
-		len = ctdb_uint64_len(u64);
+		len = ctdb_uint64_len((uint64_t)cd->data.db_id);
 		break;
 
 	case CTDB_CONTROL_DB_SET_HEALTHY:
@@ -452,8 +450,6 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
 static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
 				       uint8_t *buf)
 {
-	uint64_t u64;
-
 	switch (cd->opcode) {
 	case CTDB_CONTROL_PROCESS_EXISTS:
 		ctdb_pid_push(cd->data.pid, buf);
@@ -635,8 +631,7 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
 		break;
 
 	case CTDB_CONTROL_GET_DB_SEQNUM:
-		u64 = cd->data.db_id;
-		ctdb_uint64_push(u64, buf);
+		ctdb_uint32_push(cd->data.db_id, buf);
 		break;
 
 	case CTDB_CONTROL_DB_SET_HEALTHY:
@@ -735,7 +730,6 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
 				      struct ctdb_req_control_data *cd)
 {
 	int ret = 0;
-	uint64_t u64 = 0;
 
 	cd->opcode = opcode;
 
@@ -964,8 +958,8 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
 		break;
 
 	case CTDB_CONTROL_GET_DB_SEQNUM:
-		ret = ctdb_uint64_pull(buf, buflen, mem_ctx, &u64);
-		cd->data.db_id = (uint32_t)u64;
+		ret = ctdb_uint32_pull(buf, buflen, mem_ctx,
+				       &cd->data.db_id);
 		break;
 
 	case CTDB_CONTROL_DB_SET_HEALTHY:
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index ba4d8a2..92ba35f 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -385,21 +385,13 @@ static int update_capabilities(struct ctdb_recoverd *rec,
 	return 0;
 }
 
-static void set_recmode_fail_callback(struct ctdb_context *ctdb, uint32_t node_pnn, int32_t res, TDB_DATA outdata, void *callback_data)
-{
-	struct ctdb_recoverd *rec = talloc_get_type(callback_data, struct ctdb_recoverd);
-
-	DEBUG(DEBUG_ERR,("Failed to freeze node %u during recovery. Set it as ban culprit for %d credits\n", node_pnn, rec->nodemap->num));
-	ctdb_set_culprit_count(rec, node_pnn, rec->nodemap->num);
-}
-
 /*
   change recovery mode on all nodes
  */
 static int set_recovery_mode(struct ctdb_context *ctdb,
 			     struct ctdb_recoverd *rec,
 			     struct ctdb_node_map_old *nodemap,
-			     uint32_t rec_mode, bool freeze)
+			     uint32_t rec_mode)
 {
 	TDB_DATA data;
 	uint32_t *nodes;
@@ -424,25 +416,6 @@ static int set_recovery_mode(struct ctdb_context *ctdb,
 		return -1;
 	}
 
-	/* freeze all nodes */
-	if (freeze && rec_mode == CTDB_RECOVERY_ACTIVE) {
-		int i;
-
-		for (i=1; i<=NUM_DB_PRIORITIES; i++) {
-			if (ctdb_client_async_control(ctdb, CTDB_CONTROL_FREEZE,
-						nodes, i,
-						CONTROL_TIMEOUT(),
-						false, tdb_null,
-						NULL,
-						set_recmode_fail_callback,
-						rec) != 0) {
-				DEBUG(DEBUG_ERR, (__location__ " Unable to freeze nodes. Recovery failed.\n"));
-				talloc_free(tmp_ctx);
-				return -1;
-			}
-		}
-	}
-
 	talloc_free(tmp_ctx);
 	return 0;
 }
@@ -1901,7 +1874,7 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn,
 	DEBUG(DEBUG_INFO,(__location__ " Force an election\n"));
 
 	/* set all nodes to recovery mode to stop all internode traffic */
-	ret = set_recovery_mode(ctdb, rec, nodemap, CTDB_RECOVERY_ACTIVE, false);
+	ret = set_recovery_mode(ctdb, rec, nodemap, CTDB_RECOVERY_ACTIVE);
 	if (ret != 0) {
 		DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to active on cluster\n"));
 		return;
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index 02e5c3d..f71c5fb 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -1604,11 +1604,7 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodem
 		return -1;
 	}
 
-	if (! ipalloc_set_public_ips(ipalloc_state, known_ips, available_ips)) {
-		DEBUG(DEBUG_ERR, ("Failed to set public IPs\n"));
-		talloc_free(tmp_ctx);
-		return -1;
-	}
+	ipalloc_set_public_ips(ipalloc_state, known_ips, available_ips);
 
 	if (! ipalloc_can_host_ips(ipalloc_state)) {
 		DEBUG(DEBUG_WARNING,("No nodes available to host public IPs yet\n"));
diff --git a/ctdb/server/ipalloc.c b/ctdb/server/ipalloc.c
index dd88f81..37804ea 100644
--- a/ctdb/server/ipalloc.c
+++ b/ctdb/server/ipalloc.c
@@ -106,8 +106,7 @@ static int getips_count_callback(void *param, void *data)
  * merged list of all public addresses needs to be built so that IP
  * allocation can be done. */
 static struct public_ip_list *
-create_merged_ip_list(struct ipalloc_state *ipalloc_state,
-		      struct ctdb_public_ip_list *known_ips)
+create_merged_ip_list(struct ipalloc_state *ipalloc_state)
 {
 	int i, j;
 	struct public_ip_list *ip_list;
@@ -116,14 +115,14 @@ create_merged_ip_list(struct ipalloc_state *ipalloc_state,
 
 	ip_tree = trbt_create(ipalloc_state, 0);
 
-	if (known_ips == NULL) {
+	if (ipalloc_state->known_public_ips == NULL) {
 		DEBUG(DEBUG_ERR, ("Known public IPs not set\n"));
 		return NULL;
 	}
 
 	for (i=0; i < ipalloc_state->num; i++) {
 
-		public_ips = &known_ips[i];
+		public_ips = &ipalloc_state->known_public_ips[i];
 
 		for (j=0; j < public_ips->num; j++) {
 			struct public_ip_list *tmp_ip;
@@ -225,16 +224,12 @@ void ipalloc_set_node_flags(struct ipalloc_state *ipalloc_state,
 	}
 }
 
-bool ipalloc_set_public_ips(struct ipalloc_state *ipalloc_state,
+void ipalloc_set_public_ips(struct ipalloc_state *ipalloc_state,
 			    struct ctdb_public_ip_list *known_ips,
 			    struct ctdb_public_ip_list *available_ips)
 {
 	ipalloc_state->available_public_ips = available_ips;
-
-	ipalloc_state->all_ips = create_merged_ip_list(ipalloc_state,
-						       known_ips);
-
-	return (ipalloc_state->all_ips != NULL);
+	ipalloc_state->known_public_ips = known_ips;
 }
 
 /* This can only return false if there are no available IPs *and*
@@ -244,17 +239,31 @@ bool ipalloc_set_public_ips(struct ipalloc_state *ipalloc_state,
 bool ipalloc_can_host_ips(struct ipalloc_state *ipalloc_state)
 {
 	int i;
-	struct public_ip_list *ip_list;
+	bool have_ips = false;
 
-
-	for (ip_list = ipalloc_state->all_ips;
-	     ip_list != NULL;
-	     ip_list = ip_list->next) {
-		if (ip_list->pnn != -1) {
-			return true;
+	for (i=0; i < ipalloc_state->num; i++) {
+		struct ctdb_public_ip_list *ips =
+			ipalloc_state->known_public_ips;
+		if (ips[i].num != 0) {
+			int j;
+			have_ips = true;
+			/* Succeed if an address is hosted on node i */
+			for (j=0; j < ips[i].num; j++) {
+				if (ips[i].ip[j].pnn == i) {
+					return true;
+				}
+			}
 		}
 	}
 
+	if (! have_ips) {
+		return false;
+	}
+
+	/* At this point there are known addresses but none are
+	 * hosted.  Need to check if cluster can now host some
+	 * addresses.
+	 */
 	for (i=0; i < ipalloc_state->num; i++) {
 		if (ipalloc_state->available_public_ips[i].num != 0) {
 			return true;
@@ -269,6 +278,11 @@ struct public_ip_list *ipalloc(struct ipalloc_state *ipalloc_state)
 {
 	bool ret = false;
 
+	ipalloc_state->all_ips = create_merged_ip_list(ipalloc_state);
+	if (ipalloc_state->all_ips == NULL) {
+		return NULL;
+	}
+
 	switch (ipalloc_state->algorithm) {
 	case IPALLOC_LCP2:
 		ret = ipalloc_lcp2(ipalloc_state);
diff --git a/ctdb/server/ipalloc.h b/ctdb/server/ipalloc.h
index 66a5e75..d116426 100644
--- a/ctdb/server/ipalloc.h
+++ b/ctdb/server/ipalloc.h
@@ -56,7 +56,7 @@ void ipalloc_set_node_flags(struct ipalloc_state *ipalloc_state,
 			    uint32_t *tval_noiptakeover,
 			    uint32_t *tval_noiphostonalldisabled);
 
-bool ipalloc_set_public_ips(struct ipalloc_state *ipalloc_state,
+void ipalloc_set_public_ips(struct ipalloc_state *ipalloc_state,
 			    struct ctdb_public_ip_list *known_ips,
 			    struct ctdb_public_ip_list *available_ips);
 
diff --git a/ctdb/server/ipalloc_private.h b/ctdb/server/ipalloc_private.h
index 2328687..485f627 100644
--- a/ctdb/server/ipalloc_private.h
+++ b/ctdb/server/ipalloc_private.h
@@ -31,6 +31,7 @@ struct ipalloc_state {
 
 	/* Arrays with data for each node */
 	struct ctdb_public_ip_list *available_public_ips;
+	struct ctdb_public_ip_list *known_public_ips;
 	bool *noiptakeover;
 	bool *noiphost;
 
diff --git a/ctdb/tests/simple/19_ip_takeover_noop.sh b/ctdb/tests/simple/19_ip_takeover_noop.sh
new file mode 100755
index 0000000..4cfedb0
--- /dev/null
+++ b/ctdb/tests/simple/19_ip_takeover_noop.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+test_info()
+{
+    cat <<EOF
+Check that CTDB operates correctly if:
+
+* DisableIPFailover is set; or
+* there are 0 public IPs configured
+
+This test only does anything with local daemons.  On a real cluster it
+has no way of updating configuration.
+EOF
+}
+
+. "${TEST_SCRIPTS_DIR}/integration.bash"
+
+ctdb_test_init "$@"
+
+set -e
+
+cluster_is_healthy
+
+if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
+	echo "SKIPPING this test - only runs against local daemons"
+	exit 0
+fi
+
+# Reset configuration
+ctdb_restart_when_done
+
+select_test_node_and_ips
+
+echo "Setting DisableIPFailover=1 on all nodes"
+try_command_on_node all $CTDB setvar DisableIPFailover 1
+
+echo "Getting \"before\" IP allocation..."
+try_command_on_node -v any $CTDB ip all
+before="$out"
+
+echo "Disabling node ${test_node}..."
+try_command_on_node "$test_node" $CTDB disable
+wait_until_node_has_status $test_node disabled
+
+echo "Getting \"after\" IP allocation..."
+try_command_on_node -v any $CTDB ip all
+after="$out"
+
+if [ "$before" == "$after" ] ; then
+	echo "GOOD: IP allocation is unchanged"
+	echo
+else
+	die "BAD: IP allocation changed"
+fi
+
+echo "----------------------------------------"
+
+daemons_stop
+
+echo "Starting CTDB with an empty public addresses configuration..."
+CTDB_PUBLIC_ADDRESSES="/dev/null" daemons_start
+
+wait_until_ready
+
+echo "Trying explicit ipreallocate..."
+try_command_on_node any $CTDB ipreallocate
+
+echo "Good, that seems to work!"
+echo
+
+ps_ctdbd
diff --git a/ctdb/tests/simple/28_zero_eventscripts.sh b/ctdb/tests/simple/28_zero_eventscripts.sh
index 7c03ae4..fc31c4a 100755
--- a/ctdb/tests/simple/28_zero_eventscripts.sh
+++ b/ctdb/tests/simple/28_zero_eventscripts.sh
@@ -35,11 +35,6 @@ CTDB_EVENT_SCRIPT_DIR="$empty_dir" daemons_start
 
 wait_until_ready
 
-# If this fails to find processes then the tests fails, so look at
-# full command-line so this will work with valgrind.  Note that the
-# output could be generated with pgrep's -a option but it doesn't
-# exist in older versions.
-ps -p $(pgrep -f '\<ctdbd\>' | xargs | sed -e 's| |,|g') -o args ww
+ps_ctdbd
 
-echo
 echo "Good, that seems to work!"
diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash
index fb1e7e1..2d6ec56 100644
--- a/ctdb/tests/simple/scripts/local_daemons.bash
+++ b/ctdb/tests/simple/scripts/local_daemons.bash
@@ -173,3 +173,13 @@ _restart_ctdb_all ()
     daemons_stop
     daemons_start
 }
+
+ps_ctdbd ()
+{
+	# If this fails to find processes then the tests fails, so
+	# look at full command-line so this will work with valgrind.
+	# Note that the output could be generated with pgrep's -a
+	# option but it doesn't exist in older versions.
+	ps -p $(pgrep -f '\<ctdbd\>' | xargs | sed -e 's| |,|g') -o args ww
+	echo
+}
diff --git a/ctdb/tests/src/ctdb_takeover_tests.c b/ctdb/tests/src/ctdb_takeover_tests.c
index a8f7841..bbeb241 100644
--- a/ctdb/tests/src/ctdb_takeover_tests.c
+++ b/ctdb/tests/src/ctdb_takeover_tests.c
@@ -300,10 +300,7 @@ static void ctdb_test_init(TALLOC_CTX *mem_ctx,
 				 read_ips_for_multiple_nodes,
 				 &known, &avail);
 
-	if (! ipalloc_set_public_ips(*ipalloc_state, known, avail)) {
-		DEBUG(DEBUG_ERR, ("Failed to set public IPs\n"));
-		exit(1);
-	}
+	ipalloc_set_public_ips(*ipalloc_state, known, avail);
 
 	tval_noiptakeover = get_tunable_values(mem_ctx, nodemap->num,
 					       "CTDB_SET_NoIPTakeover");
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 34aad45..88db204 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -174,7 +174,7 @@ static struct ctdb_rec_data_old *db_ctdb_marshall_record(TALLOC_CTX *mem_ctx, ui
 /* helper function for marshalling multiple records */
 static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx,
 					       struct ctdb_marshall_buffer *m,
-					       uint64_t db_id,
+					       uint32_t db_id,
 					       uint32_t reqid,
 					       TDB_DATA key,
 					       struct ctdb_ltdb_header *header,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list