summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-05-05 09:54:22 +0530
committerVijay Bellur <vijay@gluster.com>2012-05-08 02:40:58 -0700
commiteb7c8dd03d84d7c3917d18a59d86c379382c8b2d (patch)
tree1c947a36d4afff83bd65418224d224a9e91d90f0 /xlators
parentc4dadc74fd1d1188f123eae7f2b6d6f5232e2a0f (diff)
glusterd: remove-brick: add more error handling
with this, we can make sure, all wrong patterns in CLI can be reported with proper message back to user, instead of resulting in an wrong volume type. Change-Id: Ib461956dd7d51f7f81c19c27112d44c2adb3a66d Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 803711 Reviewed-on: http://review.gluster.com/3278 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 4bb6c5115a7..72418684649 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -684,10 +684,33 @@ glusterd_handle_remove_brick (rpcsvc_request_t *req)
goto out;
}
+ if (!replica_count &&
+ (volinfo->type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) &&
+ (volinfo->brick_count == volinfo->dist_leaf_count)) {
+ snprintf (err_str, 2048,
+ "Removing bricks from stripe-replicate"
+ " configuration is not allowed without reducing "
+ "replica or stripe count explicitly.");
+ gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ ret = -1;
+ goto out;
+ }
+
+ if (!replica_count &&
+ (volinfo->type == GF_CLUSTER_TYPE_REPLICATE) &&
+ (volinfo->brick_count == volinfo->dist_leaf_count)) {
+ snprintf (err_str, 2048,
+ "Removing bricks from replicate configuration "
+ "is not allowed without reducing replica count "
+ "explicitly.");
+ gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ ret = -1;
+ goto out;
+ }
+
/* Do not allow remove-brick if the bricks given is less than
the replica count or stripe count */
- if (!replica_count && (volinfo->type != GF_CLUSTER_TYPE_NONE) &&
- !(volinfo->brick_count <= volinfo->dist_leaf_count)) {
+ if (!replica_count && (volinfo->type != GF_CLUSTER_TYPE_NONE)) {
if (volinfo->dist_leaf_count &&
(count % volinfo->dist_leaf_count)) {
snprintf (err_str, 2048, "Remove brick incorrect"
@@ -699,18 +722,6 @@ glusterd_handle_remove_brick (rpcsvc_request_t *req)
}
}
- if (!replica_count &&
- (volinfo->type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) &&
- (volinfo->brick_count == volinfo->dist_leaf_count)) {
- snprintf (err_str, 2048,
- "Removing bricks from stripe-replicate"
- " configuration is not allowed without reducing "
- "replica or stripe count explicitly.");
- gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
- ret = -1;
- goto out;
- }
-
brick_list = GF_MALLOC (120000 * sizeof(*brick_list),gf_common_mt_char);
if (!brick_list) {