diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-11-29 17:44:50 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2018-02-08 13:11:56 +0530 |
commit | 7008073e1d00c1af0dc5913cdf5d94372f10088d (patch) | |
tree | 439c3d047499dfade75f42ebcd5f739e80dd5fec /rpc | |
parent | 450f7e89116ed104f092dd1a709c0f057150a4f7 (diff) |
delete: support [unlink-storage <yes|no>] option
$ gluster-block help
gluster-block (0.3)
usage:
gluster-block <command> <volname[/blockname]> [<args>] [--json*]
commands:
[...]
delete <volname/blockname> [unlink-storage <yes|no>] [force]
delete block device.
[...]
supported JSON formats:
--json|--json-plain|--json-spaced|--json-pretty
Change-Id: I64bc99a8519be6f90a7e8bc5558b0d7518661995
Fixes: #19
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/block_svc_routines.c | 12 | ||||
-rw-r--r-- | rpc/rpcl/block.x | 1 |
2 files changed, 7 insertions, 6 deletions
diff --git a/rpc/block_svc_routines.c b/rpc/block_svc_routines.c index f6f532b..0d75652 100644 --- a/rpc/block_svc_routines.c +++ b/rpc/block_svc_routines.c @@ -2270,7 +2270,7 @@ optfail: static int glusterBlockCleanUp(struct glfs *glfs, char *blockname, - bool deleteall, bool forcedel, blockRemoteDeleteResp *drobj) + bool deleteall, bool forcedel, bool unlink, blockRemoteDeleteResp *drobj) { int ret = -1; size_t i; @@ -2328,7 +2328,7 @@ glusterBlockCleanUp(struct glfs *glfs, char *blockname, if (forcedel || cleanupsuccess == info->nhosts) { GB_METAUPDATE_OR_GOTO(lock, glfs, blockname, info->volume, ret, errMsg, out, "ENTRYDELETE: INPROGRESS\n"); - if (glusterBlockDeleteEntry(glfs, info->volume, info->gbid)) { + if (unlink && glusterBlockDeleteEntry(glfs, info->volume, info->gbid)) { GB_METAUPDATE_OR_GOTO(lock, glfs, blockname, info->volume, ret, errMsg, out, "ENTRYDELETE: FAIL\n"); LOG("mgmt", GB_LOG_ERROR, "%s %s for block %s", FAILED_DELETING_FILE, @@ -2415,7 +2415,7 @@ glusterBlockAuditRequest(struct glfs *glfs, "No Spare nodes to create (%s): rollingback creation of target" " on volume %s with given hosts %s", blk->block_name, blk->volume, blk->block_hosts); - glusterBlockCleanUp(glfs, blk->block_name, TRUE, FALSE, (*reply)->obj); + glusterBlockCleanUp(glfs, blk->block_name, TRUE, FALSE, TRUE, (*reply)->obj); needcleanup = FALSE; /* already clean attempted */ ret = -1; goto out; @@ -2424,7 +2424,7 @@ glusterBlockAuditRequest(struct glfs *glfs, "Not enough Spare nodes for (%s): rollingback creation of target" " on volume %s with given hosts %s", blk->block_name, blk->volume, blk->block_hosts); - glusterBlockCleanUp(glfs, blk->block_name, TRUE, FALSE, (*reply)->obj); + glusterBlockCleanUp(glfs, blk->block_name, TRUE, FALSE, TRUE, (*reply)->obj); needcleanup = FALSE; /* already clean attempted */ ret = -1; goto out; @@ -2455,7 +2455,7 @@ glusterBlockAuditRequest(struct glfs *glfs, out: if (needcleanup) { - glusterBlockCleanUp(glfs, blk->block_name, FALSE, FALSE, (*reply)->obj); + glusterBlockCleanUp(glfs, blk->block_name, FALSE, FALSE, TRUE, (*reply)->obj); } blockFreeMetaInfo(info); @@ -3616,7 +3616,7 @@ block_delete_cli_1_svc_st(blockDeleteCli *blk, struct svc_req *rqstp) goto out; } - errCode = glusterBlockCleanUp(glfs, blk->block_name, TRUE, TRUE, savereply); + errCode = glusterBlockCleanUp(glfs, blk->block_name, TRUE, TRUE, blk->unlink, savereply); if (errCode) { LOG("mgmt", GB_LOG_WARNING, "glusterBlockCleanUp: return %d " "on block %s for volume %s", errCode, blk->block_name, blk->volume); diff --git a/rpc/rpcl/block.x b/rpc/rpcl/block.x index e3fcbd1..c976b3e 100644 --- a/rpc/rpcl/block.x +++ b/rpc/rpcl/block.x @@ -56,6 +56,7 @@ struct blockCreateCli { struct blockDeleteCli { char block_name[255]; char volume[255]; + bool unlink; bool force; enum JsonResponseFormat json_resp; }; |