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

6096 Commits

Author SHA1 Message Date
Martin Schwenke
f1265f0ebe ctdb-tests: NAT gateway slave-only changes
Handle the "slave-only" option in the unit test setup.  Reindent
function while touching it.

Also drop a test that no longer makes sense.  Specifying both "master"
and "slave-only' is now much more obvious, since they need to be on
the same line, and is now punishable by undefined behaviour.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:25 +01:00
Martin Schwenke
7095c9bcd0 ctdb-scripts: New function ctdb_natgw_slave_only()
This allows future changes to be more self-contained.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:25 +01:00
Martin Schwenke
3a2eebfe19 ctdb-tests: Test ctdb CLI tool via a stub
Some features, such NAT gateway and LVS support, can be implemented
without daemon and (internal) ctdb CLI tool support.  These are
non-core features that don't need incredible performance and they
don't need to be in the core code.  They can easily be reimplemented
in scripts, along with some configuration changes.

For continuity, the ctdb CLI tool code will call out to helper scripts
so that the current status information can still be provided.  Those
helper scripts may then reinvoke the ctdb CLI tool to gather
information.

So, redo the tool testing using a "ctdb" stub command.  This will
swallow standard input and feed it to the test program each time the
"ctdb" stub is called.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:25 +01:00
Martin Schwenke
1538fc4585 ctdb-tools: Add standalone ctdb_natgw tool script
This is intended to replace the use of "ctdb natgwlist" in 11.natgw
and provide different views of the NAT gateway status.

It replaces the use of CTDB_NATGW_SLAVE_ONLY=yes with a "slave-only"
keyword in the NAT gateway nodes file.  This means the nodes file must
be consistent on all nodes in a NAT gateway group.

Note that this script is not yet integrated, so there are no behaviour
or documentation changes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:25 +01:00
Martin Schwenke
d71f747f5c ctdb-scripts: Tests for monitoring of CTDB_NATGW_PUBLIC_IFACE
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:25 +01:00
Martin Schwenke
638117c01a ctdb-scripts: Move monitoring of CTDB_NATGW_PUBLIC_IFACE to 11.natgw
The NAT gateway code should be self-contained.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:25 +01:00
Martin Schwenke
df5845c641 ctdb-scripts: CTDB_PARTIALLY_ONLINE_INTERFACES incompatible with NAT gateway
This has always been the case.  Now it is documented and enforced.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:25 +01:00
Martin Schwenke
06901f4aeb ctdb-scripts: Rename variable: fail -> down_interfaces_found
Now its name describes its usage and the code reads better.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:24 +01:00
Martin Schwenke
d0f2143fe8 ctdb-scripts: Drop functions mark_up() and mark_down()
Each is now used in only one place and the logic is more obvious
without them.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:24 +01:00
Martin Schwenke
85316c0415 ctdb-scripts: Move interface monitoring code to functions file
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:24 +01:00
Martin Schwenke
fe64e76aa0 ctdb-scripts: Rename get_real_iface() -> interface_get_real()
Now suitably named for move to functions file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:24 +01:00
Martin Schwenke
6f212aacf8 ctdb-scripts: Refactor function interface_monitor() to monitor one interface
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-25 07:18:24 +01:00
Amitay Isaacs
d905179127 ctdb-client: Use ctdb_rec_buffer_init() to initialize ctdb_rec_buffer
... instead of talloc_zero().  This sets the db_id correctly.

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): Wed Jan 20 07:28:42 CET 2016 on sn-devel-144
2016-01-20 07:28:42 +01:00
Amitay Isaacs
a7d54bb2c1 ctdb-client: Add missing initialization for h->ev in transaction_start
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-20 04:19:11 +01:00
Amitay Isaacs
5d5d88e0bb ctdb-client: Do not delete reqid explicitly
The reqid will be deleted when the client control state is freed.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-20 04:19:11 +01:00
Amitay Isaacs
8ca76adaea ctdb-client: Add a disconnect callback for ctdb client
This allows the client code to optionally clean up and/or re-connect to
CTDB daemon when it the daemon goes away.  If no disconnect callback is
registered and CTDB daemon goes away, then the client will terminate.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-20 04:19:11 +01:00
Amitay Isaacs
555237f2a8 ctdb-client: Close ctdb socket connection when client context goes away
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-20 04:19:11 +01:00
Amitay Isaacs
e59712b2c3 ctdb-client: Use ctdb_ltdb_header_extract()
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-20 04:19:11 +01:00
Amitay Isaacs
0ed60d757d ctdb-protocol: Fix marshaling of seqnum
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-20 04:19:11 +01:00
Amitay Isaacs
d51a63554f ctdb-build: Fix -O3 developer build
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jan 18 14:32:05 CET 2016 on sn-devel-144
2016-01-18 14:32:05 +01:00
Michael Adam
19fffeb75a ctdb-scripts: further untangle logic for success of interface monitoring
Reduces intentation by using early returns.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Jan 14 22:41:29 CET 2016 on sn-devel-144
2016-01-14 22:41:29 +01:00
Volker Lendecke
93e48df86c ctdb: Fix the O3 developer build
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-14 19:37:19 +01:00
Martin Schwenke
39bc356ccb ctdb-ipalloc: Document the steps involved in a takeover run
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): Wed Jan 13 23:27:01 CET 2016 on sn-devel-144
2016-01-13 23:27:01 +01:00
Martin Schwenke
e320725f02 ctdb-ipalloc: Split IP allocation into its own build subsystem
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-13 20:18:20 +01:00
Martin Schwenke
3ac2d4b59e ctdb-tests: Fix some incorrect memory allocations
These allocate enough memory but things get confusing if they're used
as a guide when updating the code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Jan 12 22:19:16 CET 2016 on sn-devel-144
2016-01-12 22:19:16 +01:00
Martin Schwenke
a7ce00cc03 ctdb-scripts: Use more unique temporary file names
Consider this sequence of events:

