diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-08-16 12:18:42 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2017-08-28 09:36:00 +0000 |
commit | 1316624066cc1ff821f892ea6601a63ca2d0094a (patch) | |
tree | 71addcc43c9da0a249d935e35f700951622f1755 /daemon/gluster-blockd.c | |
parent | 91d9da62ce95a14264950aaf2c100e089c455646 (diff) |
gluster-block: use targetcli interactive mode
Currently, on each targetcli create call, rtslib will rebuild its bs_cache, so
as the /sys/kernel/config/target/core dir gets more entries this takes longer
and longer to scan. Hence using repetitive targetcli in the block create
for creating iqn, backend, setting acls, setting globals will induce too
much delay in block create. As the number of blocks on the node increases,
the delay will be too longer.
This does not happen if we open targetcli in interactive mode and just do
multiple create commands form it, since the bs_cache is build once.
Read More:
https://goo.gl/8aYT38
Change-Id: I2be78a748e013f253ce8f99746989a1cf735a56f
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'daemon/gluster-blockd.c')
-rw-r--r-- | daemon/gluster-blockd.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/daemon/gluster-blockd.c b/daemon/gluster-blockd.c index c96e4bd..23089a6 100644 --- a/daemon/gluster-blockd.c +++ b/daemon/gluster-blockd.c @@ -8,7 +8,7 @@ cases as published by the Free Software Foundation. */ - +# define _GNU_SOURCE # include <fcntl.h> # include <dirent.h> # include <sys/stat.h> @@ -21,6 +21,10 @@ # include "block.h" # include "block_svc.h" +# define GB_TGCLI_GLOBALS "set " \ + "global auto_add_default_portal=false " \ + "auto_enable_tpgt=false " \ + "logfile=%s" extern size_t glfsLruCount; @@ -256,6 +260,47 @@ glusterBlockDParseArgs(int count, char **options) return 0; } +static int +blockNodeSanityCheck(void) +{ + int ret; + char *global_opts; + + + /* Check if tcmu-runner is running */ + ret = gbRunner("ps aux ww | grep -w '[t]cmu-runner' > /dev/null"); + if (ret) { + LOG("mgmt", GB_LOG_ERROR, "%s", "tcmu-runner not running"); + return ESRCH; + } + + /* Check targetcli has user:glfs handler listed */ + ret = gbRunner("targetcli /backstores/user:glfs ls > /dev/null"); + if (ret) { + LOG("mgmt", GB_LOG_ERROR, "%s", + "tcmu-runner running, but targetcli doesn't list user:glfs handler"); + return ENODEV; + } + + if (ret == EKEYEXPIRED) { + LOG("mgmt", GB_LOG_ERROR, "%s", "targetcli not found"); + return EKEYEXPIRED; + } + + if (GB_ASPRINTF(&global_opts, GB_TGCLI_GLOBALS, gbConf.configShellLogFile) == -1) { + return ENOMEM; + } + /* Set targetcli globals */ + ret = gbRunner(global_opts); + GB_FREE(global_opts); + if (ret) { + LOG("mgmt", GB_LOG_ERROR, "%s", + "targetcli set global attr failed"); + return -1; + } + + return 0; +} int main (int argc, char **argv) @@ -293,6 +338,11 @@ main (int argc, char **argv) exit(errnosv); } + errnosv = blockNodeSanityCheck(); + if (errnosv) { + exit(errnosv); + } + initCache(); /* set signal */ |