1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

5152 Commits

Author SHA1 Message Date
Martin Schwenke
be71a84565 ctdb-eventscripts: Don't check if $iface is empty
This is the loop variable.  It can't be empty, especially given the
way the list is built.  This must have survived from an earlier
version of the script.

Given that there are whitespace changes associated with the above,
clean-up the "virtio_net" avoidance check so that it reads less like
line-noise.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-05-05 03:55:08 +02:00
Volker Lendecke
8dede57741 ctdb: Fix a comment typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 30 21:05:09 CEST 2014 on sn-devel-104
2014-04-30 21:05:09 +02:00
Amitay Isaacs
463ea9e525 ctdb-recoverd: Detach database from recovery daemon
As part of vacuuming, recoverd attaches to databases to migrate records.
When detaching a database from main daemon, it should be removed from
recovery daemon also.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Apr 23 17:05:45 CEST 2014 on sn-devel-104
2014-04-23 17:05:45 +02:00
Amitay Isaacs
b31240acaf ctdb-tests: Add test for re-attaching detached database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-23 14:49:07 +02:00
Amitay Isaacs
581ee2e4c3 ctdb-tools/ctdb: Unlock records before closing tdb database
Now freeing ctdb_db context will close the tdb database.  So make sure
all the locks are released (by freeing record handles or memory context
from which record handles are allocated) before freeing ctdb_db context.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-23 14:49:07 +02:00
Amitay Isaacs
db0a1df25c ctdb-client: Talloc tdb_wrap off ctdb_db_context
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-23 14:49:07 +02:00
Amitay Isaacs
d9d3af7baa ctdb-daemon: Talloc tdb_wrap off ctdb_db_context
This will ensure that when ctdb_db is freed, it will close the tdb
database.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-23 14:49:07 +02:00
Martin Schwenke
bf83abced4 ctdb-tests: Update "ctdb detach" test
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-23 14:49:07 +02:00
Amitay Isaacs
a1e1b81b9c ctdb-tools/ctdb: Detach databases only if all nodes disallow client access
This makes sure that AllowClientDBAttach is set to 0 before detaching any
databases.

If someone enables the tunable between checking of tunable and actual
detaching of databases, then they deserve what they get. :-)

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-23 14:49:07 +02:00
Amitay Isaacs
1d4fb1b702 ctdb-daemon: Do not allow database detach if AllowClientDBAttach=1
This avoids the server detaching a database if clients are allowed to
connect to databases.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-23 14:49:07 +02:00
Björn Baumbach
fae7e5d771 lib-util: rename memdup to smb_memdup and fix all callers
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-04-16 20:39:08 +02:00
Andrew Bartlett
cec833063e auth: Remove plaintext OSF1 password support
The WAF build does not have the code to detect getprpwnam on which
this is based, and so this is dead code.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-04-15 10:13:12 +02:00
Martin Schwenke
2f2421bae1 ctdb-eventscripts: CTDB_NATGW_PUBLIC_* optional on slave-only nodes
Commit 4ee4925d41 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
2014-04-14 06:06:49 +02:00
Martin Schwenke
ce8ac88b96 ctdb-tools-ctdb: Drop disconnected nodes when filtering by capability
Commit ba69742ccd missed the point of
filtering disconnected nodes while limiting the nodemap to those in
the NAT gateway group.  It was really to avoid trying to fetch
capabilities from disconnected nodes.  This should be explicitly done
in filter_nodemap_by_capabilities(), otherwise "ctdb natgwlist" simply
fails when there is a disconnected node.

Note that the alternate solution where filter_nodemap_by_flags() is
called before filter_nodemap_by_capabilities() would not be not
correct.  Filtering on flags first can produce a "healthier" set of
nodes where none of them have the NAT gateway capability.

