[SCM] CTDB repository - branch 2.5 updated - ctdb-2.5.1-33-g59a0898

Amitay Isaacs amitay at samba.org
Thu Jan 30 22:11:19 MST 2014


The branch, 2.5 has been updated
       via  59a089827211a3158a94fdee4624cf8dafb305eb (commit)
       via  70f1d572c2d408e98999dd38887a1085ecedc939 (commit)
       via  a57c7d2e24b427134fa7c02e734a08d8daeb6751 (commit)
       via  e938b677d7bf162461d2151374a92a590664fa2e (commit)
       via  6fa553ba70a0f64cd90baf28ef194a70fea6f2b5 (commit)
       via  043bf3fe80a922eb1847322a711278b303f15a6d (commit)
       via  93885116c444d037cecf7112990325bcfdb78cdd (commit)
       via  073ec6fb7c943e51b87c77a767a786ac4aca6343 (commit)
       via  db649dee656d4e4764e2eaa9f2ee7695117cab42 (commit)
      from  eef67244544a1396e1408938a5ebaa2d745426e6 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=2.5


- Log -----------------------------------------------------------------
commit 59a089827211a3158a94fdee4624cf8dafb305eb
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jan 28 14:34:15 2014 +1100

    tests/eventscripts: Avoid errors on broken pipe
    
    ctdb_get_my_public_addresses() attempts to echo things and this causes
    an error if head has taken the first line and the pipe is closed.
    
    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 Jan 31 05:30:38 CET 2014 on sn-devel-104
    
    (Imported from commit b112a3317cbedc73a6e17b3f711fec84f0d41d4e)

commit 70f1d572c2d408e98999dd38887a1085ecedc939
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jan 28 16:07:53 2014 +1100

    tests/eventscripts: Improve ip command stub secondary handling
    
    It should support primary and secondaries per network instead of per
    interface.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 1640f36d5831b2575d117fac335f3324ceefa9f8)

commit a57c7d2e24b427134fa7c02e734a08d8daeb6751
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 22 16:02:46 2014 +1100

    daemon: reloadips must register state of asynchronous controls
    
    Otherwise ctdb_client_async_wait() is a no-op.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit e5778cc172eb9fab6382f1c600326f6cc99b9162)

commit e938b677d7bf162461d2151374a92a590664fa2e
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 27 23:43:53 2013 +0100

    tests: in the stub "ip link show" command use echo instead of cat
    
    This case of "ip link show" does not break autobuild with
    "Broken pipe" messages, but let's be consistent.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-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 Nov 28 09:23:03 CET 2013 on sn-devel-104
    
    (Imported from commit e2db9c524f40f8771ae19b2be47a56f7a9d887af)

commit 6fa553ba70a0f64cd90baf28ef194a70fea6f2b5
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 27 22:28:06 2013 +0100

    test: remove unused ip2ipmask from integration.bash
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit fd5e8905a09875d13ef109133edd361a82cf8e1e)

commit 043bf3fe80a922eb1847322a711278b303f15a6d
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 27 11:42:28 2013 +0100

    tests:76_ctdb_pdb_recovery: change from using ctdb pstore to ctdb ptrans.
    
    This removes the requirement to create a temporary file
    and hence makes this test runnable against local daemons
    and against a real cluster without further changes.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit e281cfa8db4a2506f9016718373cdc80f4aa9c1f)

commit 93885116c444d037cecf7112990325bcfdb78cdd
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 27 23:28:24 2013 +0100

    tests:76_ctdb_pdb_recovery: fix a typo in a message
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 30dead171f82b5da31cbcbab88eaa70a896d9c55)

commit 073ec6fb7c943e51b87c77a767a786ac4aca6343
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 27 11:40:53 2013 +0100

    tests:76_ctdb_pdb_recovery: fix a typo in a message
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 3e083f96ff02cbf419513e16a200e8d4d0c2c227)

commit db649dee656d4e4764e2eaa9f2ee7695117cab42
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 27 12:13:40 2013 +0100

    tests: in the stub ip command, avoid broken pipe by using echo instead of cat
    
    This fixes running "make autotest" from autobuild, since
    it prevents irritating error output in delete_ip_from_iface()
    when calling ip addr list ... | grep -Fq "inet ..." .
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 70f469e05e279e29980df2af10dd89c53001b236)

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

Summary of changes:
 server/ctdb_takeover.c               |    3 +
 tests/eventscripts/scripts/local.sh  |    6 +-
 tests/eventscripts/stubs/ip          |   93 ++++++++++++++++++++++------------
 tests/scripts/integration.bash       |    7 ---
 tests/simple/76_ctdb_pdb_recovery.sh |   10 ++--
 5 files changed, 71 insertions(+), 48 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index b918e5a..c21736e 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -4458,6 +4458,7 @@ static int ctdb_reloadips_child(struct ctdb_context *ctdb)
 				goto failed;
 			}
 
+			ctdb_client_async_add(async_data, state);
 		}
 	}
 
@@ -4534,6 +4535,8 @@ static int ctdb_reloadips_child(struct ctdb_context *ctdb)
 				       " failed sending CTDB_CONTROL_ADD_PUBLIC_IP\n"));
 				goto failed;
 			}
