From 0286dd866a89c035073294c348a43beca3109c38 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Mon, 26 Sep 2011 11:19:24 +0530 Subject: glusterd: more checks before starting rebalance Checks if specified volume is of a distribute type and has more than one brick before attempting to start rebalance. Change-Id: I9a3405019e7af4a7d7e162b0dc054bf9a99364e7 BUG: 3561 Reviewed-on: http://review.gluster.com/501 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- xlators/mgmt/glusterd/src/glusterd-rebalance.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index d2ad2ce90..ed87a5bb7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -608,6 +608,14 @@ glusterd_rebalance_cmd_validate (int cmd, char *volname, volname); goto out; } + if ((*volinfo)->brick_count <= (*volinfo)->dist_leaf_count) { + gf_log ("glusterd", GF_LOG_ERROR, "Volume %s is not a " + "distribute type or contains only 1 brick", volname); + snprintf (op_errstr, len, "Volume %s is not a distribute " + "volume or contains only 1 brick.\n" + "Not performing rebalance", volname); + goto out; + } if ((*volinfo)->status != GLUSTERD_STATUS_STARTED) { gf_log ("glusterd", GF_LOG_ERROR, "Received rebalance on stopped" -- cgit