summaryrefslogtreecommitdiffstats
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
...
* ctdb-tests: Add test for re-attaching detached databaseAmitay Isaacs2014-04-231-0/+33
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tools/ctdb: Unlock records before closing tdb databaseAmitay Isaacs2014-04-231-2/+2
| | | | | | | | | 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>
* ctdb-client: Talloc tdb_wrap off ctdb_db_contextAmitay Isaacs2014-04-231-1/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-daemon: Talloc tdb_wrap off ctdb_db_contextAmitay Isaacs2014-04-231-1/+1
| | | | | | | | 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>
* ctdb-tests: Update "ctdb detach" testMartin Schwenke2014-04-231-15/+56
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tools/ctdb: Detach databases only if all nodes disallow client accessAmitay Isaacs2014-04-232-0/+68
| | | | | | | | | | | 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>
* ctdb-daemon: Do not allow database detach if AllowClientDBAttach=1Amitay Isaacs2014-04-231-3/+4
| | | | | | | | 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>
* lib-util: rename memdup to smb_memdup and fix all callersBjörn Baumbach2014-04-161-1/+1
| | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Volker Lendecke <vl@samba.org>
* auth: Remove plaintext OSF1 password supportAndrew Bartlett2014-04-151-3/+0
| | | | | | | | 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>
* ctdb-eventscripts: CTDB_NATGW_PUBLIC_* optional on slave-only nodesMartin Schwenke2014-04-149-17/+142
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* ctdb-tools-ctdb: Drop disconnected nodes when filtering by capabilityMartin Schwenke2014-04-143-3/+56
| | | | | | | | | | | | | | | | | | | | | Commit ba69742ccd822562ca2135d2466e09bf1216644b 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>
* ctdb-tests: Add a simple test for "ctdb detach"Amitay Isaacs2014-04-141-0/+85
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-doc: Remove commands that have been deletedAmitay Isaacs2014-04-141-64/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-doc: Add "ctdb detach" and update "ctdb attach"Amitay Isaacs2014-04-141-5/+34
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools/ctdb: Add ctdb detach command to detach databasesAmitay Isaacs2014-04-141-0/+40
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Add client code to detach a databaseAmitay Isaacs2014-04-142-0/+20
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Add control CTDB_CONTROL_DB_DETACHAmitay Isaacs2014-04-144-0/+91
| | | | | | | This detaches specified database from all the nodes. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Always update database priority cluster wideAmitay Isaacs2014-04-074-17/+17
| | | | | | | | | | | | | 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
* dlinklist: Fix a typoVolker Lendecke2014-04-022-2/+2
| | | | | | | | 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
* ctdb:daemon avoid goto ctdb_remove_orphaned_ifaces()Gregor Beck2014-04-011-9/+5
| | | | | | | | | 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
* ctdb:daemon take a shortcut in all_nodes_are_disabled()Gregor Beck2014-04-011-5/+4
| | | | | | Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-readonly: Do not use hard-coded value for readonly revoke timeoutAmitay Isaacs2014-03-311-2/+2
| | | | | | | | | | | | 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
* ctdb-tests: Do not mix bool and int data typesAmitay Isaacs2014-03-281-1/+1
| | | | | | | | 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
* ctdb-tests: Use ctdb_fetch_lock instead of ctdb_fetch_lock_readonlyAmitay Isaacs2014-03-281-1/+1
| | | | | | | | 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>
* ctdb-client: ctdb_fetch_lock should check for readonly delegationsAmitay Isaacs2014-03-281-0/+15
| | | | | | | | 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>
* ctdb-tests: Fix and extend read-only records testMartin Schwenke2014-03-281-93/+123
| | | | | | | | | | | | | 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>
* ctdb-tests: Add a new NFS tickle testMartin Schwenke2014-03-282-4/+102
| | | | | | | | | 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>
* ctdb-locking: Instead of comparing key, compare key hashAmitay Isaacs2014-03-281-4/+6
| | | | | | | | | | | 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
* ctdb-locking: Check for talloc_memdup errorAmitay Isaacs2014-03-281-0/+5
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-locking: Avoid memory leakAmitay Isaacs2014-03-281-0/+1
| | | | | | | | 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>
* ctdb-tests: Add NAT gateway eventscript unit tests for static routesMartin Schwenke2014-03-266-0/+207
| | | | | | | 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
* ctdb-eventscripts: CTDB_NATGW_STATIC_ROUTES can specify gatewaysMartin Schwenke2014-03-262-8/+27
| | | | | | | 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>
* ctdb-eventscripts: New configuration variable CTDB_NATGW_STATIC_ROUTESMartin Schwenke2014-03-263-5/+64
| | | | | | | This can be used to create more specific NATGW routes than the usual NATGW default route. Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-eventscripts: Clarify that CTDB_NATGW_DEFAULT_GATEWAY is optionalMartin Schwenke2014-03-263-9/+14
| | | | | | | | | 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>
* ctdb-eventscripts: Improve check in NATGW "startup" eventMartin Schwenke2014-03-261-2/+5
| | | | | | | | | | | | 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>
* ctdb-eventscripts: Reformat natgw_clear()Martin Schwenke2014-03-261-9/+11
| | | | Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-eventscripts: Rename some NAT gateway functionsMartin Schwenke2014-03-261-10/+11
| | | | | | | | 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>
* ctdb-tests: Add a test for NAT gateway sanity checkingMartin Schwenke2014-03-261-0/+24
| | | | Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-eventscripts: Sanity check NAT gateway configurationMartin Schwenke2014-03-261-3/+20
| | | | | | | | | | 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>
* ctdb-eventscripts: Improve readability of NAT gateway update codeMartin Schwenke2014-03-261-16/+31
| | | | | | Put the code into a couple of usefully named functions. Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Add some tests for 11.natgw eventscriptMartin Schwenke2014-03-269-18/+376
| | | | | | | | | | | | | | 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>
* ctdb-eventscripts: Use set_proc() to update /procMartin Schwenke2014-03-261-3/+3
| | | | | | In case we want to write some unit tests in the future. Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb/daemon: Optimise deletion of IPsMartin Schwenke2014-03-231-11/+11
| | | | | | | | | | | | | | | | 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
* ctdb/daemon: Make delete IP wait until the IP is releasedMartin Schwenke2014-03-233-31/+100
| | | | | | | | | | | | 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>
* ctdb-tests: Improve tickle testsMartin Schwenke2014-03-233-20/+45
| | | | | | | | | | | | | | | | | | | | | 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>
* ctdb-eventscripts: Fix regression in IP add/delete functionsMartin Schwenke2014-03-231-4/+8
| | | | | | | | Commit 176ae6c704528c021fcc34a41878584f43a00119 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>
* ctdb-daemon: Do not disable monitoring when running eventscriptsMartin Schwenke2014-03-231-5/+0
| | | | | | | | | | | | This is racy and cbffbb7c2f406fc1d8ebad3c531cc2757232690e 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>
* ctdb-eventscripts: Attach to persistent ctdb.tdb in "startup" eventMartin Schwenke2014-03-231-1/+2
| | | | | | | | | | | | | "statd-callout notify" currently complains until an add-client or del-client is done. Given that we might use ctdb.tdb for something else in the future it makes sense attach to it in the "startup" event. This could be done in the background but it should be so lightweight that a timeout will indicate serious problems. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Fix tickle updates to recently started nodesMartin Schwenke2014-03-231-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 0723fedcedd4a97870f7b1224945f1587363c9bf added a cheap implemention of ctdb_control_startup() that simply flags the recipient node as needing to send updates for each IP when the tickle update loop next fires. Commit 026996550d726836091ff5ebd1ebf925bf237bb0 ensures that a node only sends tickle updates once being flagged to do so. CTDB_CONTROL_STARTUP is broadcast to all nodes, so this is a good start. However, the tickle updates are only broadcast to connected nodes. A recently started node may not yet be considered to be connected because the keepalive monitoring loop may not yet have marked the node as connected. This means that the tickle update loop races with the keepalive monitoring loop. If the tickle update loop wins then updates will not be sent to the recently started node. The simplest improvement is to stop the tickle update from depending on whether a node is connected or not. So instead of broadcasting tickle updates to connected nodes, they are broadcast to all nodes. Since no reply is expected, this should work just fine. While looking at this code, ctdb_ctrl_set_tcp_tickles() is named like a client function. It isn't a client function. Also, 2 of the arguments are ignored. So rename this function to ctdb_send_set_tcp_tickles_for_ip() and remove the ignored arguments. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools-ctdb: Parse IP addresses when reading a list from a fileMartin Schwenke2014-03-231-21/+15
| | | | | | | | This way this logic is centralised. It also means that the IP address comparisons in the NAT gateway code are IPv6 safe. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>