summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2017-08-03 14:35:37 +0530
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2017-10-09 11:13:20 +0530
commite6ed5b53cf33b4315ee2846a9f773cd672a5de8c (patch)
tree41b2e9eeb86ec0b92c0c063df56bdbaff030f104 /rpc
parent59572e84b1dd4d5c3374f34537e506b831729f58 (diff)
delete/rollback: check for matching gbid before deleting a block
Currently we are just checking for blockname in targetcli list output, if it exist we will delete the backend. We do not check if block belongs to a given volume (say vol1), because of which a rollback on a failure to create block with same name, on same node but on a different volume (say vol2) deletes block backend belonging to vol1. Solution: only if blockname + gbid matches continue delete. Change-Id: I396c228dad3cf4f51cc6676a266b837bdf6040c7 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/block_svc_routines.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/rpc/block_svc_routines.c b/rpc/block_svc_routines.c
index c8fb18d..c0c437f 100644
--- a/rpc/block_svc_routines.c
+++ b/rpc/block_svc_routines.c
@@ -27,7 +27,7 @@
# define GB_TGCLI_GLFS_PATH "/backstores/user:glfs"
# define GB_TGCLI_GLFS "targetcli " GB_TGCLI_GLFS_PATH
-# define GB_TGCLI_CHECK GB_TGCLI_GLFS " ls | grep ' %s ' > " DEVNULLPATH
+# define GB_TGCLI_CHECK GB_TGCLI_GLFS " ls | grep ' %s ' | grep '/%s ' > " DEVNULLPATH
# define GB_TGCLI_ISCSI_PATH "/iscsi"
# define GB_TGCLI_SAVE "/ saveconfig"
# define GB_TGCLI_ATTRIBUTES "generate_node_acls=1 demo_mode_write_protect=0"
@@ -2410,7 +2410,10 @@ block_delete_1_svc_st(blockDelete *blk, struct svc_req *rqstp)
}
reply->exit = -1;
- if (GB_ASPRINTF(&exec, GB_TGCLI_CHECK, blk->block_name) == -1) {
+ if (GB_ASPRINTF(&exec, GB_TGCLI_CHECK, blk->block_name, blk->gbid) == -1) {
+ LOG("mgmt", GB_LOG_WARNING,
+ "block backend with name '%s' doesn't exist with matching gbid %s",
+ blk->block_name, blk->gbid);
goto out;
}
@@ -2483,7 +2486,10 @@ block_modify_1_svc_st(blockModify *blk, struct svc_req *rqstp)
}
reply->exit = -1;
- if (GB_ASPRINTF(&exec, GB_TGCLI_CHECK, blk->block_name) == -1) {
+ if (GB_ASPRINTF(&exec, GB_TGCLI_CHECK, blk->block_name, blk->gbid) == -1) {
+ LOG("mgmt", GB_LOG_WARNING,
+ "block backend with name '%s' doesn't exist with matching gbid %s, volume '%s'",
+ blk->block_name, blk->gbid, blk->volume);
goto out;
}