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

1058 Commits

Author SHA1 Message Date
Martin Schwenke
cf866d66aa ctdb-scripts: Drop unused functions
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:15 +02:00
Martin Schwenke
2f33b18d84 ctdb-script: Drop CTDB_MANAGED_SERVICES configuration option
This seems never to have caught on so reduce complexity.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:15 +02:00
Martin Schwenke
3451a03611 ctdb-scripts: Drop CTDBD_CONF internal test variable
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): Mon Mar 19 07:32:22 CET 2018 on sn-devel-144
2018-03-19 07:32:22 +01:00
Martin Schwenke
6cf861a544 ctdb-scripts: Drop CTDB_NODES configuration option
Tests now deviate from the compile-time default by setting CTDB_BASE.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-19 02:23:20 +01:00
Martin Schwenke
b1fcb0a129 ctdb-scripts: Drop CTDB_PUBLIC_INTERFACE configuration option
The interface must always be specified in the public addresses file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-19 02:23:19 +01:00
Martin Schwenke
6ecddd4f72 ctdb-scripts: Drop CTDB_PUBLIC_ADDRESSES configuration option
This option adds a lot of unnecessary complexity to scripts.
Configuration should go in $CTDB_BASE, either directly or via a
symlink, so simplify by using the default location.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-19 02:23:19 +01:00
Martin Schwenke
a757182134 ctdb-scripts: Drop 10.external event script
This was added for a vendor who decided not to use it.  It is almost
certainly unused by anyone.  If anyone really needs it then it is in
the git history.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-19 02:23:19 +01:00
Martin Schwenke
81b57fa544 ctdb-scripts: Drop CTDB_SOCKET configuration option
Use environment variables for test-only options.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-19 02:23:18 +01:00
Martin Schwenke
3df3678101 ctdb-scripts: Drop CTDB_EVENT_SCRIPT_DIR configuration option
Event scripts live in a standard place.

For testing, CTDB_BASE is modified.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-19 02:23:17 +01:00
Martin Schwenke
0ee7b8a669 ctdb-scripts: Drop CTDB_PIDFILE configuration option
Use environment variables for test-only options.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-19 02:23:17 +01:00
Martin Schwenke
52cdb03c65 ctdb-scripts: Drop PID file argument from wrapper
Use the default compile-time PID file.

Use a CTDB_PIDFILE environment variable when testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:25 +01:00
Martin Schwenke
a2c6c98302 ctdb-scripts: Drop init script PID directory backward compatibility
This tries to be backward compatible with very old versions of CTDB,
so don't bother.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
0e5d537323 ctdb-scripts: Don't create directory for PID file
This is already created by installation and/or packaging.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
bf250fe595 ctdb-scripts: Drop unnecessary complexity from wrapper
All of this logic was necessary when ctdbd did poor PID file and
socket handling.  Those things are now solid, so remove this
unnecessary logic.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
a821306ec3 ctdb-scripts: Drop broken wrapper code that uses PID
The code has been broken since commit
4b652c1527.

If ctdbd isn't all the way up in time just make a basic attempt to
shut it down.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
b416ed72d4 ctdb-scripts: Simplify the names of NFS fail counter files
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
bcadab7149 ctdb-scripts: Move failure counters to the service state directory
Scripts that use these counters must call ctdb_setup_state_dir().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
e6aae12ba2 ctdb-scripts: Move the reconfigure flag to the script state directory
Scripts that use these functions must call ctdb_setup_state_dir().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
ef0962acf0 ctdb-scripts: Drop unused function ctdb_setup_service_state_dir()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
eed0e3f6d7 ctdb-scripts: Use ctdb_setup_state_dir()
Replace all uses of ctdb_setup_service_state_dir() by
ctdb_setup_state_dir().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
fac6d23d27 ctdb-scripts: Factor out function ctdb_setup_state_dir()
This allows state directories for scripts other than services.
ctdb_setup_state_dir() takes 2 mandatory arguments.

Unlike ctdb_setup_service_state_dir(), this does not print the
directory name but sets a global variable.  The intention is to go
back to a more sensible style of usage.

This will require a shellcheck directive before the first use, such
as:

  # Set by ctdb_setup_state_dir
  # shellcheck disable=SC2154
  foo="${script_state_dir}/bar"