+
+			ctdb_client_async_add(async_data, state);
 		}
 	}
 
diff --git a/tests/eventscripts/scripts/local.sh b/tests/eventscripts/scripts/local.sh
index e6186a0..6099da3 100644
--- a/tests/eventscripts/scripts/local.sh
+++ b/tests/eventscripts/scripts/local.sh
@@ -401,7 +401,7 @@ ctdb_get_my_public_addresses ()
 # This is suitable for passing to takeip/releaseip
 ctdb_get_1_public_address ()
 {
-    ctdb_get_my_public_addresses | head -n 1
+    ctdb_get_my_public_addresses | { head -n 1 ; cat >/dev/null ; }
 }
 
 ctdb_not_implemented ()
@@ -450,7 +450,7 @@ create_policy_routing_config ()
     if [ "$_num_ips" = "all" ] ; then
 	cat
     else
-	head -n "$_num_ips"
+	{ head -n "$_num_ips" ; cat >/dev/null ; }
     fi |
     while read _dev _ip _bits ; do
 	_net=$(ipv4_host_addr_to_net "$_ip" "$_bits")
@@ -479,7 +479,7 @@ check_routes ()
     if [ "$_num_ips" = "all" ] ; then
 	cat
     else
-	head -n "$_num_ips"
+	{ head -n "$_num_ips" ; cat >/dev/null ; }
     fi | {
 	while read _dev _ip _bits ; do
 	    _net=$(ipv4_host_addr_to_net "$_ip" "$_bits")
diff --git a/tests/eventscripts/stubs/ip b/tests/eventscripts/stubs/ip
index 053da75..f076cb9 100755
--- a/tests/eventscripts/stubs/ip
+++ b/tests/eventscripts/stubs/ip
@@ -64,10 +64,8 @@ ip_link_show ()
 	_state="DOWN"
 	_flags=""
     fi
-    cat <<EOF
-${n}: ${dev}: <BROADCAST,MULTICAST${_flags}> mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000
-    link/ether ${mac} brd ff:ff:ff:ff:ff:ff
-EOF
+    echo "${n}: ${dev}: <BROADCAST,MULTICAST${_flags}> mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000"
+    echo "    link/ether ${mac} brd ff:ff:ff:ff:ff:ff"
 }
 
 # This is incomplete because it doesn't actually look up table ids in
@@ -145,7 +143,7 @@ ip_addr_show ()
     if [ -z "$devices" ] ; then
 	# No device specified?  Get all the primaries...
 	devices=$(ls "${FAKE_IP_STATE}/addresses/"*-primary 2>/dev/null | \
-	    sed -e 's at .*/@@' -e 's at -primary$@@')
+	    sed -e 's at .*/@@' -e 's at -.*-primary$@@' | sort -u)
     fi
     calc_brd ()
     {
@@ -159,33 +157,33 @@ ip_addr_show ()
     }
     show_iface()
     {
-	pf="${FAKE_IP_STATE}/addresses/${dev}-primary"
-	sf="${FAKE_IP_STATE}/addresses/${dev}-secondary"
 	ip_link_show "$dev"
-	if $primary && [ -r "$pf" ] ; then
-	    read local <"$pf"
-	    if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
-		calc_brd
-		cat <<EOF
-    inet ${local} brd ${brd} scope global ${dev}
-EOF
-	    fi
-	fi
-	if $secondary && [ -r "$sf" ] ; then
-	    while read local ; do
+
+	nets=$(ls "${FAKE_IP_STATE}/addresses/${dev}"-*-primary 2>/dev/null | \
+	    sed -e 's at .*/@@' -e "s@${dev}-\(.*\)-primary\$@\1@")
+
+	for net in $nets ; do
+	    pf="${FAKE_IP_STATE}/addresses/${dev}-${net}-primary"
+	    sf="${FAKE_IP_STATE}/addresses/${dev}-${net}-secondary"
+	    if $primary && [ -r "$pf" ] ; then
+		read local <"$pf"
 		if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
 		    calc_brd
-		    cat <<EOF
-    inet ${local} brd ${brd} scope global secondary ${dev}
-EOF
+		    echo "    inet ${local} brd ${brd} scope global ${dev}"
 		fi
-	    done <"$sf"
-	fi
-	if [ -z "$_to" ] ; then
-	    cat <<EOF
-       valid_lft forever preferred_lft forever
-EOF
-	fi
+	    fi
+	    if $secondary && [ -r "$sf" ] ; then
+		while read local ; do
+		    if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
+			calc_brd
+			echo "    inet ${local} brd ${brd} scope global secondary ${dev}"
+		    fi
+		done <"$sf"
+	    fi
+	    if [ -z "$_to" ] ; then
+		echo "       valid_lft forever preferred_lft forever"
+	    fi
+	done
     }
     n=1
     for dev in $devices ; do
@@ -197,6 +195,33 @@ EOF
     done
 }
 
