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

586 Commits

Author SHA1 Message Date
Amitay Isaacs
3bf753e830 ctdb-common: Add fd argument to ctdb_connection_list_read()
This makes testing easier.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Martin Schwenke
efaa7690d0 ctdb-tools: Switch to using ctdb_sock_addr_mask_from_string()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-27 05:45:21 +02:00
Martin Schwenke
15c6552aa9 ctdb-tools: All ctdb event commands to run without ctdbd
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Amitay Isaacs
26b1940162 ctdb-tools: Switch to using new event daemon tool
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:43 +02:00
Martin Schwenke
fa94a49dbb ctdb-common: Move capture_socket functions to ctdb_socket.[ch]
The system_<os>.c files contain a lot of duplication, making
maintenance difficult.  These functions are being merged into
system_socket.c and system.c.

Bring across ctdb_sys_open_capture_socket(),
ctdb_sys_close_capture_socket() and ctdb_sys_read_tcp_packet().

Remove empty system_<os>.c files.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:21 +02:00
Martin Schwenke
57834c64be ctdb-common: Rename system utility files
system_socket.[ch] will contain all the raw socket code and other
functions that use ctdb_sock_addr.  system.[ch] will contain other
platform dependent functions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:20 +02:00
Martin Schwenke
7dbf833697 ctdb: Fix some -Werror=strict-overflow issues
All quite obvious.  For the LCP2 one, we're not actually counting so
use a bool instead of an int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-04-27 06:53:16 +02:00
Martin Schwenke
dedc9eab92 ctdb-tools: No longer honour CTDB_NODES environment variable
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
a1eac09dd3 ctdb-tools: Drop testing hook from ctdb tool
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
7e08c1d24c ctdb-tools: Drop ctdb --socket 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
0045a7cfee ctdb-tools: Move handling of CTDB_SOCKET to process_command()
options.socket will go away in future.  This moves processing of
CTDB_SOCKET close to where it is used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-19 02:23:18 +01:00
Amitay Isaacs
ba7123021a ctdb-tools: Fix documentation for ctdb ping command
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-03-09 07:08:23 +01:00
Amitay Isaacs
8053f652cd ctdb-tools: Event script commands cannot be run without daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-03-09 07:08:23 +01:00
Amitay Isaacs
efe3a7279e ctdb-tools: Drop ipiface command from ctdb tool
This command is not used anywhere and also does not work for IPv6
addresses.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-03-09 07:08:23 +01:00
Amitay Isaacs
35cc786d10 ctdb-tools: Wait for ctdb daemon to go away in shutdown
This can only be done on the local node.  For remote node, exit as
soon as the control returns.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-03-09 07:08:23 +01:00
Amitay Isaacs
adde930795 ctdb-tools: Drop duplicate output from dbstatistics
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-10-23 15:41:10 +02:00
Amitay Isaacs
f4f5e7d2ad ctdb-protocol: Add req_tunnel counts to ctdb statistics
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-10-10 11:45:19 +02:00
Martin Schwenke
a0051b80d5 ctdb-tools: Replace parse_ip() -> ctdb_sock_addr_from_string()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-10-05 05:19:21 +02:00
Martin Schwenke
3ee9822f9d ctdb-tools: Replace parse_ip_port() -> ctdb_sock_addr_from_string()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-10-05 05:19:21 +02:00
Martin Schwenke
96e3ea5462 ctdb-tools: Use ctdb_connection_list_read()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-10-05 05:19:21 +02:00
Volker Lendecke
e12ed08bd5 ctdb: Centralize ctdb_version_string
Whenever the current git hash changes, we recompile ctdb.c and
ctdb_daemon.c. As both have quite a few warnings with -Wall, this
makes it quite difficult to see the real warnings that pop up during
development. Centralize the ctdb_version_string to just a single file
without warnings.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-09-26 09:37:13 +02:00
Amitay Isaacs
1c472dffd4 ctdb-tool: Update process-exists command to pass optional srvid
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13042

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-09-21 08:53:26 +02:00
Martin Schwenke
93668f5026 ctdb-protocol: Optionally print port for address printing functions
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-09-19 13:30:26 +02:00
Martin Schwenke
3783b66fb3 ctdb-build: Split protocol-util as a separate subsystem
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-09-19 13:30:26 +02:00
Martin Schwenke
53ae91a4f7 ctdb-tools: Drop monitoring-related ctdb commands
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-09-14 14:49:15 +02:00
Amitay Isaacs
83039d6a5c ctdb-tools: Fix CID 1414746
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-09-09 10:53:10 +02:00
Amitay Isaacs
eb16d4a61c ctdb-tools: Use ssize_t instead of int for checking the status of read()
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-09-09 10:53:10 +02:00
Martin Schwenke
d6b77c3033 ctdb-tools: Remove broken natgwlist command
The replacement was documented for Samba 4.5, so this is not worth fixing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-09-01 00:13:06 +02:00
Amitay Isaacs
676df8770b ctdb-protocol: Fix marshalling for ctdb_rec_buffer
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-08-30 14:59:23 +02:00
Amitay Isaacs
25217a9bb5 ctdb-protocol: Fix marshalling for ctdb_ltdb_header
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-08-30 14:59:22 +02:00
Amitay Isaacs
31c2d0af04 ctdb-tools: Drop check_srvids command from ctdb tool
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-08-14 09:01:21 +02:00
Amitay Isaacs
d74eb9577d ctdb-tools: Allow attach for replicated databases
... and update the output from various database query commands.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-29 10:34:27 +02:00
Amitay Isaacs
8ee7cc6bdb ctdb-client: Move sync API to a separate header
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-07 16:05:27 +02:00
Amitay Isaacs
be0a8d6c5f ctdb-client: Move ctdb_ctrl_modflags() to ctdb tool
This function is only required by the tool.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-07 16:05:26 +02:00
Amitay Isaacs
8e3ed87cac ctdb-client: Add async api for detaching a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-07 16:05:26 +02:00
Amitay Isaacs
025ebc0fc8 ctdb-tools: Use traverse api to re-implement ctdb catdb command
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-07 16:05:26 +02:00
Amitay Isaacs
6894158103 ctdb-client: Rename ctdb_db_travese to ctdb_db_traverse_local
This function only traverses the database on local node.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-07 16:05:26 +02:00
Martin Schwenke
1d10c8e9e6 ctdb-tools: "ctdb nodestatus" should only display header for "all"
The "Number of nodes:" header should only be displayed when "all" is
specified.  This is how the command behaved in Samba <= 4.4.

