diff options
| author | Martin Schwenke <martin@meltin.net> | 2014-04-10 11:58:57 +1000 |
|---|---|---|
| committer | Martin Schwenke <martins@samba.org> | 2014-04-14 06:06:49 +0200 |
| commit | 2f2421bae1a8ff46ad54f76d02e6dd1c3ffe3300 (patch) | |
| tree | b30e1aaf874c27de108ae8979172244972e16fd4 /ctdb/tests/eventscripts/stubs | |
| parent | ce8ac88b969bb8bb7a94e62bb6e86aec389be6ac (diff) | |
| download | samba-2f2421bae1a8ff46ad54f76d02e6dd1c3ffe3300.tar.gz samba-2f2421bae1a8ff46ad54f76d02e6dd1c3ffe3300.tar.xz samba-2f2421bae1a8ff46ad54f76d02e6dd1c3ffe3300.zip | |
ctdb-eventscripts: CTDB_NATGW_PUBLIC_* optional on slave-only nodes
Commit 4ee4925d416a86341bd76c11fa99ec9173682a1d forgot about
CTDB_NATGW_SLAVE_ONLY so it introduces an incorrect failure when this
is set, and CTDB_NATGW_PUBLIC_IFACE or CTDB_NATGW_PUBLIC_IP is unset.
Relax the sanity check to see if CTDB_NATGW_SLAVE_ONLY is set.
Update the documentation to explicitly state that
CTDB_NATGW_PUBLIC_IFACE and CTDB_NATGW_PUBLIC_IP are optional and
unused if CTDB_NATGW_SLAVE_ONLY is set. It would be possible to
insist that CTDB_NATGW_PUBLIC_IFACE and CTDB_NATGW_PUBLIC_IFACE should
be unset in that case. However, it is more reasonable to allow
consistent configuration across nodes except with some nodes
configured slave-only.
Add tests, update infrastructure and fix a thinko in the stub's
"natgwlist" implementation.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Apr 14 06:06:49 CEST 2014 on sn-devel-104
Diffstat (limited to 'ctdb/tests/eventscripts/stubs')
| -rwxr-xr-x | ctdb/tests/eventscripts/stubs/ctdb | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/ctdb/tests/eventscripts/stubs/ctdb b/ctdb/tests/eventscripts/stubs/ctdb index 51c17635fc..b8b3e67a42 100755 --- a/ctdb/tests/eventscripts/stubs/ctdb +++ b/ctdb/tests/eventscripts/stubs/ctdb @@ -249,21 +249,28 @@ ctdb_natgwlist () [ -r "$CTDB_NATGW_NODES" ] || \ die "error: missing CTDB_NATGW_NODES=${CTDB_NATGW_NODES}" - # Determine the master node - _master="-1 0.0.0.0" + # Determine if the current node has the (fake) NAT gateway + # capability. This is only used to make sure tests are sane and + # don't try to use inconsistent setup. if [ -r "$FAKE_CTDB_NATGW_STATE" ] ; then read _state <"$FAKE_CTDB_NATGW_STATE" - if [ "$_state" = "on" ] ; then - _pnn=0 - while read _ip ; do - if [ "$FAKE_CTDB_NATGW_MASTER" = "$_ip" ] ; then - _master="${_pnn} ${_ip}" - break - fi - _pnn=$(($_pnn + 1)) - done <"$CTDB_NATGW_NODES" - fi + else + _state="off" fi + + # Determine the master node + _master="-1 0.0.0.0" + _pnn=0 + while read _ip ; do + if [ "$FAKE_CTDB_NATGW_MASTER" = "$_ip" ] ; then + _master="${_pnn} ${_ip}" + if [ "$_pnn" = "$FAKE_CTDB_PNN" -a "$_state" = "off" ] ; then + die "Inconsistent test configuration - master node is slave-only" + fi + break + fi + _pnn=$(($_pnn + 1)) + done <"$CTDB_NATGW_NODES" echo "$_master" # Now print the node information - it is clearer to do this in a |
