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

376 Commits

Author SHA1 Message Date
Martin Schwenke
41a14e72b5 ctdb-ipalloc: ipalloc() returns public IP list
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
21adcd32bd ctdb-ipalloc: Move set_ipflags_internal() to ipalloc
Rename it ipalloc_set_node_flags().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
2eb0b9e98a ctdb-ipalloc: Switch set_ipflags_internal() to use a new-style node map
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
ee7fc252c8 ctdb-ipalloc: Move ipalloc state initialisation to ipalloc.c
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
38f4616bdd ctdb-ipalloc: Pass extra data to IP allocation state initialisation
No longer require CTDB context but pass in number of nodes, algorithm,
no_ip_failback and force_rebalance_nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
64361d9778 ctdb-ipalloc: Make no_ip_failback a boolean
No need to expose tunable values that far down.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
c5d85a071b ctdb-ipalloc: New function ipalloc_can_host_ips()
Abstracts out code involving internals of IP allocation state.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
e8ff433c46 ctdb-ipalloc: Move create_merged_ip_list() into ipalloc
How the existing IP layout is constructed and how the merged IP list is
sorted are important aspects of the IP allocation algorithm.  Construct the
merged IP list when known and available IPs are assigned.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
5c47c35c5a ctdb-ipalloc: New function ipalloc_set_public_ips()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
1f5c4dbac9 ctdb-ipalloc: Remove function ctdb_reload_remote_public_ips()
Use ctdb_fetch_remote_public_ips() inline to fetch each list.  Assign
them into the IP allocation state separately.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
303ef82a27 ctdb-ipalloc: Clean up reloading of remote public IPs
Factor out new function ctdb_fetch_remote_public_ips() to fetch known
or available public IP addresses, according to flags.

This also drops the hack where the array from a
ctdb_public_ip_list_old was assigned to a pointer in a
ctdb_public_ip_list.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
c09cf571b7 ctdb-ipalloc: Don't build a global IP tree
It isn't used outside this function, so just use a local variable.

This makes create_merged_ip_list() independent of the CTDB context.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:25 +02:00
Martin Schwenke
55f13b74bf ctdb-ipalloc: Drop code to update IP assignment tree
This code is not used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:24 +02:00
Martin Schwenke
35644d0d82 ctdb-ipalloc: Drop remote IP verification
It is only run during a takeover run and only logs errors.  It doesn't
actually do anything to fix potential errors.  The takeover run should
fix any inconsistencies anyway.

Instead, leave a comment in the recovery daemon's monitoring loop to
add proper remote IP verification later.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:24 +02:00
Martin Schwenke
c86066cdc0 ctdb-ipalloc: Drop a use of CTDB_NO_MEMORY_NULL()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:24 +02:00
Martin Schwenke
1ec7de66e9 ctdb-ipalloc: Do not use node count or PNNs from CTDB context
This is unnecessary.  IP allocation state already has a node count and
"i" is already a PNN.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:24 +02:00
Martin Schwenke
c92aa6105a ctdb-ipalloc: Drop an unnecessary check
Deleted (and other inactive) nodes will have an empty list of known
IP addresses.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:24 +02:00
Martin Schwenke
03b300e052 ctdb-ipalloc: Move if-statement with broken condition
This pointer is for an array that is always allocated.  The check is
meant to skip a node that has no IP addresses.  However, when there
are no IP addresses the loop below will not do anything anyway.

Add this as a check at the beginning of the function instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:24 +02:00
Martin Schwenke
4331306fce ctdb-takeover: Do not set node unhealthy when "takeip" fails
It will just become healthy again in the next monitor cycle.

Instead, let the recovery master ban it if the problem persists.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:17 +02:00
Martin Schwenke
9dc3b117e2 ctdb-takeover: Recovery daemon no longer passes fail callback
Banning is now handled by the takeover code sending banning credit
messages.

This commit makes a change in behaviour quite obvious.  Takeover runs
were initiated from several locations in the code but banning was only
done from one of these locations.  Now banning can be done from any
failed takeover run.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:17 +02:00
Martin Schwenke
1e9f650382 ctdb-takeover: Only apply banning credits to the worst offender
Post-process failues and only send banning credits to the node with
the most failures.

If there is a widespread problem or a problem on the recovery master
node then this should help avoid banning all the nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:17 +02:00
Martin Schwenke
1c60694e53 ctdb-takeover: Count takeover run failures
This will allow banning credits assignments to be limited according to
some criteria.

Note that this only matters when multiple controls are sent to each
node: RELEASE_IP and TAKEOVER_IP.  This doesn't change the behaviour
for IPREALLOCATED.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:17 +02:00
Martin Schwenke
0053b85fc6 ctdb-takeover: Send banning credit messages from fail callback
Banning credits are now assigned by takeover runs called from all
locations in the recovery daemon.  Previously this only happened from
one of the callers.  When separating out the takeover run code the
behaviour should be consistent.

