On Sat, 2018-10-06 at 09:11 +0200, Stefan Kooman wrote:
Quoting Stefan Kooman (stefan(a)bit.nl):
> Quoting Jeff Layton (jlayton(a)redhat.com):
> > This is already implemented via a "namespace" parameter to RADOS_KV
in
> > nfs-ganesha 2.7. It's not implemented in RADOS_URLS yet, but it
wouldn't
> > be too hard to do.
It's nice to have your (cluster) config in a centralized location so you
know for sure all daemons are using the same config. So yeah, would be
nice to have this support for RADOS_URLS too.
If I understand you correctly, you have the possibility to use one
namespace, which is then used for *both* librados as well as libcephfs,
right?
Is it possible to use the "namespace" parameter in the ceph.conf for
use with rados_ng? Would this work?
...
RADOS_KV
{
# Path to a ceph.conf file for this cluster.
# Ceph_Conf = /etc/ceph/ceph.conf;
# The recoverybackend has its own ceph client. The default is to
# let libcephfs autogenerate the userid. Note that RADOS_KV block does
# not have a setting for Secret_Access_Key. A cephx keyring file must
# be used for authenticated access.
# UserId = "ganesharecov";
# Pool ID of the ceph storage pool that contains the recovery objects.
# The default is "nfs-ganesha".
# pool = "nfs-ganesha";
# Set the RADOS namespace to use within the pool (default is NULL)
namespace = your-name-space-here
# Set the object id of the grace database RADOS object (default is
"grace")
oid = grace
}
Thanks,
Stefan
P.s. It would be a waste if nobody is using these useful features
because they don't know of their existence / know how to use it.
Draft patch to add this to RADOS_URLS follows. We'll still need to
update the docs but if you want to help test this, then that would be
good:
------------------------------8<---------------------------------
[PATCH] RADOS_URLS: add a namespace parameter to the config block
...and set it on the ioctx.
Change-Id: I076f43ec3ced206b787273455fd2e4e566bc80a2
Signed-off-by: Jeff Layton <jlayton(a)redhat.com>
---
src/config_parsing/conf_url_rados.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/config_parsing/conf_url_rados.c b/src/config_parsing/conf_url_rados.c
index 692e4cc348ec..2baad0a4ed17 100644
--- a/src/config_parsing/conf_url_rados.c
+++ b/src/config_parsing/conf_url_rados.c
@@ -38,6 +38,8 @@ static struct rados_url_parameter {
char *ceph_conf;
/** Userid (?) */
char *userid;
+ /** Namespace */
+ char *namespace;
} rados_url_param;
static struct config_item rados_url_params[] = {
@@ -45,6 +47,8 @@ static struct config_item rados_url_params[] = {
rados_url_parameter, ceph_conf),
CONF_ITEM_STR("userid", 1, MAXPATHLEN, NULL,
rados_url_parameter, userid),
+ CONF_ITEM_STR("namespace", 1, NAME_MAX, NULL,
+ rados_url_parameter, namespace),
CONFIG_EOL
};
@@ -262,6 +266,8 @@ static int cu_rados_url_fetch(const char *url, FILE **f, char **fbuf)
cu_rados_url_shutdown();
goto out;
}
+ rados_ioctx_set_namespace(io_ctx, rados_url_param.namespace);
+
do {
int nread, wrt, nwrt;
--
2.17.1