[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Fri Dec 16 11:33:05 UTC 2016


The branch, master has been updated
       via  cd20ced ctdb-tools: Don't trust non-hosting nodes in "ctdb ip all"
       via  2514a9c ctdb-tools: Print PNN as int in "ctdb ip -v"
       via  a6e5b6a ctdb-tools: Skip GET_PUBLIC_IP_INFO for unassigned addresses
       via  acaa440 ctdb-tools: Fix memory corruption in "ctdb ip -v"
       via  7bcef2f ctdb-tools: Fix sort order of "ctdb ip" output
       via  3845ff6 ctdb-tests: Add unit test for protocol utilities
       via  362f066 ctdb-protocol: Add generalised socket address comparison
       via  25aad0d ctdb-tests: Fix "ctdb reloadips" simple test
       via  15d5ed7 ctdb-build: Remove unnecessary intermediate build target
       via  0869501 ctdb-tests: Do not remove event script dir before shutting down ctdb
       via  ec00b49 ctdb-tests: Display filtered output when the test fails
       via  e97d467 ctdb-daemon: Move function typedef to where it's used
       via  2eaabee ctdb-scripts: Drop ctdb_check_service_reconfigure
       via  d6f760f ctdb-scripts: Add explicit check for service reconfiguration
       via  dd748ae ctdb-scripts: Drop some tests for "reconfigure" event and monitor replay
      from  7585aa6 testsuite: Add cmocka unit test for smb_krb5_kt_open()

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


- Log -----------------------------------------------------------------
commit cd20ced3fb9c71d38450f90224677f21a27d2548
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Dec 13 11:16:05 2016 +1100

    ctdb-tools: Don't trust non-hosting nodes in "ctdb ip all"
    
    Redundant RELEASE_IPs gives nodes a preview of where an IP address
    will move to.  However, if the associated TAKEOVER_IP fails then the
    node will actually be unhosted.
    
    This is similar to commit 77a29b37334b9df62b755b6f538fb975e105e1ff.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Fri Dec 16 12:32:02 CET 2016 on sn-devel-144

commit 2514a9cd17fa9435792308aefdbebcc0a60a68f3
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 8 11:37:06 2016 +1100

    ctdb-tools: Print PNN as int in "ctdb ip -v"
    
    Otherwise it prints 4294967295 for the PNN.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a6e5b6abe969e12cf26acf320f2c4bf40b377982
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 8 11:35:23 2016 +1100

    ctdb-tools: Skip GET_PUBLIC_IP_INFO for unassigned addresses
    
    The GET_PUBLIC_IP_INFO control fails for unassigned addresses because
    PNN is CTDB_UNKNOWN_PNN.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit acaa4407ca3be9fb5637790079656f1eabf3848c
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 8 11:29:13 2016 +1100

    ctdb-tools: Fix memory corruption in "ctdb ip -v"
    
    First argument to talloc_asprintf_append() is the string being
    appended to, not a talloc context.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 7bcef2f0e2969551134e0d72f0956685eeec10a3
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Dec 7 09:23:02 2016 +1100

    ctdb-tools: Fix sort order of "ctdb ip" output
    
    The new hash-table-based method of merging the IP information does not
    sort, whereas the RB-tree method implicitly sorted.  This probably
    only really matters for the "all" case, but sort regardless to ensure
    consistent output format.
    
    Sorting has to be done here instead of when printing to ensure
    consistency between ip[] and ipinfo[].
    
    No longer reverse the sort order.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 3845ff6349421560bdcf9ba13467b2418205cd96
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon May 23 11:53:26 2016 +1000

    ctdb-tests: Add unit test for protocol utilities
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 362f066d617c8a186164db613537867329702ab7
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon May 23 10:35:10 2016 +1000

    ctdb-protocol: Add generalised socket address comparison
    
    Add new function ctdb_sock_addr_cmp(), which returns a 3-way result
    useful for qsort(3).  Reimplent ctdb_sock_addr_same() using this.
    
    In the process, make arguments const so that ctdb_sock_addr_cmp() can
    be used with qsort().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 25aad0df06038d0b595f09d947b9977dcc0ec8a8
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 15 10:17:25 2016 +1100

    ctdb-tests: Fix "ctdb reloadips" simple test
    
    The name of the addresses file to modify is based on the original
    selection of a test node at the top of the test.  Repeating the
    selection a test node can result in a mismatch between the new test
    node and the addresses file.  This occurs on local daemons, because
    the addresses file name has the original node number in it but the
    test is being performed on the the newly selected node number.
    
    For some reason this test has only occasionally failed.  An upcoming
    commit that stops the output of "ctdb ip" from being reversed causes
    this test to fail (nearly?) every time.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 15d5ed7bb7a6bcb090ea1a13e8602e664a2f25f7
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Aug 30 17:27:47 2016 +1000

    ctdb-build: Remove unnecessary intermediate build target
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 0869501577699e62960478db1761d7cd8c666e7f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Dec 9 14:38:38 2016 +1100

    ctdb-tests: Do not remove event script dir before shutting down ctdb
    
    When the test is over, the exit_hook will remove the temporary event
    script directory and then CTDB is restarted.  Explicitly shutting down
    CTDB ensures that event script directory is not removed while CTDB is
    still running.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit ec00b49029db80dd091b2bf2f35a6ed28144206a
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Nov 23 11:46:18 2016 +1100

    ctdb-tests: Display filtered output when the test fails
    
    This simplifies comparing the output to the expected output.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit e97d467642a490d86540732ed126e569905c69de
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Sep 13 12:50:13 2016 +1000

    ctdb-daemon: Move function typedef to where it's used
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 2eaabee7ac0bc5526129b506ec957d2da303deb2
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Dec 14 15:09:24 2016 +1100

    ctdb-scripts: Drop ctdb_check_service_reconfigure
    
    This gets rid of implicit check if a service needs to configured.  As a
    side effect, we also get rid of the monitor "replay" which was
    introduced to avoid a collision between a script executed via event and
    manually.  Event scripts are not expected to be run by hand.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit d6f760f78a9ea3787875d6eb2b159e5cb0d9b41d
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Dec 14 15:06:45 2016 +1100

    ctdb-scripts: Add explicit check for service reconfiguration
    
    This will help get rid of implicit ctdb_service_check_reconfigure.
    
    We still need to keep "reconfigure" event in 13.per_ip_routing, so that
    the per ip routing can be refreshed if the configuration has changed.
    The correct fix for this is to add caching of configuration and checking
    of configuration changes in "ipreallocated" event.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit dd748ae724aed1d12aea8d373e5c66b532e1e230
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 15 15:25:14 2016 +1100

    ctdb-scripts: Drop some tests for "reconfigure" event and monitor replay
    
    These features are going away.  There is nothing to reconfigure for
    NFS anyway.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 ctdb/common/common.h                               |   3 +
 ctdb/config/events.d/13.per_ip_routing             |   6 +-
 ctdb/config/events.d/40.vsftpd                     |   8 +-
 ctdb/config/events.d/60.nfs                        |   8 +-
 ctdb/config/functions                              | 133 ---------------------
 ctdb/include/ctdb_private.h                        |   6 -
 ctdb/protocol/protocol_api.h                       |  10 +-
 ctdb/protocol/protocol_util.c                      |  68 +++++++----
 .../{db_hash_test_001.sh => protocol_test_003.sh}  |   3 +-
 ctdb/tests/eventscripts/60.nfs.multi.003.sh        |  26 ----
 ctdb/tests/eventscripts/60.nfs.multi.004.sh        |  26 ----
 ctdb/tests/eventscripts/60.nfs.multi.005.sh        |  26 ----
 ctdb/tests/eventscripts/60.nfs.multi.006.sh        |  19 ---
 ctdb/tests/scripts/unit.sh                         |   2 +-
 ctdb/tests/simple/18_ctdb_reloadips.sh             |   2 -
 ctdb/tests/simple/28_zero_eventscripts.sh          |   2 +
 ctdb/tests/src/protocol_util_test.c                |  82 +++++++++++++
 ctdb/tools/ctdb.c                                  |  66 ++++++++--
 ctdb/wscript                                       |  22 ++--
 19 files changed, 227 insertions(+), 291 deletions(-)
 copy ctdb/tests/cunit/{db_hash_test_001.sh => protocol_test_003.sh} (64%)
 delete mode 100755 ctdb/tests/eventscripts/60.nfs.multi.003.sh
 delete mode 100755 ctdb/tests/eventscripts/60.nfs.multi.004.sh
 delete mode 100755 ctdb/tests/eventscripts/60.nfs.multi.005.sh
 delete mode 100755 ctdb/tests/eventscripts/60.nfs.multi.006.sh
 create mode 100644 ctdb/tests/src/protocol_util_test.c


Changeset truncated at 500 lines:

diff --git a/ctdb/common/common.h b/ctdb/common/common.h
index cca48c9..48e5767 100644
--- a/ctdb/common/common.h
+++ b/ctdb/common/common.h
@@ -22,6 +22,9 @@
 
 /* From common/ctdb_io.c */
 
+typedef void (*ctdb_queue_cb_fn_t)(uint8_t *data, size_t length,
+				   void *private_data);
+
 int ctdb_queue_length(struct ctdb_queue *queue);
 
 int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length);
diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing
index f0e4609..c4b2535 100755
--- a/ctdb/config/events.d/13.per_ip_routing
+++ b/ctdb/config/events.d/13.per_ip_routing
@@ -367,8 +367,6 @@ service_reconfigure ()
 
 ctdb_check_args "$@"
 
-ctdb_service_check_reconfigure
-
 case "$1" in
 startup)
 	flush_rules_and_routes
@@ -435,6 +433,10 @@ ipreallocated)
 	add_missing_routes
 	remove_bogus_routes
 	;;
+
+reconfigure)
+	ctdb_service_reconfigure
+	;;
 esac
 
 exit 0
diff --git a/ctdb/config/events.d/40.vsftpd b/ctdb/config/events.d/40.vsftpd
index 2b8cdde..703edaf 100755
--- a/ctdb/config/events.d/40.vsftpd
+++ b/ctdb/config/events.d/40.vsftpd
@@ -29,8 +29,6 @@ ctdb_start_stop_service
 
 is_ctdb_managed_service || exit 0
 
-ctdb_service_check_reconfigure
-
 case "$1" in
 startup)
 	ctdb_service_start
@@ -44,6 +42,12 @@ takeip|releaseip)
 	ctdb_service_set_reconfigure
 	;;
 
+ipreallocated)
+	if ctdb_service_needs_reconfigure ; then
+		ctdb_service_reconfigure
+	fi
+	;;
+
 monitor)
 	if ctdb_check_tcp_ports 21 ; then
 		ctdb_counter_init
diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events.d/60.nfs
index 15948f5..02d6e2b 100755
--- a/ctdb/config/events.d/60.nfs
+++ b/ctdb/config/events.d/60.nfs
@@ -254,8 +254,6 @@ ctdb_start_stop_service
 
 is_ctdb_managed_service || exit 0
 
-ctdb_service_check_reconfigure
-
 case "$1" in
 startup)
 	nfs_callout "$@"
@@ -275,6 +273,12 @@ releaseip)
 	ctdb_service_set_reconfigure
 	;;
 
+ipreallocated)
+	if ctdb_service_needs_reconfigure ; then
+		ctdb_service_reconfigure
+	fi
+	;;
+
 monitor)
 	nfs_callout "monitor-pre" || exit $?
 
diff --git a/ctdb/config/functions b/ctdb/config/functions
index 727bd86..7e37bbb 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -853,139 +853,6 @@ service_reconfigure ()
     :
 }
 
-ctdb_reconfigure_take_lock ()
-{
-	_ctdb_service_reconfigure_common
-	_lock="${_d}/reconfigure_lock"
-	mkdir -p "${_lock%/*}" # dirname
-	touch "$_lock"
-
-	(
-		flock 9
-		# This is overkill but will work if we need to extend
-		# this to allow certain events to run multiple times
-		# in parallel (e.g. takeip) and write multiple PIDs to
-		# the file.
-		{
-			read _locker_event
-			if [ -n "$_locker_event" ] ; then
-				while read _pid ; do
-					if [ -n "$_pid" -a "$_pid" != $$ ] && \
-					   kill -0 "$_pid" 2>/dev/null ; then
-						exit 1
-					fi
-				done
-			fi
-		} <"$_lock"
-
-		printf "%s\n%s\n" "$event_name" $$ >"$_lock"
-		exit 0
-    ) 9>"${_lock}.flock"
-}
-
-ctdb_reconfigure_release_lock ()
-{
-    _ctdb_service_reconfigure_common
-    _lock="${_d}/reconfigure_lock"
-
-    rm -f "$_lock"
-}
-
-ctdb_replay_monitor_status ()
-{
-    echo "Replaying previous status for this script due to reconfigure..."
-    # Leading separator ('|') is missing in some versions...
-    _out=$($CTDB scriptstatus -X | grep -E "^\|?monitor\|${script_name}\|")
-    # Output looks like this:
-    # |monitor|60.nfs|1|ERROR|1314764004.030861|1314764004.035514|foo bar|
-    # This is the cheapest way of getting fields in the middle.
-    # Intentional word splitting here
-    # shellcheck disable=SC2046,2086
-    set -- $(IFS="|" ; echo $_out)
-    _code="$3"
-    _status="$4"
-    # The error output field can include colons so we'll try to
-    # preserve them.  The weak checking at the beginning tries to make
-    # this work for both broken (no leading '|') and fixed output.
-    _out="${_out%|}"
-    _err_out="${_out#*monitor|${script_name}|*|*|*|*|}"
-    case "$_status" in
-	OK) : ;;  # Do nothing special.
-	TIMEDOUT)
-	    # Recast this as an error, since we can't exit with the
-	    # correct negative number.
-	    _code=1
-	    _err_out="[Replay of TIMEDOUT scriptstatus - note incorrect return code.] ${_err_out}"
-	    ;;
-	DISABLED)
-	    # Recast this as an OK, since we can't exit with the
-	    # correct negative number.
-	    _code=0
-	    _err_out="[Replay of DISABLED scriptstatus - note incorrect return code.] ${_err_out}"
-	    ;;
-	*) : ;;  # Must be ERROR, do nothing special.
-    esac
-    if [ -n "$_err_out" ] ; then
-	echo "$_err_out"
-    fi
-    exit $_code
-}
-
-ctdb_service_check_reconfigure ()
-{
-    assert_service_name
-
-    # We only care about some events in this function.  For others we
-    # return now.
-    case "$event_name" in
-	monitor|ipreallocated|reconfigure) : ;;
-	*) return 0 ;;
-    esac
-
-    if ctdb_reconfigure_take_lock ; then
-	# No events covered by this function are running, so proceed
-	# with gay abandon.
-	case "$event_name" in
-	    reconfigure)
-		(ctdb_service_reconfigure)
-		exit $?
-		;;
-	    ipreallocated)
-		if ctdb_service_needs_reconfigure ; then
-		    ctdb_service_reconfigure
-		fi
-		;;
-	esac
-
-	ctdb_reconfigure_release_lock
-    else
-	# Somebody else is running an event we don't want to collide
-	# with.  We proceed with caution.
-	case "$event_name" in
-	    reconfigure)
-		# Tell whoever called us to retry.
-		exit 2
-		;;
-	    ipreallocated)
-		# Defer any scheduled reconfigure and just run the
-		# rest of the ipreallocated event, as per the
-		# eventscript.  There's an assumption here that the
-		# event doesn't depend on any scheduled reconfigure.
-		# This is true in the current code.
-		return 0
-		;;
-	    monitor)
-		# There is most likely a reconfigure in progress so
-		# the service is possibly unstable.  As above, we
-		# defer any scheduled reconfigured.  We also replay
-		# the previous monitor status since that's the best
-		# information we have.
-		ctdb_replay_monitor_status
-		;;
-	esac
-    fi
-}
-
 ##################################################################
 # Does CTDB manage this service? - and associated auto-start/stop
 
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index e3085d0..6373589 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -45,12 +45,6 @@ struct ctdb_registered_call {
  */
 #define ctdb_validate_pnn(ctdb, pnn) (((uint32_t)(pnn)) < (ctdb)->num_nodes)
 
-
-/* called from the queue code when a packet comes in. Called with data==NULL
-   on error */
-typedef void (*ctdb_queue_cb_fn_t)(uint8_t *data, size_t length,
-				   void *private_data);
-
 /* used for callbacks in ctdb_control requests */
 typedef void (*ctdb_control_callback_fn_t)(struct ctdb_context *,
 					   int32_t status, TDB_DATA data, 
diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h
index e438e1d..e967dea 100644
--- a/ctdb/protocol/protocol_api.h
+++ b/ctdb/protocol/protocol_api.h
@@ -658,7 +658,13 @@ const char *ctdb_event_to_string(enum ctdb_event event);
 enum ctdb_event ctdb_event_from_string(const char *event_str);
 
 const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr);
-bool ctdb_sock_addr_same_ip(ctdb_sock_addr *addr1, ctdb_sock_addr *addr2);
-bool ctdb_sock_addr_same(ctdb_sock_addr *addr1, ctdb_sock_addr *addr2);
+int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr *addr1,
+			  const ctdb_sock_addr *addr2);
+int ctdb_sock_addr_cmp(const ctdb_sock_addr *addr1,
+		       const ctdb_sock_addr *addr2);
+bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1,
+			    const ctdb_sock_addr *addr2);
+bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
+			 const ctdb_sock_addr *addr2);
 
 #endif /* __CTDB_PROTOCOL_API_H__ */
diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c
index b91c652..0e1bf28 100644
--- a/ctdb/protocol/protocol_util.c
+++ b/ctdb/protocol/protocol_util.c
@@ -141,55 +141,81 @@ const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr)
 	return cip;
 }
 
-bool ctdb_sock_addr_same_ip(ctdb_sock_addr *addr1, ctdb_sock_addr *addr2)
+int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr *addr1,
+			  const ctdb_sock_addr *addr2)
 {
-	if (addr1->sa.sa_family != addr2->sa.sa_family) {
-		return false;
+	int ret = 0;
+
+	/* This is somewhat arbitrary.  However, when used for sorting
+	 * it just needs to be consistent.
+	 */
+	if (addr1->sa.sa_family < addr2->sa.sa_family) {
+		return -1;
+	}
+	if (addr1->sa.sa_family > addr2->sa.sa_family) {
+		return 1;
 	}
 
 	switch (addr1->sa.sa_family) {
 	case AF_INET:
-		if (addr1->ip.sin_addr.s_addr != addr2->ip.sin_addr.s_addr) {
-			return false;
-		}
+		ret = memcmp(&addr1->ip.sin_addr.s_addr,
+			     &addr2->ip.sin_addr.s_addr, 4);
 		break;
 
 	case AF_INET6:
-		if (memcmp(addr1->ip6.sin6_addr.s6_addr,
-			   addr2->ip6.sin6_addr.s6_addr, 16) != 0) {
-			return false;
-		}
+		ret = memcmp(addr1->ip6.sin6_addr.s6_addr,
+			     addr2->ip6.sin6_addr.s6_addr, 16);
 		break;
 
 	default:
-		return false;
+		ret = -1;
 	}
 
-	return true;
+	return ret;
 }
 
-bool ctdb_sock_addr_same(ctdb_sock_addr *addr1, ctdb_sock_addr *addr2)
+int ctdb_sock_addr_cmp(const ctdb_sock_addr *addr1,
+		       const ctdb_sock_addr *addr2)
 {
-	if (! ctdb_sock_addr_same_ip(addr1, addr2)) {
-		return false;
+	int ret = 0;
+
+	ret = ctdb_sock_addr_cmp_ip(addr1, addr2);
+	if (ret != 0) {
+		return ret;
 	}
 
 	switch (addr1->sa.sa_family) {
 	case AF_INET:
-		if (addr1->ip.sin_port != addr2->ip.sin_port) {
-			return false;
+		if (addr1->ip.sin_port < addr2->ip.sin_port) {
+			ret = -1;
+		} else if (addr1->ip.sin_port > addr2->ip.sin_port) {
+			ret = 1;
 		}
 		break;
 
 	case AF_INET6:
-		if (addr1->ip6.sin6_port != addr2->ip6.sin6_port) {
-			return false;
+		if (addr1->ip6.sin6_port < addr2->ip6.sin6_port) {
+			ret = -1;
+		} else if (addr1->ip6.sin6_port > addr2->ip6.sin6_port) {
+			ret = 1;
 		}
 		break;
 
 	default:
-		return false;
+		ret = -1;
 	}
 
-	return true;
+	return ret;
+}
+
+bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1,
+			    const ctdb_sock_addr *addr2)
+{
+	return (ctdb_sock_addr_cmp_ip(addr1, addr2) == 0);
+}
+
+bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
+			 const ctdb_sock_addr *addr2)
+{
+	return (ctdb_sock_addr_cmp(addr1, addr2) == 0);
 }
diff --git a/ctdb/tests/cunit/db_hash_test_001.sh b/ctdb/tests/cunit/protocol_test_003.sh
similarity index 64%
copy from ctdb/tests/cunit/db_hash_test_001.sh
copy to ctdb/tests/cunit/protocol_test_003.sh
index 76c38fe..012db90 100755
--- a/ctdb/tests/cunit/db_hash_test_001.sh
+++ b/ctdb/tests/cunit/protocol_test_003.sh
@@ -3,5 +3,4 @@
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
 ok_null
-
-unit_test db_hash_test
+unit_test protocol_util_test
diff --git a/ctdb/tests/eventscripts/60.nfs.multi.003.sh b/ctdb/tests/eventscripts/60.nfs.multi.003.sh
deleted file mode 100755
index aed1f34..0000000
--- a/ctdb/tests/eventscripts/60.nfs.multi.003.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "takeip, take reconfigure lock, monitor -> replay error"
-
-setup_nfs
-
-public_address=$(ctdb_get_1_public_address)
-
-err="foo: bar error occurred"
-
-ok_null
-
-simple_test_event "takeip" $public_address
-
-ctdb_fake_scriptstatus 1 "ERROR" "$err"
-
-eventscript_call ctdb_reconfigure_take_lock
-
-required_result 1 <<EOF
-Replaying previous status for this script due to reconfigure...
-$err
-EOF
-
-simple_test_event "monitor"
diff --git a/ctdb/tests/eventscripts/60.nfs.multi.004.sh b/ctdb/tests/eventscripts/60.nfs.multi.004.sh
deleted file mode 100755
index d01f96b..0000000
--- a/ctdb/tests/eventscripts/60.nfs.multi.004.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "takeip, take reconfigure lock, monitor -> reconfigure, replay timed out"
-
-setup_nfs
-
-public_address=$(ctdb_get_1_public_address)
-
-err="waiting, waiting..."
-
-ok_null
-
-simple_test_event "takeip" $public_address
-
-ctdb_fake_scriptstatus -62 "TIMEDOUT" "$err"
-
-eventscript_call ctdb_reconfigure_take_lock
-
-required_result 1 <<EOF
-Replaying previous status for this script due to reconfigure...
-[Replay of TIMEDOUT scriptstatus - note incorrect return code.] $err
-EOF
-
-simple_test_event "monitor"
diff --git a/ctdb/tests/eventscripts/60.nfs.multi.005.sh b/ctdb/tests/eventscripts/60.nfs.multi.005.sh
deleted file mode 100755
index da334fd..0000000
--- a/ctdb/tests/eventscripts/60.nfs.multi.005.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "takeip, take reconfigure lock, monitor -> reconfigure, replay disabled"
-
-setup_nfs
-
-public_address=$(ctdb_get_1_public_address)
-
-err=""
-
-ok_null
-
-simple_test_event "takeip" $public_address
-
-ctdb_fake_scriptstatus -8 "DISABLED" "$err"
-
-eventscript_call ctdb_reconfigure_take_lock
-
-ok <<EOF
-Replaying previous status for this script due to reconfigure...
-[Replay of DISABLED scriptstatus - note incorrect return code.] $err
-EOF
-
-simple_test_event "monitor"
diff --git a/ctdb/tests/eventscripts/60.nfs.multi.006.sh b/ctdb/tests/eventscripts/60.nfs.multi.006.sh
deleted file mode 100755
index 84bb9ef..0000000
--- a/ctdb/tests/eventscripts/60.nfs.multi.006.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "reconfigure (synthetic), twice"
-# This checks that the lock is released...


-- 
Samba Shared Repository



More information about the samba-cvs mailing list