diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-08-17 11:21:11 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-08-17 14:22:55 +0530 |
commit | b535c44fdd2b71c50a8fcbcf1e1e1c2d1c0340e9 (patch) | |
tree | 208d639723c7a8bfc1b928ee7843155c69fe8a5e /rpc | |
parent | d723907c8eaa25f107c7fadd79ca5f9bc6596edf (diff) |
logger: support logdir choosing via Environment variable
Currently the default logdir is DATADIR /log/gluster-block/
This patch will provide a way to change this default logdir via Env variable
$ export GB_LOGDIR=/var/log/gluster-block-new-path/
Note: make sure to restart the processes (cli & daemon) after you set GB_LOGDIR
Change-Id: Id142e4a4dfe7b6ebc9cf8296b8ceb8bff37691b8
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/block_svc_routines.c | 11 | ||||
-rw-r--r-- | rpc/glfs-operations.c | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/rpc/block_svc_routines.c b/rpc/block_svc_routines.c index b309e79..70f0b3e 100644 --- a/rpc/block_svc_routines.c +++ b/rpc/block_svc_routines.c @@ -33,7 +33,7 @@ # define GB_TGCLI_GLOBALS "targetcli set " \ "global auto_add_default_portal=false " \ "auto_enable_tpgt=false " \ - "logfile=" CONFIGSHELL_LOG_FILE " > " DEVNULLPATH + "logfile=%s > " DEVNULLPATH # define GB_TGCLI_SAVE "targetcli / saveconfig > " DEVNULLPATH # define GB_TGCLI_ATTRIBUTES "generate_node_acls=1 demo_mode_write_protect=0 > " DEVNULLPATH # define GB_TGCLI_IQN_PREFIX "iqn.2016-12.org.gluster-block:" @@ -2072,6 +2072,7 @@ block_create_1_svc(blockCreate *blk, struct svc_req *rqstp) char *attr = NULL; char *authcred = NULL; char *exec = NULL; + char *global_opts = NULL; blockResponse *reply = NULL; blockServerDefPtr list = NULL; size_t i; @@ -2168,11 +2169,17 @@ block_create_1_svc(blockCreate *blk, struct svc_req *rqstp) goto out; } if (!tmp) { + if (GB_ASPRINTF(&global_opts, GB_TGCLI_GLOBALS, gbConf.configShellLogFile) == -1) { + goto out; + } + if (GB_ASPRINTF(&exec, "%s && %s && %s && %s && %s %s && %s && %s %s", - GB_TGCLI_GLOBALS, backstore, backstore_attr, iqn, tpg?tpg:"", lun, + global_opts, backstore, backstore_attr, iqn, tpg?tpg:"", lun, portal, attr, blk->auth_mode?authcred:"") == -1) { + GB_FREE(global_opts); goto out; } + GB_FREE(global_opts); tmp = exec; } else { if (GB_ASPRINTF(&exec, "%s && %s && %s && %s %s", diff --git a/rpc/glfs-operations.c b/rpc/glfs-operations.c index 0509f7f..d5d3aba 100644 --- a/rpc/glfs-operations.c +++ b/rpc/glfs-operations.c @@ -45,13 +45,13 @@ glusterBlockVolumeInit(char *volume, int *errCode, char **errMsg) goto out; } - ret = glfs_set_logging(glfs, GFAPI_LOG_FILE, GFAPI_LOG_LEVEL); + ret = glfs_set_logging(glfs, gbConf.gfapiLogFile, GFAPI_LOG_LEVEL); if (ret) { *errCode = errno; GB_ASPRINTF (errMsg, "Not able to add logging for volume %s[%s]", volume, strerror(*errCode)); LOG("gfapi", GB_LOG_ERROR, "glfs_set_logging(%s, %d) on %s failed[%s]", - GFAPI_LOG_FILE, GFAPI_LOG_LEVEL, volume, strerror(*errCode)); + gbConf.gfapiLogFile, GFAPI_LOG_LEVEL, volume, strerror(*errCode)); goto out; } |