Skip to content

Commit

Permalink
vfs_ceph: add user_id smb.conf parameter
Browse files Browse the repository at this point in the history
The "ceph: user_id" parameter can be specified in smb.conf to explicitly
set the Ceph client ID used when creating the mount handle.

Signed-off-by: David Disseldorp <[email protected]>
Reviewed-by: Ralph Böhme <[email protected]>
  • Loading branch information
ddiss committed Feb 15, 2017
1 parent eb39aa4 commit ec788be
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions source3/modules/vfs_ceph.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,37 +85,34 @@ static int cephwrap_connect(struct vfs_handle_struct *handle, const char *servi
{
int ret;
char buf[256];

const char * conf_file;
int snum = SNUM(handle->conn);
const char *conf_file;
const char *user_id;

if (cmount) {
handle->data = cmount; /* We have been here before */
cmount_cnt++;
return 0;
}

conf_file = lp_parm_const_string(SNUM(handle->conn), "ceph", "config_file", NULL);
/* if config_file and/or user_id are NULL, ceph will use defaults */
conf_file = lp_parm_const_string(snum, "ceph", "config_file", NULL);
user_id = lp_parm_const_string(snum, "ceph", "user_id", NULL);

DBG_DEBUG( "[CEPH] calling: ceph_create\n" );
ret = ceph_create(&cmount, NULL);
if (ret)
DBG_DEBUG("[CEPH] calling: ceph_create\n");
ret = ceph_create(&cmount, user_id);
if (ret) {
goto err_out;

if (conf_file) {
/* Override the config file */
DBG_DEBUG( "[CEPH] calling: ceph_conf_read_file\n" );
ret = ceph_conf_read_file(cmount, conf_file);
} else {

DBG_DEBUG( "[CEPH] calling: ceph_conf_read_file with %s\n", conf_file);
ret = ceph_conf_read_file(cmount, NULL);
}

DBG_DEBUG("[CEPH] calling: ceph_conf_read_file with %s\n",
(conf_file == NULL ? "default path" : conf_file));
ret = ceph_conf_read_file(cmount, conf_file);
if (ret) {
goto err_cm_release;
}

DBG_DEBUG( "[CEPH] calling: ceph_conf_get\n" );
DBG_DEBUG("[CEPH] calling: ceph_conf_get\n");
ret = ceph_conf_get(cmount, "log file", buf, sizeof(buf));
if (ret < 0) {
goto err_cm_release;
Expand Down

0 comments on commit ec788be

Please sign in to comment.