0001-allow-a-clientid-to-be-specified-to-set-the-rados-cl.patch (2,703 bytes)
From b7134bdb28e92d97c1604e05ad9a2cb167a1b23a Mon Sep 17 00:00:00 2001
From: mr245 <mr245@bath.ac.uk>
Date: Wed, 10 Feb 2016 22:49:20 +0000
Subject: [PATCH] allow a clientid= to be specified to set the rados client id
used to authenticate to ceph
---
src/stored/backends/rados_device.c | 9 ++++++++-
src/stored/backends/rados_device.h | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/stored/backends/rados_device.c b/src/stored/backends/rados_device.c
index da6b64a..40309ac 100644
--- a/src/stored/backends/rados_device.c
+++ b/src/stored/backends/rados_device.c
@@ -37,6 +37,7 @@
enum device_option_type {
argument_none = 0,
argument_conffile,
+ argument_clientid,
argument_poolname,
argument_striped,
argument_stripe_unit,
@@ -52,6 +53,7 @@ struct device_option {
static device_option device_options[] = {
{ "conffile=", argument_conffile, 9 },
{ "poolname=", argument_poolname, 9 },
+ { "clientid=", argument_clientid, 9 },
#ifdef HAVE_RADOS_STRIPER
{ "striped", argument_striped, 7 },
{ "stripe_unit=", argument_stripe_unit, 11 },
@@ -104,6 +106,10 @@ int rados_device::d_open(const char *pathname, int flags, int mode)
m_rados_poolname = bp + device_options[i].compare_size;
done = true;
break;
+ case argument_clientid:
+ m_rados_clientid = bp + device_options[i].compare_size;
+ done = true;
+ break;
#ifdef HAVE_RADOS_STRIPER
case argument_striped:
m_stripe_volume = true;
@@ -147,7 +153,7 @@ int rados_device::d_open(const char *pathname, int flags, int mode)
}
if (!m_cluster_initialized) {
- status = rados_create(&m_cluster, NULL);
+ status = rados_create(&m_cluster, m_rados_clientid);
if (status < 0) {
Mmsg1(errmsg, _("Unable to create RADOS cluster: ERR=%s\n"), be.bstrerror(-status));
Emsg0(M_FATAL, 0, errmsg);
@@ -468,6 +474,7 @@ rados_device::rados_device()
m_rados_configstring = NULL;
m_rados_conffile = NULL;
m_rados_poolname = NULL;
+ m_rados_clientid = NULL;
m_cluster_initialized = false;
m_ctx = NULL;
#ifdef HAVE_RADOS_STRIPER
diff --git a/src/stored/backends/rados_device.h b/src/stored/backends/rados_device.h
index cfd033b..df08a03 100644
--- a/src/stored/backends/rados_device.h
+++ b/src/stored/backends/rados_device.h
@@ -38,6 +38,7 @@ class rados_device: public DEVICE {
private:
char *m_rados_configstring;
char *m_rados_conffile;
+ char *m_rados_clientid;
char *m_rados_poolname;
bool m_cluster_initialized;
#ifdef HAVE_RADOS_STRIPER
--
2.4.10