]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb/ceph: add option to not register mutex rados helper as a service
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 4 Mar 2025 20:43:52 +0000 (15:43 -0500)
committerAnoop C S <anoopcs@samba.org>
Fri, 14 Mar 2025 08:44:36 +0000 (08:44 +0000)
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>
ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c

index 46566c97a8392960a5b706c930f8c578f6718365..7dd6ea1e8896c26a1948f5c5d27081bf10e28c62 100644 (file)
@@ -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,