diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-01-11 18:00:50 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-01-11 18:08:28 +0530 |
commit | 0a1c338a4814f91cd49b7747442d413c6b8f0dfa (patch) | |
tree | 4cb7b10996ea8c4ea144e9d66f9addd9b8bc5d76 | |
parent | bcea2a6f26ac7090f2dcf995b99a9865d354b32a (diff) |
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 <prasanna.kalever@redhat.com>
-rw-r--r-- | gluster-block.c | 22 |
1 files 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); |