Skip to content

Commit

Permalink
ceph: Added clientid argument to specify rados client id
Browse files Browse the repository at this point in the history
Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
  • Loading branch information
Christian Eichelmann authored and Marco van Wieringen committed Feb 10, 2016
1 parent ce117da commit 236b6b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/plugins/filed/plugin-rados.conf
Expand Up @@ -16,7 +16,7 @@ FileSet {
# adapt this to your environment
# namespace: optional
# snapshotname: optional (a snapshot in any case)
Plugin = "rados:conffile=<ceph_conf_file>:poolname=<pool_name>:namespace=<name_space>:snapshotname=<snapshot_name>:"
Plugin = "rados:conffile=<ceph_conf_file>:clientid=<client_id>:poolname=<pool_name>:namespace=<name_space>:snapshotname=<snapshot_name>:"
}
}

Expand Down
16 changes: 13 additions & 3 deletions src/plugins/filed/rados-fd.c
Expand Up @@ -36,9 +36,9 @@ static const int dbglvl = 150;
#define PLUGIN_VERSION "1"
#define PLUGIN_DESCRIPTION "Bareos CEPH rados File Daemon Plugin"
#if defined(HAVE_RADOS_NAMESPACES) && defined(LIBRADOS_ALL_NSPACES)
#define PLUGIN_USAGE "rados:conffile=<ceph_conf_file>:poolname=<pool_name>:namespace=<name_space>:snapshotname=<snapshot_name>:"
#define PLUGIN_USAGE "rados:conffile=<ceph_conf_file>:clientid=<client_id>:poolname=<pool_name>:namespace=<name_space>:snapshotname=<snapshot_name>:"
#else
#define PLUGIN_USAGE "rados:conffile=<ceph_conf_file>:poolname=<pool_name>:snapshotname=<snapshot_name>:"
#define PLUGIN_USAGE "rados:conffile=<ceph_conf_file>:clientid=<client_id>:poolname=<pool_name>:snapshotname=<snapshot_name>:"
#endif

/*
Expand Down Expand Up @@ -124,6 +124,7 @@ struct plugin_ctx {
char *plugin_options;
uint32_t JobId;
char *rados_conffile;
char *rados_clientid;
char *rados_poolname;
#if defined(HAVE_RADOS_NAMESPACES) && defined(LIBRADOS_ALL_NSPACES)
char *rados_namespace;
Expand All @@ -149,6 +150,7 @@ enum plugin_argument_type {
argument_none,
argument_conffile,
argument_poolname,
argument_clientid,
#if defined(HAVE_RADOS_NAMESPACES) && defined(LIBRADOS_ALL_NSPACES)
argument_namespace,
#endif
Expand All @@ -163,6 +165,7 @@ struct plugin_argument {
static plugin_argument plugin_arguments[] = {
{ "conffile", argument_conffile },
{ "poolname", argument_poolname },
{ "clientid", argument_clientid },
#if defined(HAVE_RADOS_NAMESPACES) && defined(LIBRADOS_ALL_NSPACES)
{ "namespace", argument_namespace },
#endif
Expand Down Expand Up @@ -279,6 +282,10 @@ static bRC freePlugin(bpContext *ctx)
free(p_ctx->rados_poolname);
}

if (p_ctx->rados_clientid) {
free(p_ctx->rados_clientid);
}

if (p_ctx->rados_conffile) {
free(p_ctx->rados_conffile);
}
Expand Down Expand Up @@ -647,6 +654,9 @@ static bRC parse_plugin_definition(bpContext *ctx, void *value)
case argument_conffile:
str_destination = &p_ctx->rados_conffile;
break;
case argument_clientid:
str_destination = &p_ctx->rados_clientid;
break;
case argument_poolname:
str_destination = &p_ctx->rados_poolname;
break;
Expand Down Expand Up @@ -710,7 +720,7 @@ static bRC connect_to_rados(bpContext *ctx)
* See if we need to initialize the cluster connection.
*/
if (!p_ctx->cluster_initialized) {
status = rados_create(&p_ctx->cluster, NULL);
status = rados_create(&p_ctx->cluster, p_ctx->rados_clientid);
if (status < 0) {
berrno be;

Expand Down

0 comments on commit 236b6b7

Please sign in to comment.