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 <ggarg@redhat.com>
Reviewed-on: http://review.gluster.org/8881
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Kaushal M <kaushal@redhat.com>
This commit is contained in:
GauravKumarGarg 2014-09-29 14:03:49 +05:30 committed by Kaushal M
parent 2736421b26
commit 535c425911

View File

@ -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;
}
}
}
}