From b535c44fdd2b71c50a8fcbcf1e1e1c2d1c0340e9 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Thu, 17 Aug 2017 11:21:11 +0530 Subject: 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 --- rpc/block_svc_routines.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'rpc/block_svc_routines.c') 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", -- cgit