An alternative would be something like the following, which tricks
shellcheck into believing the variable is set:

  ctdb_setup_state_dir "service" "foo"
  # Shellcheck
  script_state_dir="$script_state_dir"

However, this is more cryptic.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:24 +01:00
Martin Schwenke
2089961346 ctdb-scripts: Move script state to its own directory
Don't use the same directory as temporary databases.

Make associated test consistent.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-09 07:08:23 +01:00
Martin Schwenke
95888c8e1a ctdb-scripts: Clean up statd-callout
This means there will be 2 loops reading the data but the code flow is
much more obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-01 19:39:15 +01:00
Martin Schwenke
2ad1604c2b ctdb-scripts: Avoid no-op "ctdb ptrans" call
This causes unnecessary g_lock activity and overhead.

This could be optimised in ctdb.c:control_ptrans().  However, that
makes the code more complex.  Let's only do that if we get more
potentially no-op uses.

Note no optimisation is needed in the "notify" case because there is
already an early exit if there are no items.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-01 19:39:15 +01:00
Martin Schwenke
ca315203be ctdb-common: Drop debugging variable CTDB_EXTERNAL_TRACE
This was an attempt to debug an unexpected situation.  It never
triggered, so delete it and all supporting code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-01 19:39:15 +01:00
Martin Schwenke
c8dfd4fe5a ctdb-scripts: Add default for public addresses file where missing
This makes it consistent with the rest of the script code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-01 19:39:14 +01:00
Martin Schwenke
0519c513ad ctdb-scripts: Do not use ctdb_service_reconfigure() for policy routing
This is an unconditional reconfiguration so skip the unnecessary
logic.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-01 19:39:14 +01:00
Mathieu Parent
a653b62ad7 systemd: Add documentation to Unit files
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12402

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2018-01-14 17:38:26 +01:00
Martin Schwenke
4b652c1527 ctdb-scripts: Don't bother checking PID file when starting ctdbd
This is an optimisation that can cause incorrect results.  If ctdbd
was killed and there is a stale PID file then this will often cause
"CTDB exited during initialisation".  The wrapper reads the old PID
from the PID file, finds the PID gone, complains and exits.

It is better to drop this code and finally get this right.  If ctdbd
does exit early then it will take CTDB_STARTUP_TIMEOUT (default 10)
seconds before the wrapper fails.  That's not too bad...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-11-07 03:53:27 +01:00
Amitay Isaacs
7720ca0729 ctdb-common: Ignore event scripts with multiple '.'s
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13070

This avoids running event script copies left by a package manager.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-10-18 06:20:18 +02:00
Martin Schwenke
1aff2f8746 ctdb-scripts: Switch ctdb_check_unix_socket() to use ss
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-09-12 12:23:19 +02:00
Martin Schwenke
ff635f90ed ctdb-scripts: Clean up ctdb_check_unix_socket()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-09-12 12:23:19 +02:00
Martin Schwenke
b71becc150 ctdb-scripts: Ignore shellcheck SC2181 warning (use of $?)
Given the size of the command substitutions it would be less clear to
embed the assignments and substitutions inside a conditional.  It is
clearer if the exit code is checked afterwards.

However, do fix some untidy uses of != instead of -ne when comparing
with $?.  Make the code easier to understand by reversing the logic
and using -eq and ||.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-08-14 05:15:25 +02:00
Martin Schwenke
db014a5129 ctdb-scripts: Avoid shellcheck warning SC2188 (redirect without command)
This makes the code look deliberate instead like something has been
accidentally omitted.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-08-14 05:15:25 +02:00
Martin Schwenke
507c81a739 ctdb-scripts: Fix a typo
This is a regression introduced in commit
e847ec3ae2

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-07-23 15:38:10 +02:00
Martin Schwenke
4e68d377a7 ctdb-docs: Update documentation of ipreallocated event
This was out of date due to the removal of service_check_reconfigure()
and similar.

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): Thu Jul 13 17:57:11 CEST 2017 on sn-devel-144
2017-07-13 17:57:11 +02:00
Ralph Boehme
2bce9cb72f ctdb: enable mutexes for volatile TDBs by default
Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-07-12 09:01:17 +02:00
Anoop C S
539714ef19 ctdb-scripts: Fix inline comments in 10.interface
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Jul 11 11:45:04 CEST 2017 on sn-devel-144
2017-07-11 11:45:04 +02:00
Amitay Isaacs
2fa069e870 ctdb-scripts: Don't send empty argument string to logger
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12856

