From 0a1c338a4814f91cd49b7747442d413c6b8f0dfa Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Wed, 11 Jan 2017 18:00:50 +0530 Subject: gluster-block: fix random issues 1. create backstores with unique wwn across nodes which are multipath 2. remove node identity in the iqn naming to keep it unique across the multipath nodes 3. save target configuration after deleting the backstores and LUN's Signed-off-by: Prasanna Kumar Kalever --- gluster-block.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gluster-block.c b/gluster-block.c index 157d16a..63d5be4 100644 --- a/gluster-block.c +++ b/gluster-block.c @@ -337,9 +337,9 @@ glusterBlockCreate(int count, char **options, char *name) goto out; } - if (asprintf(&cmd, "%s %s %s %zu %s@%s/%s", TARGETCLI_GLFS, + if (asprintf(&cmd, "%s %s %s %zu %s@%s/%s %s", TARGETCLI_GLFS, CREATE, name, blk->size, blk->volume, blk->host, - blk->filename) < 0) + blk->filename, blk->filename) < 0) goto out; /* Created user-backed storage object LUN size 2147483648. */ @@ -353,8 +353,7 @@ glusterBlockCreate(int count, char **options, char *name) goto out; } - asprintf(&iqn, "%s%s-%s", - IQN_PREFIX, list->hosts[i], blk->filename); + asprintf(&iqn, "%s%s", IQN_PREFIX, blk->filename); asprintf(&exec, "%s %s %s", TARGETCLI_ISCSI, CREATE, iqn); sshout = glusterBlockSSHRun(list->hosts[i], exec, true); if (!sshout) { @@ -591,6 +590,8 @@ glusterBlockList(blockServerDefPtr blkServers) glusterBlockDefFree(blk); } + putchar('\n'); + fclose(fd); remove(sshout); GB_FREE(sshout); @@ -657,8 +658,7 @@ glusterBlockDelete(char* name, blockServerDefPtr blkServers) } } - asprintf(&iqn, "%s%s-%s", - IQN_PREFIX, blkServers->hosts[i], blk->filename); + asprintf(&iqn, "%s%s", IQN_PREFIX, blk->filename); asprintf(&exec, "%s %s %s", TARGETCLI_ISCSI, DELETE, iqn); sshout = glusterBlockSSHRun(blkServers->hosts[i], exec, true); if (!sshout) { @@ -669,6 +669,16 @@ glusterBlockDelete(char* name, blockServerDefPtr blkServers) } GB_FREE(exec); GB_FREE(iqn); + + sshout = glusterBlockSSHRun(blkServers->hosts[i], TARGETCLI_SAVE, true); + if (!sshout) { + ERROR("%s on host: %s", + FAILED_SAVEING_CONFIG, blkServers->hosts[i]); + ret = -1; + goto fail; + } + + putchar('\n'); } ret = glusterBlockDeleteEntry(blk); -- cgit