From 630e272a89fde08315b6159b83fcbbd6711a6046 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 29 Mar 2012 13:02:32 +0530 Subject: glusterd: add-brick: give proper reason in few error cases had missed few 'else' cases, which were needed to send the right error message to the user regarding the reason for failure. Change-Id: I42d92782f4dec6f6bdffd42df254b7f38a715e36 Signed-off-by: Amar Tumballi BUG: 772544 Reviewed-on: http://review.gluster.com/3032 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 4aaad7399cd..15e81804f46 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -133,6 +133,15 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count, volinfo->volname); ret = 0; goto out; + } else { + snprintf (err_str, err_len, "Incorrect number of " + "bricks (%d) supplied for changing volume's " + "stripe count to %d, need at least %d bricks", + (total_bricks - volinfo->brick_count), + stripe_count, + (volinfo->replica_count * stripe_count)); + gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str); + goto out; } break; case GF_CLUSTER_TYPE_STRIPE: @@ -214,6 +223,16 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count, volinfo->volname); ret = 0; goto out; + } else { + snprintf (err_str, err_len, "Incorrect number of " + "bricks (%d) supplied for changing volume's " + "replica count to %d, need at least %d " + "bricks", + (total_bricks - volinfo->brick_count), + replica_count, (volinfo->dist_leaf_count * + replica_count)); + gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str); + goto out; } break; case GF_CLUSTER_TYPE_REPLICATE: -- cgit