This stops logger reading from stdin.

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): Sat Jun 24 14:37:48 CEST 2017 on sn-devel-144
2017-06-24 14:37:48 +02:00
Martin Schwenke
dac075129b ctdb-scripts: Compact server-end TCP connection killing output
When thousands of connections are being killed the logs are flooded
with information about connections that should be killed.  When some
connections are not killed then the number not killed is printed.
This is the wrong way around!  When debugging "fail-back" problems, it
is important to know details of connections that were *not* killed.
It is almost never important to know the full list of all connections
that were *supposed* to be killed.

Instead, print a summary showing how many connections of the total
were killed.  If any were not killed then print a list of remaining
connections.

Update unit tests: infrastructure for fake TCP connections, existing,
test cases, add new test cases.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-06-13 09:12:19 +02:00
Martin Schwenke
22f2068d45 ctdb-scripts: NFS call-out failures should cause event failure
Failures in startup/shutdown/releaseip/takeip are currently
incorrectly ignored.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12837

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-06-13 09:12:19 +02:00
Martin Schwenke
5e7ae1b1e2 ctdb-scripts: Initialise CTDB_NFS_CALLOUT in statd-callout
Some configurations may set CTDB_NFS_CALLOUT to the empty string.
They may do this if they allow a choice of NFS implementations.  In
this case the default call-out for Linux kernel NFS should be used.
However, statd-callout does not call nfs_callout_init() to set the
default.  Therefore, statd-callout is unable to restart the lock
manager, so the grace period is never entered.

statd-callout must call nfs_callout_init() before trying to restart
the lock manager.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12589

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): Thu Feb 16 09:21:03 CET 2017 on sn-devel-144
2017-02-16 09:21:03 +01:00
Martin Schwenke
8eafa2c5df ctdb-scripts: Avoid log noise when NFS checks directory is empty
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-20 15:01:13 +01:00
Martin Schwenke
f9368f8e12 ctdb-scripts: Fix regression when cleaning up routing table IDs
Commit 0ca00267cd removed explicit
continuations in strings for awk programs.  In one case this causes a
disconnect between condition and action, where an implicit
continuation does not work.  This results in duplicate lines in the
rt_tables file.

Move the opening brace for the action to make the implicit
continuation work as expected.

An alternative would be to revert the removal of the explicit
continuations and add shellcheck tags.  However, that doesn't mean
that an author of future code will necessarily use explicit
continuations, so the same mistake might still be make in the future.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12516

Reported-by: Barry Evans <bevans@pixitmedia.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-17 02:20:16 +01:00
Martin Schwenke
5e00a6b346 ctdb-scripts: Fix remaining uses of "ctdb gratiousarp"
This changed to "ctdb gratarp" some time ago but the scripts were
never updated.

Fix the documentation for the ctdb tool too.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12512

Reported-by: Ralph Böhme <slow@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-17 02:20:16 +01:00
Martin Schwenke
ec3415e583 ctdb-scripts: Drop configuration variable CTDB_SCRIPT_DEBUGLEVEL
The debug() function, which is the only user of this variable, is no
longer used.  It is also dropped.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
a9870538c9 ctdb-scripts: Drop function ctdb_check_command()
This is only used in 1 place, so just inline the check.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
c8249dfa0e ctdb-scripts: Inline simple uses of service_start() and service_stop()
This makes the scripts more readable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
e847ec3ae2 ctdb-scripts: Remove ctdb_service_start() and ctdb_service_stop()
They contain too much unnecessary complexity, some of which was used
to support CTDB_SERVICE_AUTOSTARTSTOP.

Also removed unused functions for service management.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
a9e3b63538 ctdb-scripts: Drop unnecessary function ctdb_check_tcp_init()
The flag this sets is no longer used by ctdb_check_tcp_ports()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00