summaryrefslogtreecommitdiff
path: root/ctdb/utils
AgeCommit message (Collapse)AuthorFilesLines
2025-09-25ctdb-pmda: Do not directly support CTDB_SOCKET environment variableMartin Schwenke1-6/+7
Always use whatever CTDB uses in the current environment. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15921 Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-09-13ctdb: Fix redefinitoin of pmdaResultAndreas Schneider1-1/+1
../../ctdb/utils/pmda/pmda_ctdb.c:52:9: warning: 'pmdaResult' redefined 52 | #define pmdaResult pmResult | ^~~~~~~~~~ In file included from ../../ctdb/utils/pmda/pmda_ctdb.c:35: /usr/include/pcp/pmda.h:30:9: note: this is the location of the previous definition 30 | #define pmdaResult pmResult_v2 | ^~~~~~~~~~ BUG: https://bugzilla.samba.org/show_bug.cgi?id=15904 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Sat Sep 13 08:12:42 UTC 2025 on atb-devel-224
2025-09-08ctdb: fix build against PCP 7.0.0Alexander Bokovoy1-1/+10
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15904 Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Mon Sep 8 04:47:37 UTC 2025 on atb-devel-224
2025-03-14ctdb/ceph: add option to not register mutex rados helper as a serviceJohn Mulligan1-5/+11
Add a new `-R` option (no-register) that will skip the step of registering the lock helper as a ceph service. Ceph will treat the lock helper more like a typical rados client. The `ceph -s` output will not have ctdb listed under the services section (previous output): ``` cluster: id: 5b81295a-fdec-11ef-a18f-525400220000 health: HEALTH_WARN 1 stray daemon(s) not managed by cephadm services: mon: 3 daemons, quorum ceph0,ceph1,ceph2 (age 6m) mgr: ceph0.mkodry(active, since 85s) mds: 1/1 daemons up osd: 6 osds: 6 up (since 52m), 6 in (since 52m) ctdb: 1 daemon active (1 hosts) ``` Most importantly, this will avoid triggering health warnings from ceph when cephadm discovers services that it did not create (or directly manage) listed in the cluster. Something we looked into hiding on the cephadm side but proved quite tricky so it's better off not to try this registration on cephadm managed clusters in the first place. In addition, the `1 daemon active` bit is somewhat confusing when you have a N (N>1) node ctdb cluster managed by cephadm. The fact that the mutex helper only runs on one of those nodes at once is a low level implementation detail that most users do not need and I assume could confuse. Signed-off-by: John Mulligan <jmulligan@redhat.com> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-03-05ctdb-utils: Fix incorrect FSF addressMartin Schwenke6-12/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15820 Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Wed Mar 5 03:40:15 UTC 2025 on atb-devel-224
2024-08-29ctdb-scripts: Use nfs-utils' sm-notify instead of CTDB's smnotifyMartin Schwenke2-172/+0
CTDB's smnotify does not support IPv6 and is difficult to maintain. So, create directories of files and pass them to NFS util's sm-notify. There is an implied change here, because NFS utils sm-notify stopped sending IP addresses as mon_name back in 2010: http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commitdiff;h=900df0e7c0b9006d72d8459b30dc2cd69ce495a5 This will change advice given in the wiki to use a hostname for the cluster with round-robin DNS, since this is what is best supported. Another behavioural change is that sm-notify only sends "up" notifications with an odd state. Signed-off-by: Martin Schwenke <martin@meltin.net> Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2024-06-14ctdb/ceph: Add optional namespace support for mutex helperGünther Deschner1-8/+42
RADOS objects within a pool can be associated to a namespace for logical separation. librados already provides an API to configure such a namespace with respect to a context. Make use of it as an optional argument to the helper binary. Pair-Programmed-With: Anoop C S <anoopcs@samba.org> Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Günther Deschner <gd@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2023-07-19ctdb-utils: Drop unused scsi_io.c source fileMartin Schwenke1-1152/+0
It will be in the git history if we ever decide to use SCSI persistent reservations as a cluster lock. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2023-03-24ctdb:utils: Fix code spellingAndreas Schneider2-4/+4
Best reviewed with: `git show --word-diff` Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Mar 24 07:57:37 UTC 2023 on atb-devel-224
2023-03-24ctdb:utils: Remove trailing whitespaces in scsi_io.cAndreas Schneider1-10/+10
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2022-01-17ctdb-config: [cluster] recovery lock -> [cluster] cluster lockMartin Schwenke3-5/+5
Retain "recovery lock" and mark as deprecated for backward compatibility. Some documentation is still inconsistent. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-01-10ctdb:utils: Improve error handling of hex_decode()Pavel Filipenský1-6/+18
This has been found by covscan and make analyzers happy. Pair-programmed-with: Andreas Schneider <asn@samba.org> Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-07-20utils: Avoid pylint warningMartin Schwenke1-2/+2
pylint warns: Use lazy % formatting in logging functions Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Tue Jul 20 05:29:18 UTC 2021 on sn-devel-184
2021-07-20utils: Reformat lines that are longer than 80 columnsMartin Schwenke1-4/+6
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
2021-07-20utils: Tweak exception handling to stop flake8 complainingMartin Schwenke1-2/+2
Don't bother with "as e" to avoid warning about unused variable. Don't use bare "except:" (though pylint still complains about this version). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
2021-07-20utils: Simplify log level logic, drop global variableMartin Schwenke1-9/+9
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
2021-07-20utils: Inline defaults and help stringsMartin Schwenke1-17/+11
Removes an unnecessary level of indirection: defaults and help strings are now where they are expected. Also removes some global variables. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
2021-07-20utils: Move argument processing into function and call from main()Martin Schwenke1-26/+26
Removes the need for the global variables currently associated with this processing. Also removes unnecessarily double-handling the defaults, which are assigned to the global variables and set via add_argument(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
2021-07-20utils: Reorder imports so that standard imports are firstMartin Schwenke1-1/+2
Avoids numerous pylint warnings. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
2021-07-20utils: Clean up ctdb_etcd_lock using autopep8Martin Schwenke1-126/+134
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
2021-07-20utils: Use Python 3Martin Schwenke1-1/+1
Due to the number of flake8 and pylint warnings it is unclear if the source has Python 3 incompatibilities. These will be cleaned up in subsequent commits. Signed-off-by: "L.P.H. van Belle" <belle@bazuin.nl> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
2021-05-28ctdb-utils: Add tdb_mutex_check utilityAmitay Isaacs1-0/+148
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-09-24ctdb/test_ceph_rados_reclock: check for service registrationDavid Disseldorp1-1/+7
Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Thu Sep 24 00:52:42 UTC 2020 on sn-devel-184
2020-09-23ctdb/ceph: register recovery lock holder with ceph-mgrDavid Disseldorp1-1/+32
The Ceph Manager's service map is useful for tracking the status of Ceph related services. By registering the CTDB recovery lock holder, Ceph storage administrators can more easily identify where and when a CTDB cluster is up and running. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2019-10-31ctdb/utils/smnotify/smnotify.c: typo fixesBjörn Jacke1-5/+5
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-31ctdb/utils/scsi_io/scsi_io.c: typo fixesBjörn Jacke1-10/+10
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-09-17ctdb-utils: CID 1273087 - Resource leakMartin Schwenke1-4/+8
Ensure that p is not leaked. This is a test program and the program exits anyway. No need to backport. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-06-05ctdb-utils: Fix CID 1125558 (Unchecked return value from library)Martin Schwenke1-1/+7
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 Jun 5 12:09:56 UTC 2019 on sn-devel-184
2019-06-05ctdb-utils: Avoid warning about unused valueMartin Schwenke1-0/+4
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-03-01ctdb_mutex_ceph_rados_helper: revert strtoull_err() usageDavid Disseldorp1-6/+2
Compilation currently fails, as ctdb_mutex_ceph_rados_helper doesn't include or link against the samba-util library. Revert back to the previous strtoull() behaviour, which works fine. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Mar 1 18:34:18 UTC 2019 on sn-devel-144
2019-03-01ctdb-utils: Use wrapper for string to integer conversionSwen Schillig1-2/+6
In order to detect an value overflow error during the string to integer conversion with strtoul/strtoull, the errno variable must be set to zero before the execution and checked after the conversion is performed. This is achieved by using the wrapper function strtoul_err and strtoull_err. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Böhme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-08-09ctdb: add expiry test for ctdb_mutex_ceph_rados_helperDavid Disseldorp1-1/+56
Kill the ctdb_mutex_ceph_rados_helper with SIGKILL and then confirm that the lock is automatically released following expiry. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Thu Aug 9 16:26:36 CEST 2018 on sn-devel-144
2018-08-09ctdb_mutex_ceph_rados_helper: fix deadlock via lock renewalsDavid Disseldorp1-9/+98
RADOS locks without expiry persist indefinitely. This results in CTDB deadlock during failover if the recovery master dies unexpectedly, as subsequently elected recovery master nodes can't obtain the recovery lock. Avoid deadlock by using a lock expiration time (10s by default), and renewing it periodically. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13540 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-09ctdb_mutex_ceph_rados_helper: rename timer_ev to ppid_timer_evDavid Disseldorp1-12/+13
In preparation for adding a lock refresh timer. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-09ctdb_mutex_ceph_rados_helper: use talloc destructor for cleanupDavid Disseldorp1-27/+24
Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-09ctdb_mutex_ceph_rados_helper: Set SIGINT signal handlerSamuel Cabrero1-4/+15
Set a handler for SIGINT to release the lock. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17ctdb-docs: Add ctdb.conf(5) cross references and documentation tweaksMartin Schwenke1-3/+3
Minor updates to other manual pages for compatibility. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-05ctdb/pmda: fix num_recoveries metric storeDavid Disseldorp1-1/+1
The num_recoveries metric is declared as PM_TYPE_U32, so should be used accordingly. Suggested-by: Nathan Scott <nathans@redhat.com> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2018-03-02ctdb-pmda: Use modified API in pcp library 4.0Amitay Isaacs1-9/+21
Support backward compatibility by checking for __pmID_int type, which was previously in <pcp/impl.h>. In the new version, this type is not defined anymore and there is no need to include <pcp/impl.h>. 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 2 00:38:52 CET 2018 on sn-devel-144
2017-06-07ctdb-client: Move sync API to a separate headerAmitay Isaacs1-0/+1
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-02-24ctdb-utils: CID 1343331 Unchecked return value from library (CHECKED_RETURN)Martin Schwenke1-1/+1
Explicitly ignore keyboard input in ping_pong. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-09ctdb: add test script for ctdb_mutex_ceph_rados_helperDavid Disseldorp1-0/+151
This standalone test script performs the following: - using ctdb_mutex_ceph_rados_helper, take a lock on the Ceph RADOS object a CLUSTER/$POOL/$OBJECT using the Ceph keyring for $USER + confirm that lock is obtained, via ctdb_mutex_ceph_rados_helper "0" output - check RADOS object lock state, using the "rados lock info" command - attempt to obtain the lock again, using ctdb_mutex_ceph_rados_helper + confirm that the lock is not successfully taken - tell the first locker to drop the lock and exit, via SIGTERM - once the first locker has exited, attempt to get the lock again + confirm that this attempt succeeds Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Dec 9 07:59:33 CET 2016 on sn-devel-144
2016-12-09ctdb: cluster mutex helper using Ceph RADOSDavid Disseldorp1-0/+328
ctdb_mutex_ceph_rados_helper implements the cluster mutex helper API atop Ceph using the librados rados_lock_exclusive()/rados_unlock() functionality. Once configured, split brain avoidance during CTDB recovery will be handled using locks against an object located in a Ceph RADOS pool. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-09ctdb-build: move ctdb_etcd_lock to utils/etcdDavid Disseldorp1-0/+208
Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-10-17ctdb: Add a required includeVolker Lendecke1-0/+1
exit(3) is defined in stdlib.h Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2016-08-12ctdb-pmda: Use 1s timeout for fetching statisticsAmitay Isaacs1-2/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12138 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-03ctdb-utils: Fix CID 1297451 Explicit null dereferenced (FORWARD_NULL)Martin Schwenke1-1/+3
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-22ctdb-pcp-pmda: Reimplement using new client APIAmitay Isaacs1-95/+19
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 Jul 22 10:31:57 CEST 2016 on sn-devel-144
2016-07-05ctdb-pmda: CTDB client code does not require ctdb->methodsAmitay Isaacs1-4/+0
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-06-08ctdb-daemon: Use lib/util functions instead of redefinitionsAmitay Isaacs1-1/+2
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>