From 535c4259119ca3beef2fee1526930e8be42bdd5d Mon Sep 17 00:00:00 2001 From: GauravKumarGarg Date: Mon, 29 Sep 2014 14:03:49 +0530 Subject: glusterd: Perform brick order check in originator node. Currently in case of multi node cluster brick-order check for replicate volume done on every node. Its waste of time to perform brick order check on every node. This change will perform brick order check only at originator node. Change-Id: I8687fd28e587de8a280a9003b015ccd5729c9740 BUG: 1091935 Signed-off-by: ggarg Reviewed-on: http://review.gluster.org/8881 Tested-by: Gluster Build System Reviewed-by: Kaushal M Tested-by: Kaushal M --- xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 35 ++++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index ac8407f077d..cde4bec844d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1095,23 +1095,26 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr, /*Check brick order if the volume type is replicate or disperse. If * force at the end of command not given then check brick order. */ - ret = dict_get_int32 (dict, "type", &type); - if (ret) { - snprintf (msg, sizeof (msg), "Unable to get type of volume %s", - volname); - gf_log (this->name, GF_LOG_WARNING, "%s", msg); - goto out; - } + if (is_origin_glusterd (dict)) { + ret = dict_get_int32 (dict, "type", &type); + if (ret) { + snprintf (msg, sizeof (msg), "Unable to get type of " + "volume %s", volname); + gf_log (this->name, GF_LOG_WARNING, "%s", msg); + goto out; + } - if (!is_force) { - if ((type == GF_CLUSTER_TYPE_REPLICATE) || - (type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) || - (type == GF_CLUSTER_TYPE_DISPERSE)) { - ret = glusterd_check_brick_order(dict, msg); - if (ret) { - gf_log(this->name, GF_LOG_ERROR, "Not creating " - "volume because of bad brick order"); - goto out; + if (!is_force) { + if ((type == GF_CLUSTER_TYPE_REPLICATE) || + (type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) || + (type == GF_CLUSTER_TYPE_DISPERSE)) { + ret = glusterd_check_brick_order(dict, msg); + if (ret) { + gf_log(this->name, GF_LOG_ERROR, "Not " + "creating volume because of bad " + "brick order"); + goto out; + } } } } -- cgit