The callback (and corresponding data) passed to ctdb_takeover_run() is
now ignored.  Dropping this will allow the interface between the
recovery daemon and IP takeover to be simplified.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:17 +02:00
Martin Schwenke
db9ec11b1a ctdb-takeover: Have the takeover fail callback log a message
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:17 +02:00
Martin Schwenke
1f0263c6d4 ctdb-takeover: Use the takeover_run_fail_callback() in more cases
Probably due to oversight, this is currently only used for the
"takeip" step.

This does consistent error handling and provides a layer of
indirection to the passed callback, so use it for "releaseip" and
"ipreallocated" steps too.

The callback data now needs to be initialised before the first
possible jump to "ipreallocated".

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:17 +02:00
Martin Schwenke
06ad1711cf ctdb-takeover: New function takeover_callback_data_init()
Abstract out the initialisation of the callback data.  Later, we'll
need to do it multiple times or move it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:17 +02:00
Martin Schwenke
a44c099e42 ctdb-takeover: Takeover callback data doesn't need a node map
It just needs to know the number of nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:16 +02:00
Martin Schwenke
d61a75fd67 ctdb-takeover: PNN can be used to index into node map
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:16 +02:00
Martin Schwenke
9056b43b96 ctdb-takeover: Drop ipreallocated fallback code
The ipreallocated control has been in CTDB for a long time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-05-13 13:47:16 +02:00
Martin Schwenke
09173f80d9 ctdb-ipalloc: Do ipreallocated even if no IP addresses can be allocated
In particular, LVS won't work at all if there are no public IP
addresses.

This is a temporary solution until a generic reconfiguration hook is
implemented.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-25 07:10:14 +02:00
Martin Schwenke
107f40abf9 ctdb-daemon: Move port filtering to server side when getting tickles
Why allocate all that memory and transfer all that data across the
socket?

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-25 07:10:14 +02:00
Martin Schwenke
951e8180a9 ctdb-daemon: Drop --single-public-ip option and related code
This has been replaced by scripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-15 05:57:18 +02:00
Martin Schwenke
d8398b04b5 ctdb-daemon: Remove implementation of CTDB_CONTROL_KILL_TCP
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
51f5faf555 ctdb-killtcp: Factor out killtcp code into separate file.
This will be used in a standalone helper.

Don't worry that the API isn't clean and opaque.  All of the code will
eventually move into the helper and will no longer be used by the
daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
f76cb52eb5 ctdb-killtcp: Factor out ctdb_killtcp()
This function knows nothing about CTDB contexts or VNNs, so it can be
used elsewhere.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
879960b74d ctdb-killtcp: Change struct ctdb_tcp_kill to store arbitrary destructor data
The destructor used in this instances needs a CTDB context and a VNN.
However, destructors used in other cases may need different data.

For this instance create a local structure to hold the required data.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
1bf494f693 ctdb-killtcp: Avoid CTDB_NO_MEMORY()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
32ea7c0d2c ctdb-killtcp: Determine the interface as soon as vnn is known
This makes restructuring the code easier.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
380c894471 ctdb-killtcp: Use the given event context directly
We don't want this code to depend on a CTDB context, so don't go
looking there for an event context.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
e4f592539d ctdb-daemon: Replace an unsafe strcpy(3) call
Tweak another strncpy(3) call.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-22 00:23:20 +01:00
Martin Schwenke
0ffa5d8d9e ctdb-daemon: Validate length of new interface names
Interface names that are too long will be truncated by strncpy(3)
later on.  It is better to validate the length of each new interface
name to ensure it will be usable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-22 00:23:20 +01:00
Martin Schwenke
aaa57fbcb3 ctdb-tools: Drop "ctdb rebalanceip"
This is undocumented and is not needed.  It was a workaround for
trying to ensure public IP addresses are properly rebalanced after
running "ctdb addip" on multiple nodes.  "ctdb reloadips" is a better
solution.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-03-10 03:34:19 +01:00
Amitay Isaacs
00b9e76904 ctdb-takeover: Inform clients when dropping all IP addresses
CTDB releases all IPs in following cases: starting up, shutting down,
node gets banned, node does not come out of recovery for a long time.
Always inform samba when CTDB releases IP addresses.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-07 08:14:21 +01:00
Amitay Isaacs
b8272d835d ctdb-takeover: Do not kill smbd processes on releasing IP
CTDB already notifies Samba with RELEASE_IP message.  Samba can take
appropriate action based on that.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-07 08:14:21 +01:00
Martin Schwenke
6695fa50ae ctdb: Use ctdb_wait_for_process_to_exit()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-02-23 07:23:18 +01:00
Volker Lendecke
7b3fb853a4 ctdb: Fix CID 1353175 Logically dead code
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-16 16:41:18 +01:00
Martin Schwenke
2deba05c58 ctdb-ipalloc: Remove most uses of struct ctdb_public_ip_list_old
Where possible, this should no longer be used.

struct ctdb_public_ip_list is a fixed size structure and introduces an
extra level of indirection.  This means one level of indirection can
be dropped for known_public_ips and available_public_ips.

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 Feb 12 08:40:21 CET 2016 on sn-devel-144
2016-02-12 08:40:21 +01:00
Martin Schwenke
53752bcf29 ctdb-ipalloc: Use goto fail to avoid repetition
This is getting unreadable...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-02-12 05:32:16 +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