summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2012-01-06 12:18:35 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-03 07:39:41 -0800
commit2313600f0749094f1246e663a0db15da3c2812db (patch)
treee07ea9fbd5aa900ceecb6ad69aba133c7c2b7ff1 /xlators/mgmt/glusterd
parent83a3daf7c205f119169eb2d7091432de05b1861c (diff)
glusterd: Improved err msgs for add_brick
Change-Id: I4b97d7e26b8c81ed52657467981be0c4adc291ae BUG: 772145 Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-on: http://review.gluster.com/2589 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 5a4bbab77fb..2f1c37f0e9f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -107,12 +107,19 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
case GF_CLUSTER_TYPE_NONE:
if ((volinfo->brick_count * stripe_count) == total_bricks) {
/* Change the volume type */
+ *type = GF_CLUSTER_TYPE_STRIPE;
gf_log (THIS->name, GF_LOG_INFO,
"Changing the type of volume %s from "
- "None to 'stripe'", volinfo->volname);
- *type = GF_CLUSTER_TYPE_STRIPE;
+ "'distribute' to 'stripe'", volinfo->volname);
ret = 0;
goto out;
+ } else {
+ snprintf (err_str, err_len, "Incorrect number of "
+ "bricks (%d) supplied for stripe count (%d).",
+ (total_bricks - volinfo->brick_count),
+ stripe_count);
+ gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ goto out;
}
break;
case GF_CLUSTER_TYPE_REPLICATE:
@@ -131,10 +138,10 @@ gd_addbr_validate_stripe_count (glusterd_volinfo_t *volinfo, int stripe_count,
case GF_CLUSTER_TYPE_STRIPE_REPLICATE:
if (stripe_count < volinfo->stripe_count) {
snprintf (err_str, err_len,
- "wrong stripe count (%d) given. "
- "already have %d",
+ "Incorrect stripe count (%d) supplied. "
+ "Volume already has stripe count (%d)",
stripe_count, volinfo->stripe_count);
- gf_log ("glusterd", GF_LOG_ERROR, "%s", err_str);
+ gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
goto out;
}
if (stripe_count == volinfo->stripe_count) {
@@ -170,7 +177,8 @@ out:
static int
gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
- int total_bricks, int *type, char *err_str, int err_len)
+ int total_bricks, int *type, char *err_str,
+ int err_len)
{
int ret = -1;
@@ -179,12 +187,20 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
case GF_CLUSTER_TYPE_NONE:
if ((volinfo->brick_count * replica_count) == total_bricks) {
/* Change the volume type */
+ *type = GF_CLUSTER_TYPE_REPLICATE;
gf_log (THIS->name, GF_LOG_INFO,
"Changing the type of volume %s from "
- "None to 'replica'", volinfo->volname);
- *type = GF_CLUSTER_TYPE_REPLICATE;
+ "'distribute' to 'replica'", volinfo->volname);
ret = 0;
goto out;
+
+ } else {
+ snprintf (err_str, err_len, "Incorrect number of "
+ "bricks (%d) supplied for replica count (%d).",
+ (total_bricks - volinfo->brick_count),
+ replica_count);
+ gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
+ goto out;
}
break;
case GF_CLUSTER_TYPE_STRIPE:
@@ -203,10 +219,10 @@ gd_addbr_validate_replica_count (glusterd_volinfo_t *volinfo, int replica_count,
case GF_CLUSTER_TYPE_STRIPE_REPLICATE:
if (replica_count < volinfo->replica_count) {
snprintf (err_str, err_len,
- "wrong replica count (%d) given. "
- "already have %d",
+ "Incorrect replica count (%d) supplied. "
+ "Volume already has (%d)",
replica_count, volinfo->replica_count);
- gf_log ("glusterd", GF_LOG_ERROR, "%s", err_str);
+ gf_log (THIS->name, GF_LOG_ERROR, "%s", err_str);
goto out;
}
if (replica_count == volinfo->replica_count) {