Also extend stub for ctdb_ctrl_getcapabilities() to fail when trying
to get capabilities from a disconnected node and add a corresponding
test to confirm that "ctdb natgwlist" is no longer broken.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-04-14 03:52:40 +02:00
Amitay Isaacs
c048011cd6 ctdb-tests: Add a simple test for "ctdb detach"
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-04-14 03:52:40 +02:00
Amitay Isaacs
89bf1d2e34 ctdb-doc: Remove commands that have been deleted
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-04-14 03:52:39 +02:00
Amitay Isaacs
b681e89a97 ctdb-doc: Add "ctdb detach" and update "ctdb attach"
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-04-14 03:52:39 +02:00
Amitay Isaacs
a3fdb56376 ctdb-tools/ctdb: Add ctdb detach command to detach databases
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-04-14 03:52:39 +02:00
Amitay Isaacs
ce18b3b00b ctdb-client: Add client code to detach a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-04-14 03:52:39 +02:00
Amitay Isaacs
1c72842217 ctdb-daemon: Add control CTDB_CONTROL_DB_DETACH
This detaches specified database from all the nodes.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-04-14 03:52:39 +02:00
Amitay Isaacs
01de7818de ctdb-daemon: Always update database priority cluster wide
Database priority is a global property and all the nodes should have the
priority set for the databases.  Just setting priority on one node can
lead to problems in the recovery as a database can be frozen at wrong
priority and then freezing database would not succeed.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Apr  7 14:06:26 CEST 2014 on sn-devel-104
2014-04-07 14:06:26 +02:00
Volker Lendecke
1dba07db0d dlinklist: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Apr  2 17:11:37 CEST 2014 on sn-devel-104
2014-04-02 17:11:37 +02:00
Gregor Beck
6cdde2711b ctdb:daemon avoid goto ctdb_remove_orphaned_ifaces()
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Apr  1 02:59:05 CEST 2014 on sn-devel-104
2014-04-01 02:59:05 +02:00
Gregor Beck
dd56afc7df ctdb:daemon take a shortcut in all_nodes_are_disabled()
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-01 00:55:45 +02:00
Amitay Isaacs
7667da6590 ctdb-readonly: Do not use hard-coded value for readonly revoke timeout
In case of control timeouts, readonly revoke code currently aborts.  This
needs to be fixed.  Meanwhile, using control_timeout instead of 5 seconds,
increases the timeout to 60 seconds.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Mar 31 07:20:48 CEST 2014 on sn-devel-104
2014-03-31 07:20:48 +02:00
Amitay Isaacs
533ad24644 ctdb-tests: Do not mix bool and int data types
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Mar 28 07:56:18 CET 2014 on sn-devel-104
2014-03-28 07:56:18 +01:00
Amitay Isaacs
30f7d7db8c ctdb-tests: Use ctdb_fetch_lock instead of ctdb_fetch_lock_readonly
This will test that ctdb_fetch_lock correctly revokes readonly
delegations.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-03-28 05:55:13 +01:00
Amitay Isaacs
78015320b6 ctdb-client: ctdb_fetch_lock should check for readonly delegations
When readonly delegations were added, ctdb_fetch_lock code should have
been modified to include the check for readonly flags.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-03-28 05:55:13 +01:00
Martin Schwenke
aa7cd51bbc ctdb-tests: Fix and extend read-only records test
This test currently counts the number of read-only-enabled databases
and expects there to only be 1.  It fails when there are existing
databases with read-only already enabled.  Instead, check just the
test database.

Clean up the test by adding some functions to check for precisely the
read-only flags that should be set on a node after each operation.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-03-28 05:55:13 +01:00
Martin Schwenke
234f8eb571 ctdb-tests: Add a new NFS tickle test
This one ensures that a newly started node gets an up-to-date tickle
list.  Tweak some of the integration test functions to accommodate
this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-03-28 05:55:13 +01:00
Amitay Isaacs
f99a759ce7 ctdb-locking: Instead of comparing key, compare key hash
This replaces memory comparison of the key with integer comparison.
In addition, this also avoids scheduling locks with the same hash.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Mar 28 05:28:58 CET 2014 on sn-devel-104
2014-03-28 05:28:58 +01:00
Amitay Isaacs
d1c8f8d635 ctdb-locking: Check for talloc_memdup error
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-03-28 03:30:09 +01:00
Amitay Isaacs
ff1c85ae27 ctdb-locking: Avoid memory leak
If lock_request could not be allocated, free lock_ctx since there can
only be a single lock_request per lock_ctx.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-03-28 03:30:09 +01:00
Martin Schwenke
3d5b80f26a ctdb-tests: Add NAT gateway eventscript unit tests for static routes
Signed-off-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Mar 26 06:24:01 CET 2014 on sn-devel-104
2014-03-26 06:24:01 +01:00
Martin Schwenke
70bbbbe448 ctdb-eventscripts: CTDB_NATGW_STATIC_ROUTES can specify gateways
Extend CTDB_NATGW_STATIC_ROUTES so that each network can have an
optional gateway that overrides CTDB_NATGW_DEFAULT_GATEWAY.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:42 +01:00
Martin Schwenke
34682affe9 ctdb-eventscripts: New configuration variable CTDB_NATGW_STATIC_ROUTES
This can be used to create more specific NATGW routes than the usual
NATGW default route.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:42 +01:00
Martin Schwenke
7705efc355 ctdb-eventscripts: Clarify that CTDB_NATGW_DEFAULT_GATEWAY is optional
This has been implied since the command to add the route has had
errors redirected to /dev/null.  If infrastucture (e.g. ADS, DNS) is
on the same network as CTDB_NATGW_PUBLIC_IP then no route is
necessary.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:42 +01:00
Martin Schwenke
8a3be1f1a9 ctdb-eventscripts: Improve check in NATGW "startup" event
Although the dots in $CTDB_NATGW_PUBLIC_IP could probably only help
match an invalid public IP address, this is only executed once so do
as exact a check as possible.

