summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-01-19 01:49:05 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-01-26 23:42:15 -0800
commit945ac04532d5efeeef324be485dcf2bade41708e (patch)
tree7c26798068e41b4a3c8e5a0c46ca81322060811e
parent26e1bfc68a6b4dff95d5fb244076116896add68d (diff)
mgmt/glusterd: error out if remove-brick comes for final bricks
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2298 (removing the last pair of bricks from a volume results in inconsistency) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2298
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 24407e8bedb..6f5dfa7a8b2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1709,6 +1709,7 @@ glusterd_op_stage_remove_brick (gd1_mgmt_stage_op_req *req)
glusterd_volinfo_t *volinfo = NULL;
dict_t *ctx = NULL;
char *errstr = NULL;
+ int32_t brick_count = 0;
GF_ASSERT (req);
@@ -1758,7 +1759,13 @@ glusterd_op_stage_remove_brick (gd1_mgmt_stage_op_req *req)
goto out;
}
- if (volinfo->brick_count == 1) {
+ ret = dict_get_int32 (dict, "count", &brick_count);
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to get brick count");
+ goto out;
+ }
+
+ if (volinfo->brick_count == brick_count) {
ctx = glusterd_op_get_ctx (GD_OP_REMOVE_BRICK);
if (!ctx) {
gf_log ("", GF_LOG_ERROR,
@@ -1766,7 +1773,7 @@ glusterd_op_stage_remove_brick (gd1_mgmt_stage_op_req *req)
ret = -1;
goto out;
}
- errstr = gf_strdup ("Deleting the last brick of the "
+ errstr = gf_strdup ("Deleting all the bricks of the "
"volume is not allowed");
if (!errstr) {
gf_log ("", GF_LOG_ERROR, "Out of memory");