1. Instance of script running update_tickles() hangs
2. Script debugging is launched asynchronously
3. New instance of script is launched, creates temporary file(s)
4. Original hung script makes progress before asynchronous script
   debugging kills it, so it removes temporary file(s)
5. New instance of script produces error due to missing files(s)

This is obviously rare.

Use more unique filenames to avoid step (4) removing the file(s)
belonging to other instances of the script.

This requires some extra cleanup to avoid too many temporary files
(which is why unique filenames were not originally usd).  It is
sufficient to remove files modified at least 10 minutes ago.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:18 +01:00
Martin Schwenke
4afe822397 ctdb-scripts: Don't remove temporary files before use
They will be clobbered by the redirect anyway.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:18 +01:00
Martin Schwenke
20838833f3 ctdb-scripts: Superficial clean-ups to 10.interface
Whitespace and indentation improvements.

Remove comments describing events, since the README covers that much
better.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:18 +01:00
Martin Schwenke
c23744c61d ctdb-scripts: Clarify logic for success of interface monitoring
The current code uses so many shell idioms that it is difficult to
follow.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:18 +01:00
Martin Schwenke
d8e4c5a468 ctdb-scripts: Fix regression in updateip code
Regression introduced in commit
6471541d6d.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:17 +01:00
Martin Schwenke
18b0aeaae0 ctdb-ipalloc: Fix a memory leak
Commit cfa0ffe780 introduced a memory
leak.  Never assume...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:17 +01:00
Martin Schwenke
24160ee6a4 ctdb-daemon: Don't leak memory if not using recovery lock
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:17 +01:00
Martin Schwenke
56ce230de7 ctdb-recoverd: Fix some uninitialised memory issues
The first element of these structures is a 32-bit PNN.  On 64-bit
systems this field can be followed by 32-bits of padding.  When the
structures are copied this can cause uninitialised memory to be
copied.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:17 +01:00
Martin Schwenke
8f73ae03cc ctdb-daemon: Drop the "schedule for deletion" messages to DEBUG level
Thousands of these can be generated each second, rendering INFO level
debugging useless.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-01-12 19:16:17 +01:00
Karolin Seeger
9790abd6a4 ctdb/web: Fix typo.
assinged -> assigned

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Jan 11 21:40:36 CET 2016 on sn-devel-144
2016-01-11 21:40:36 +01:00
Volker Lendecke
0cb8b9d113 ctdb: Fix CID 1347319 Unchecked return value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-08 02:37:18 +01:00
Martin Schwenke
7fb3d286d2 ctdb-client: Only get capabilities from active nodes
This is used by the recovery daemon to validate the current recovery
master.  Don't risk being unable to elect a new master if the current
master is inactive but unresponsive.

Note that this client call is currently not used by any other callers.

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): Sun Dec 13 03:17:10 CET 2015 on sn-devel-104
2015-12-13 03:17:10 +01:00
Ralph Boehme
2f16675a22 ping_pong: add -l option
Add a new option -l to check whether POSIX byte range locks are
working. Usage:

