The Samba-Bugzilla – Attachment 18341 Details for
Bug 15665
CTDB RADOS mutex helper misses namespace support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch from master for v4-20-test
patch (text/plain), 5.86 KB, created by
Guenther Deschner
on 2024-06-14 08:33:02 UTC
(
hide
)
Description:
patch from master for v4-20-test
Filename:
MIME Type:
Creator:
Guenther Deschner
Created:
2024-06-14 08:33:02 UTC
Size:
5.86 KB
patch
obsolete
>From 5100a4bcf21e7f3849b1b41f9ab71d19057de859 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Fri, 7 Jun 2024 14:39:37 +0530 >Subject: [PATCH 1/2] ctdb/ceph: Add optional namespace support for mutex > helper >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15665 > >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> >(cherry picked from commit d8c52995f68fe088dd2174562faee69ed1c95edd) >--- > .../utils/ceph/ctdb_mutex_ceph_rados_helper.c | 50 ++++++++++++++++--- > 1 file changed, 42 insertions(+), 8 deletions(-) > >diff --git a/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c b/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c >index 7d868a38b23..46566c97a83 100644 >--- a/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c >+++ b/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c >@@ -42,9 +42,18 @@ > > static char *progname = NULL; > >+static void usage(void) >+{ >+ fprintf(stderr, "Usage: %s <Ceph Cluster> <Ceph user> " >+ "<RADOS pool> <RADOS object> " >+ "[lock duration secs] [-n RADOS namespace]\n", >+ progname); >+} >+ > static int ctdb_mutex_rados_ctx_create(const char *ceph_cluster_name, > const char *ceph_auth_name, > const char *pool_name, >+ const char *namespace, > rados_t *_ceph_cluster, > rados_ioctx_t *_ioctx) > { >@@ -87,6 +96,10 @@ static int ctdb_mutex_rados_ctx_create(const char *ceph_cluster_name, > return ret; > } > >+ if (namespace != NULL) { >+ rados_ioctx_set_namespace(ioctx, namespace); >+ } >+ > *_ceph_cluster = ceph_cluster; > *_ioctx = ioctx; > >@@ -145,6 +158,7 @@ struct ctdb_mutex_rados_state { > const char *ceph_cluster_name; > const char *ceph_auth_name; > const char *pool_name; >+ const char *namespace; > const char *object; > uint64_t lock_duration_s; > int ppid; >@@ -295,15 +309,13 @@ static int ctdb_mutex_rados_mgr_reg(rados_t ceph_cluster) > int main(int argc, char *argv[]) > { > int ret; >+ int opt; > struct ctdb_mutex_rados_state *cmr_state; > > progname = argv[0]; > >- if ((argc != 5) && (argc != 6)) { >- fprintf(stderr, "Usage: %s <Ceph Cluster> <Ceph user> " >- "<RADOS pool> <RADOS object> " >- "[lock duration secs]\n", >- progname); >+ if (argc < 5) { >+ usage(); > ret = -EINVAL; > goto err_out; > } >@@ -325,15 +337,36 @@ int main(int argc, char *argv[]) > cmr_state->ceph_auth_name = argv[2]; > cmr_state->pool_name = argv[3]; > cmr_state->object = argv[4]; >- if (argc == 6) { >+ >+ optind = 5; >+ while ((opt = getopt(argc, argv, "n:")) != -1) { >+ switch(opt) { >+ case 'n': >+ cmr_state->namespace = optarg; >+ break; >+ default: >+ usage(); >+ ret = -EINVAL; >+ goto err_ctx_cleanup; >+ } >+ } >+ >+ if (argv[optind] != NULL) { > /* optional lock duration provided */ > char *endptr = NULL; >- cmr_state->lock_duration_s = strtoull(argv[5], &endptr, 0); >- if ((endptr == argv[5]) || (*endptr != '\0')) { >+ cmr_state->lock_duration_s = strtoull(argv[optind], &endptr, 0); >+ if ((endptr == argv[optind]) || (*endptr != '\0')) { > fprintf(stdout, CTDB_MUTEX_STATUS_ERROR); > ret = -EINVAL; > goto err_ctx_cleanup; > } >+ if (argv[++optind] != NULL) { >+ /* incorrect count or format for optional arguments */ >+ usage(); >+ ret = -EINVAL; >+ goto err_ctx_cleanup; >+ } >+ > } else { > cmr_state->lock_duration_s > = CTDB_MUTEX_CEPH_LOCK_DURATION_SECS_DEFAULT; >@@ -398,6 +431,7 @@ int main(int argc, char *argv[]) > ret = ctdb_mutex_rados_ctx_create(cmr_state->ceph_cluster_name, > cmr_state->ceph_auth_name, > cmr_state->pool_name, >+ cmr_state->namespace, > &cmr_state->ceph_cluster, > &cmr_state->ioctx); > if (ret < 0) { >-- >2.45.2 > > >From 62da4d074d1b5930252e7d179e5d4854fe846cac Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org> >Date: Fri, 7 Jun 2024 14:40:07 +0530 >Subject: [PATCH 2/2] ctdb/docs: Include ceph rados namespace support in man > page >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15665 > >Document the new optional argument to specify the namespace to be >associated with RADOS objects in a pool. > >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> > >Autobuild-User(master): Anoop C S <anoopcs@samba.org> >Autobuild-Date(master): Fri Jun 14 07:42:25 UTC 2024 on atb-devel-224 > >(cherry picked from commit 35f6c3f3d4a5521e6576fcc0dd7dd3bbcea041b2) >--- > ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml b/ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml >index f558f873d9a..93d79cea5dc 100644 >--- a/ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml >+++ b/ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml >@@ -29,12 +29,14 @@ > <manvolnum>5</manvolnum></citerefentry>: > </para> > <screen format="linespecific"> >-cluster lock = !ctdb_mutex_ceph_rados_helper [Cluster] [User] [Pool] [Object] >+cluster lock = !ctdb_mutex_ceph_rados_helper [Cluster] [User] [Pool] [Object] [Timeout] [-n Namespace] > > Cluster: Ceph cluster name (e.g. ceph) > User: Ceph cluster user name (e.g. client.admin) > Pool: Ceph RADOS pool name > Object: Ceph RADOS object name >+Timeout: Ceph RADOS lock duration in seconds (optional) >+Namespace: Ceph RADOS pool namespace (optional) > </screen> > <para> > The Ceph cluster <parameter>Cluster</parameter> must be up and running, >-- >2.45.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
anoopcs
:
review+
anoopcs
:
ci-passed+
Actions:
View
Attachments on
bug 15665
: 18341 |
18342