[SCM] Samba Shared Repository - branch master updated
Amitay Isaacs
amitay at samba.org
Tue Aug 23 19:18:03 UTC 2016
The branch, master has been updated
via 17dfd8b ctdb-tests: Reimplement daemons_stop() using ctdbd_wrapper
via bcb33c4 ctdb-tests: Remove function daemons_start_1()
via 3c87868 ctdb-tests: Move local daemon configuration creation into setup_ctdb()
via eb38d02 ctdb-tests: Drop attempts to pass arguments to ctdbd on (re)start
via fd443b8 ctdb-tests: Drop function _ctdb_hack_options()
from 77fae5b WHATSNEW: clear the sections for 4.6
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 17dfd8b96bc1750a2f435caa1d208766257346f3
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Aug 23 11:49:54 2016 +1000
ctdb-tests: Reimplement daemons_stop() using ctdbd_wrapper
The current daemons_stop() implementation uses very loose matching to
decide which processes to kill if "ctdb shutdown" hasn't worked within
1 second. This can cause ctdbd processes from other test runs to be
killed.
Instead, use ctdbd_wrapper, which uses the PID file as a last resort.
This has the advantage of never killing ctdbd processes from other
test runs. However, this also has the obvious consequence that an
interrupted test run in one directory can not have its daemons cleaned
up from a new test run in a different directory.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12170
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): Tue Aug 23 21:17:46 CEST 2016 on sn-devel-144
commit bcb33c46dfe3d6c06eb6b3b5e7f8625538772d5e
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Aug 23 11:07:25 2016 +1000
ctdb-tests: Remove function daemons_start_1()
This function doesn't do anything significant, so just unroll the body
into the loop in daemons_start().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12170
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 3c87868d208de8928e25db1dd34266830f017a07
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Aug 23 10:59:25 2016 +1000
ctdb-tests: Move local daemon configuration creation into setup_ctdb()
These files don't need to be re-generated on every restart. They can
be generated once when CTDB is first started.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12170
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit eb38d02eb77dd654c8ed79fe985f738431918c9f
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Aug 23 10:23:56 2016 +1000
ctdb-tests: Drop attempts to pass arguments to ctdbd on (re)start
This is not used.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12170
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit fd443b8cce4dedfe9a72f25e955274f66da41290
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Aug 23 10:20:51 2016 +1000
ctdb-tests: Drop function _ctdb_hack_options()
It does something special if the --start-as-stopped option is given
and is not used in any tests.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12170
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
-----------------------------------------------------------------------
Summary of changes:
ctdb/tests/scripts/integration.bash | 18 +----
ctdb/tests/simple/scripts/local_daemons.bash | 104 +++++++++++----------------
2 files changed, 45 insertions(+), 77 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 12deb75..b2a3451 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -524,20 +524,8 @@ wait_until_node_has_some_ips ()
#######################################
-_ctdb_hack_options ()
-{
- local ctdb_options="$*"
-
- case "$ctdb_options" in
- *--start-as-stopped*)
- export CTDB_START_AS_STOPPED="yes"
- esac
-}
-
restart_ctdb_1 ()
{
- _ctdb_hack_options "$@"
-
if [ -e /etc/redhat-release ] ; then
service ctdb restart
else
@@ -548,7 +536,7 @@ restart_ctdb_1 ()
# Restart CTDB on all nodes. Override for local daemons.
_restart_ctdb_all ()
{
- onnode -p all $CTDB_TEST_WRAPPER restart_ctdb_1 "$@"
+ onnode -p all $CTDB_TEST_WRAPPER restart_ctdb_1
}
# Nothing needed for a cluster. Override for local daemons.
@@ -559,8 +547,6 @@ setup_ctdb ()
restart_ctdb ()
{
- # "$@" is passed to restart_ctdb_all.
-
echo -n "Restarting CTDB"
if $ctdb_test_restart_scheduled ; then
echo -n " (scheduled)"
@@ -569,7 +555,7 @@ restart_ctdb ()
local i
for i in $(seq 1 5) ; do
- _restart_ctdb_all "$@" || {
+ _restart_ctdb_all || {
echo "Restart failed. Trying again in a few seconds..."
sleep_for 5
continue
diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash
index 765655e..ecb64f9 100644
--- a/ctdb/tests/simple/scripts/local_daemons.bash
+++ b/ctdb/tests/simple/scripts/local_daemons.bash
@@ -22,41 +22,17 @@ export CTDB_NODES="${TEST_VAR_DIR}/nodes.txt"
#######################################
-daemons_stop ()
-{
- echo "Attempting to politely shutdown daemons..."
- onnode -q all $CTDB shutdown || true
-
- echo "Sleeping for a while..."
- sleep_for 1
-
- local pat="ctdbd --sloppy-start --nopublicipcheck"
- if pgrep -f "$pat" >/dev/null ; then
- echo "Killing remaining daemons..."
- pkill -f "$pat"
-
- if pgrep -f "$pat" >/dev/null ; then
- echo "Once more with feeling.."
- pkill -9 -f "$pat"
- fi
- fi
-
- rm -rf "${TEST_VAR_DIR}/test.db"
-}
-
setup_ctdb ()
{
mkdir -p "${TEST_VAR_DIR}/test.db/persistent"
local public_addresses_all="${TEST_VAR_DIR}/public_addresses_all"
- local no_public_addresses="${TEST_VAR_DIR}/no_public_addresses.txt"
- rm -f $CTDB_NODES $public_addresses_all $no_public_addresses
+ rm -f $CTDB_NODES $public_addresses_all
# If there are (strictly) greater than 2 nodes then we'll randomly
# choose a node to have no public addresses.
local no_public_ips=-1
[ $TEST_LOCAL_DAEMONS -gt 2 ] && no_public_ips=$(($RANDOM % $TEST_LOCAL_DAEMONS))
- echo "$no_public_ips" >$no_public_addresses
# When running certain tests we add and remove eventscripts, so we
# need to be able to modify the events.d/ directory. Therefore,
@@ -90,34 +66,25 @@ setup_ctdb ()
fi
fi
done
-}
-
-daemons_start_1 ()
-{
- local pnn="$1"
- shift # "$@" gets passed to ctdbd
-
- local public_addresses_all="${TEST_VAR_DIR}/public_addresses_all"
- local public_addresses_mine="${TEST_VAR_DIR}/public_addresses.${pnn}"
- local no_public_addresses="${TEST_VAR_DIR}/no_public_addresses.txt"
- local public_addresses
- local no_public_ips=-1
- [ -r $no_public_addresses ] && read no_public_ips <$no_public_addresses
+ local pnn
+ for pnn in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
+ local public_addresses_mine="${TEST_VAR_DIR}/public_addresses.${pnn}"
+ local public_addresses
- if [ "$no_public_ips" = $pnn ] ; then
+ if [ "$no_public_ips" = $pnn ] ; then
echo "Node $no_public_ips will have no public IPs."
public_addresses="/dev/null"
- else
+ else
cp "$public_addresses_all" "$public_addresses_mine"
public_addresses="$public_addresses_mine"
- fi
+ fi
- local node_ip=$(sed -n -e "$(($pnn + 1))p" "$CTDB_NODES")
+ local node_ip=$(sed -n -e "$(($pnn + 1))p" "$CTDB_NODES")
- local pidfile="${TEST_VAR_DIR}/ctdbd.${pnn}.pid"
- local conf="${TEST_VAR_DIR}/ctdbd.${pnn}.conf"
- cat >"$conf" <<EOF
+ local pidfile="${TEST_VAR_DIR}/ctdbd.${pnn}.pid"
+ local conf="${TEST_VAR_DIR}/ctdbd.${pnn}.conf"
+ cat >"$conf" <<EOF
CTDB_RECOVERY_LOCK="${TEST_VAR_DIR}/rec.lock"
CTDB_NODES="$CTDB_NODES"
CTDB_NODE_ADDRESS="${node_ip}"
@@ -132,28 +99,43 @@ CTDB_SOCKET="${TEST_VAR_DIR}/sock.$pnn"
CTDB_NOSETSCHED=yes
EOF
- # Override from the environment. This would be easier if env was
- # guaranteed to quote its output so it could be reused.
- env |
- grep '^CTDB_' |
- sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' -e 's@="$@&"@' >>"$conf"
-
- # We'll use "pkill -f" to kill the daemons with
- # "ctdbd --sloppy-start --nopublicipcheck" as context.
- CTDBD="${VALGRIND} ctdbd --sloppy-start --nopublicipcheck" \
- CTDBD_CONF="$conf" \
- ctdbd_wrapper "$pidfile" start
+ # Override from the environment. This would be easier if env was
+ # guaranteed to quote its output so it could be reused.
+ env |
+ grep '^CTDB_' |
+ sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' -e 's@="$@&"@' >>"$conf"
+ done
}
daemons_start ()
{
- # "$@" gets passed to ctdbd
-
echo "Starting $TEST_LOCAL_DAEMONS ctdb daemons..."
- for i in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
- daemons_start_1 $i "$@"
+ local pnn
+ for pnn in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
+ local pidfile="${TEST_VAR_DIR}/ctdbd.${pnn}.pid"
+ local conf="${TEST_VAR_DIR}/ctdbd.${pnn}.conf"
+
+ CTDBD="${VALGRIND} ctdbd --sloppy-start --nopublicipcheck" \
+ CTDBD_CONF="$conf" \
+ ctdbd_wrapper "$pidfile" start
+ done
+}
+
+daemons_stop ()
+{
+ echo "Stopping $TEST_LOCAL_DAEMONS ctdb daemons..."
+
+ local pnn
+ for pnn in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
+ local pidfile="${TEST_VAR_DIR}/ctdbd.${pnn}.pid"
+ local conf="${TEST_VAR_DIR}/ctdbd.${pnn}.conf"
+
+ CTDBD_CONF="$conf" \
+ ctdbd_wrapper "$pidfile" stop
done
+
+ rm -rf "${TEST_VAR_DIR}/test.db"
}
maybe_stop_ctdb ()
@@ -166,5 +148,5 @@ maybe_stop_ctdb ()
_restart_ctdb_all ()
{
daemons_stop
- daemons_start "$@"
+ daemons_start
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list