node1$ touch /path/to/cluster-fs/FILE

node1$ ./bin/ping_pong -l /path/to/cluster-fs/FILE
Holding lock, press any key to continue...
You should run the same command on another node now.

node2$ ./bin/ping_pong -l /path/to/cluster-fs/FILE

Output can either be:

  Holding lock, press any key to continue...

This means POSIX byte range locks are *not* working.

If you see this instead:

  file already locked, calling check_lock to tell us who has it locked...:
  check_lock failed: lock held: pid='27375', type='1', start='0', len='0'
  Working POSIX byte range locks

Congrats, you have a cluster fs with functional byte range locks!

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Dec 10 08:48:38 CET 2015 on sn-devel-104
2015-12-10 08:48:38 +01:00
Martin Schwenke
fe918572cb ctdb-ipalloc: Rename top level IP allocation algorithm functions
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): Fri Dec  4 12:25:14 CET 2015 on sn-devel-104
2015-12-04 12:25:14 +01:00
Martin Schwenke
821aa24ffd ctdb-ipalloc: Rename ctdb_takeover_run_core() to ipalloc()
It just does IP allocation...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
99abcc108c ctdb-ipalloc: Fold force_rebalance_candidates into IP allocation state
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
13aa583ea4 ctdb-ipalloc: Fold all IPs list into IP allocation state
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
fb66232155 ctdb-ipalloc: Tidy up some of the IP allocation functions
Shorter temporary variables for compactness/readability.  "tmp_ip" is
5 characters longer than "t".  In each for statement it is used 4
times, so costs 20 characters.  Save those extra characters so that
future edits will avoid going over 80 columns.

Tweak whitespace for readability, rewrap some code.

No functional changes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
5dcc1d7a69 ctdb-daemon: Don't delete connection information for released IP
As per the comment:

  If the IP address is hosted on this node then remove the connection.

  Otherwise this function has been called because the server IP
  address has been released to another node and the client has exited.
  This means that we should not delete the connection information.
  The takeover node processes connections too.

This doesn't matter at the moment, since the empty connection list for
an IP address that has been released will never be pushed to another
node.  However, it matters if the connection information is stored in
a real replicated database.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
4261d6e70a ctdb-daemon: Move VNN lookup out of ctdb_remove_tcp_connection()
In a subsequent commit ctdb_takeover_client_destructor_hook() needs to
know the VNN.  So just have both callers of
ctdb_remove_tcp_connection() do the lookup and pass in the VNN.

This should cause no change in behaviour.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
473f1a77e1 ctdb-daemon: Do not process tickle updates for hosted IP addresses
Tickle list updates are broadcast to all connected nodes and are
accepted even when received on the same node that sent them.  This
could actually lead to lost connection information when information
about new connections is received while an update is in-flight.

Instead, return early when the IP is hosted on the current node, since
it is the only one that could have sent the update.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
80c0511421 ctdb-docs: Rewrite event script documentation
Move information about TCP connection tracking and resetting into
ctdb.7.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
d7424f97c9 ctdb-scripts: Add exportfs cache to NFS Linux kernel callout
exportfs can hang when, for example, DNS is flakey.  Given that
exports don't change much, it makes sense to cache them.

Don't try to add error handling when exportfs fails but do print a
warning.  Proper error handling can be added separately.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
bd7c94d5ac ctdb-recoverd: Drop function unban_all_nodes()
It hasn't worked since commit cda5f02c7c
in 2009, which reworked the banning code.  Since then
ctdb_control_modflags() has contained a comment saying:

  /* we don't let other nodes modify our BANNED status */

Unbanning all nodes originally occurred here when the recovery master
role moved to a new node.  The logic could have been meant for the
case when the old recovery master was malfunctioning, so got banned.
If any other nodes had been banned by this recovery master then they
would be unbanned.  However, this would also unban the old recovery
master, which is probably suboptimal.  The logic would also trigger if
a node was banned for a good reason and then the recovery master was
stopped.  So, apart from doing nothing, the logic is too simplistic so
might as well be removed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Martin Schwenke
ad6685847b ctdb-daemon: Drop handling of ban control sent to unexpected node
The banning code caters for the case where the node specified in the
bantime data is not the node receiving the control.  This never
happens.  There are 2 places where ctdb_ctrl_set_ban() is called: the
ctdb CLI tool and the recovery daemon.  Both pass the same node in the
bantime data that they are sending the control to.  There are no plans
to do anything more elaborate, so just delete the handling of this
special case.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00