From: John Mulligan Date: Tue, 4 Mar 2025 20:43:52 +0000 (-0500) Subject: ctdb/ceph: add option to not register mutex rados helper as a service X-Git-Tag: tevent-0.17.0~529 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a713fdf76c7b5d16e686d8b17b24bdc70ae3208;p=thirdparty%2Fsamba.git ctdb/ceph: add option to not register mutex rados helper as a service 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 Reviewed-by: Guenther Deschner Reviewed-by: Anoop C S --- diff --git a/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c b/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c index 46566c97a83..7dd6ea1e889 100644 --- a/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c +++ b/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c @@ -311,6 +311,7 @@ int main(int argc, char *argv[]) int ret; int opt; struct ctdb_mutex_rados_state *cmr_state; + bool skip_registering = false; progname = argv[0]; @@ -339,11 +340,14 @@ int main(int argc, char *argv[]) cmr_state->object = argv[4]; optind = 5; - while ((opt = getopt(argc, argv, "n:")) != -1) { + while ((opt = getopt(argc, argv, "n:R")) != -1) { switch(opt) { case 'n': cmr_state->namespace = optarg; break; + case 'R': + skip_registering = true; + break; default: usage(); ret = -EINVAL; @@ -439,10 +443,12 @@ int main(int argc, char *argv[]) goto err_ctx_cleanup; } - ret = ctdb_mutex_rados_mgr_reg(cmr_state->ceph_cluster); - if (ret < 0) { - fprintf(stderr, "Failed to register with ceph-mgr\n"); - /* ignore: ceph-mgr service registration is informational */ + if (!skip_registering) { + ret = ctdb_mutex_rados_mgr_reg(cmr_state->ceph_cluster); + if (ret < 0) { + fprintf(stderr, "Failed to register with ceph-mgr\n"); + /* ignore: ceph-mgr service registration is informational */ + } } ret = ctdb_mutex_rados_lock(cmr_state->ioctx, cmr_state->object,