+# Copied from 13.per_ip_routing for now... so this is lazy testing  :-(
+ipv4_host_addr_to_net ()
+{
+    _host="$1"
+    _maskbits="$2"
+
+    # Convert the host address to an unsigned long by splitting out
+    # the octets and doing the math.
+    _host_ul=0
+    for _o in $(export IFS="." ; echo $_host) ; do
+	_host_ul=$(( ($_host_ul << 8) + $_o)) # work around Emacs color bug
+    done
+
+    # Calculate the mask and apply it.
+    _mask_ul=$(( 0xffffffff << (32 - $_maskbits) ))
+    _net_ul=$(( $_host_ul & $_mask_ul ))
+
+    # Now convert to a network address one byte at a time.
+    _net=""
+    for _o in $(seq 1 4) ; do
+	_net="$(($_net_ul & 255))${_net:+.}${_net}"
+	_net_ul=$(($_net_ul >> 8))
+    done
+
+    echo "${_net}/${_maskbits}"
+}
+
 ip_addr_add ()
 {
     local=""
@@ -228,8 +253,10 @@ ip_addr_add ()
 	not_implemented "addr add (without dev)"
     fi
     mkdir -p "${FAKE_IP_STATE}/addresses"
-    pf="${FAKE_IP_STATE}/addresses/${dev}-primary"
-    sf="${FAKE_IP_STATE}/addresses/${dev}-secondary"
+    net_str=$(ipv4_host_addr_to_net $(IFS="/" ; echo $local))
+    net_str=$(echo "$net_str" | sed -e 's@/@_@')
+    pf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-primary"
+    sf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-secondary"
     # We could lock here... but we should be the only ones playing
     # around here with these stubs.
     if [ ! -f "$pf" ] ; then
@@ -268,8 +295,10 @@ ip_addr_del ()
 	not_implemented "addr del (without dev)"
     fi
     mkdir -p "${FAKE_IP_STATE}/addresses"
-    pf="${FAKE_IP_STATE}/addresses/${dev}-primary"
-    sf="${FAKE_IP_STATE}/addresses/${dev}-secondary"
+    net_str=$(ipv4_host_addr_to_net $(IFS="/" ; echo $local))
+    net_str=$(echo "$net_str" | sed -e 's@/@_@')
+    pf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-primary"
+    sf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-secondary"
     # We could lock here... but we should be the only ones playing
     # around here with these stubs.
     if [ ! -f "$pf" ] ; then
diff --git a/tests/scripts/integration.bash b/tests/scripts/integration.bash
index b6452db..c014a11 100644
--- a/tests/scripts/integration.bash
+++ b/tests/scripts/integration.bash
@@ -498,13 +498,6 @@ wait_until_node_has_some_ips ()
     wait_until 60 node_has_some_ips "$@"
 }
 
-ip2ipmask ()
-{
-    _ip="$1"
-
-    ip addr show to "$_ip" | awk '$1 == "inet" { print $2 }'
-}
-
 #######################################
 
 daemons_stop ()
diff --git a/tests/simple/76_ctdb_pdb_recovery.sh b/tests/simple/76_ctdb_pdb_recovery.sh
index 9890e87..1c897c2 100755
--- a/tests/simple/76_ctdb_pdb_recovery.sh
+++ b/tests/simple/76_ctdb_pdb_recovery.sh
@@ -47,8 +47,7 @@ try_command_on_node 0 $CTDB wipedb $TESTDB
 # and update values
 for value in value1 value2 value3 value4 value5 ; do
 	echo "store key(test1) data($value)"
-	try_command_on_node 0 "(echo -ne $value > /tmp/test_data)"
-	try_command_on_node 0 $CTDB pstore $TESTDB test1 /tmp/test_data
+	echo "\"test1\" \"$value\"" | try_command_on_node -i 0 $CTDB ptrans "$TESTDB"
 done
 
 # Delete record
@@ -63,8 +62,7 @@ wait_until_node_has_status 1 stopped
 
 # Add a record   key=test1 data=value2
 echo "store key(test1) data(newvalue1)"
-try_command_on_node 0 "(echo -ne newvalue1 > /tmp/test_data)"
-try_command_on_node 0 $CTDB pstore $TESTDB test1 /tmp/test_data
+echo '"test1" "newvalue1"' | try_command_on_node -i 0 $CTDB ptrans "$TESTDB"
 
 # Continue node
 echo "contine node 1"
@@ -92,7 +90,7 @@ do_test
 if try_command_on_node 0 $CTDB pfetch $TESTDB test1 ; then
 	echo "GOOD: Record was not deleted (recovery by RSN worked)"
 else
-	echo "BAD: Record was not deleted"
+	echo "BAD: Record was deleted"
 	status=1
 fi
 
@@ -102,7 +100,7 @@ try_command_on_node all $CTDB setvar RecoverPDBBySeqNum 1
 
 do_test
 if try_command_on_node 0 $CTDB pfetch $TESTDB test1 ; then
-	echo "GOOD: Record was not deleted (recovery by sequnce number worked)"
+	echo "GOOD: Record was not deleted (recovery by sequence number worked)"
 else
 	echo "BAD: Record was deleted"
 	status=1


-- 
CTDB repository


More information about the samba-cvs mailing list