Printing the number of nodes is not helpful and is rather confusing in
the default case where only the status of the current node is printed.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-05-26 01:14:17 +02:00
Martin Schwenke
a600d467e2 ctdb-tools: Stop "ctdb nodestatus" from always showing all nodes
Exit code should only reflect current or specified nodes too.

Drop an unwanted call to get_nodemap() that overwrites the previously
calculated node map.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-05-26 01:14:17 +02:00
Andreas Schneider
8ebe9f8551 ctdb: Do not leak fd handle in control_restoredb()
Found by covscan.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Feb 17 18:43:16 CET 2017 on sn-devel-144
2017-02-17 18:43:15 +01:00
Martin Schwenke
7d1b39cf80 ctdb-client: Add available-only option public IP fetching
Update tool accordingly.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Amitay Isaacs
b2d1cea1f3 ctdb-tool: Drop disablescript, enablescript and eventscript commands
These commands are now replaced with ctdb event ...

ctdb scriptstatus is maintained for backward compatibility.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
a652b5c351 ctdb-tool: Add new command "event" to ctdb tool
This command covers all the commands to event daemon.

  ctdb event run <event>
  ctdb event status [<event>] [lastrun|lastfail|lastpass]
  ctdb event script list
  ctdb event script enable <script>
  ctdb event script disable <script>

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
b2b8f1eaed ctdb-tool: Improve error reporting if helper execution fails
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
590acdc529 ctdb-tool: Allow passing multiple command-line arguments to helper
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Martin Schwenke
cd20ced3fb ctdb-tools: Don't trust non-hosting nodes in "ctdb ip all"
Redundant RELEASE_IPs gives nodes a preview of where an IP address
will move to.  However, if the associated TAKEOVER_IP fails then the
node will actually be unhosted.

This is similar to commit 77a29b3733.

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

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 16 12:32:02 CET 2016 on sn-devel-144
2016-12-16 12:32:02 +01:00
Martin Schwenke
2514a9cd17 ctdb-tools: Print PNN as int in "ctdb ip -v"
Otherwise it prints 4294967295 for the PNN.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00
Martin Schwenke
a6e5b6abe9 ctdb-tools: Skip GET_PUBLIC_IP_INFO for unassigned addresses
The GET_PUBLIC_IP_INFO control fails for unassigned addresses because
PNN is CTDB_UNKNOWN_PNN.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00
Martin Schwenke
acaa4407ca ctdb-tools: Fix memory corruption in "ctdb ip -v"
First argument to talloc_asprintf_append() is the string being
appended to, not a talloc context.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00
Martin Schwenke
7bcef2f0e2 ctdb-tools: Fix sort order of "ctdb ip" output
The new hash-table-based method of merging the IP information does not
sort, whereas the RB-tree method implicitly sorted.  This probably
only really matters for the "all" case, but sort regardless to ensure
consistent output format.

Sorting has to be done here instead of when printing to ensure
consistency between ip[] and ipinfo[].

No longer reverse the sort order.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00