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/block_svc_routines.c | |
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/block_svc_routines.c')
-rw-r--r-- | rpc/block_svc_routines.c | 11 |
1 files changed, 9 insertions, 2 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", |