Use CTDB_BASE instead of hardcoding /etc/ctdb.

Make the error message less redundant.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:42 +01:00
Martin Schwenke
e22a22b1f7 ctdb-eventscripts: Reformat natgw_clear()
Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:42 +01:00
Martin Schwenke
3c839c60d1 ctdb-eventscripts: Rename some NAT gateway functions
delete_all() really needed renaming for clarity.  While doing this,
might as well rename some of the others that don't start with
"natgw_".

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:42 +01:00
Martin Schwenke
c0e239473b ctdb-tests: Add a test for NAT gateway sanity checking
Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:42 +01:00
Martin Schwenke
4ee4925d41 ctdb-eventscripts: Sanity check NAT gateway configuration
NAT gateway really can't operate unless most of the configuration
variables are set.

A check in delete_all() can be removed - strange that this isn't also
done in the add case.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:41 +01:00
Martin Schwenke
0953f5799c ctdb-eventscripts: Improve readability of NAT gateway update code
Put the code into a couple of usefully named functions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:41 +01:00
Martin Schwenke
7fdd6b7861 ctdb-tests: Add some tests for 11.natgw eventscript
This includes adding support for:

* Configuring fake NATGW state in the eventscript unit tests

* "natgwlist" and "setnatgwstate" in ctdb command stub

* ip command stub to default to "main table" when no table specified,
  allow routes to be added without "dev" option (just add a default
  dev), support "metric" option

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:41 +01:00
Martin Schwenke
feeb9843bf ctdb-eventscripts: Use set_proc() to update /proc
In case we want to write some unit tests in the future.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2014-03-26 04:21:41 +01:00
Martin Schwenke
20c719677a ctdb/daemon: Optimise deletion of IPs
Previous commits maintained the ordering between
ctdb_remove_orphaned_ifaces() and ctdb_vnn_unassign_iface().  This
meant that ctdb_remove_orphaned_ifaces() needed to steal the orphaned
interfaces and they would be freed later.

Unassign the interface first and things get simpler.
ctdb_remove_orphaned_ifaces() is now self-contained.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Sun Mar 23 06:20:43 CET 2014 on sn-devel-104
2014-03-23 06:20:43 +01:00
Martin Schwenke
9b907536fb ctdb/daemon: Make delete IP wait until the IP is released
reloadips really expects deleted IPs to be released before completing.
Otherwise the recovery daemon starts failing the local IP check.  The
races that follow can cause a node to be banned.

To make the error handling simple, do the actual deletion in
release_ip_callback().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-03-23 04:20:15 +01:00
Martin Schwenke
bafb9151cc ctdb-tests: Improve tickle tests
It is hard to diagnose failures in the NFS tickle test because there's
no way of telling if the test node doesn't have the tickle or if it
didn't get propagated.

Factor out check_tickles() into local.bash and give it some
parameters.

Have the NFS test call it first to ensure the tickle has been
registered.  Then use new function check_tickles_all() to ensure the
tickle has been propagated to all nodes.  Give this a bit of extra
time (double the timeout) just in case we're racing with the update.

Add a useful comment to the CIFS test so that I stop asking myself how
the test could ever have worked reliably.  :-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
2014-03-23 04:20:15 +01:00
Martin Schwenke
058e14cdb0 ctdb-eventscripts: Fix regression in IP add/delete functions
Commit 176ae6c704 caused these functions
to exit on failure.  This is incorrect and broke NAT gateway.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-03-23 04:20:14 +01:00
Martin Schwenke
ecafbce1b1 ctdb-daemon: Do not disable monitoring when running eventscripts
This is racy and cbffbb7c2f makes it
unnecessary.

The eventscript code still knows that monitor events are special
compared to other events.  However, the general concept of monitoring
is no longer tangled up with running scripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-03-23 04:20:14 +01:00