summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2020-06-16 18:03:21 +0530
committerMOHIT AGRAWAL <moagrawa@redhat.com>2020-06-21 04:21:02 +0000
commitc18782bc91bb028fe206996a7ef0075beabdf067 (patch)
treeaba6dfaa2a4f1dfcbd7f5d74957bb1ac9e9d5ada /xlators/mgmt/glusterd/src/glusterd-brick-ops.c
parentd55218781876005323d8c146ed4bd73e2146866a (diff)
downloadglusterfs-c18782bc91bb028fe206996a7ef0075beabdf067.tar.gz
glusterfs-c18782bc91bb028fe206996a7ef0075beabdf067.tar.xz
glusterfs-c18782bc91bb028fe206996a7ef0075beabdf067.zip
glusterd: add-brick command failure
Problem: add-brick operation is failing when replica or disperse count is not mentioned in the add-brick command. Reason: with commit a113d93 we are checking brick order while doing add-brick operation for replica and disperse volumes. If replica count or disperse count is not mentioned in the command, the dict get is failing and resulting add-brick operation failure. fixes: #1306 Change-Id: Ie957540e303bfb5f2d69015661a60d7e72557353 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index acd85edd42..61987adde6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -1426,20 +1426,35 @@ glusterd_op_stage_add_brick(dict_t *dict, char **op_errstr, dict_t *rsp_dict)
/* Check brick order if the volume type is replicate or disperse. If
* force at the end of command not given then check brick order.
+ * doing this check at the originator node is sufficient.
*/
- if (!is_force) {
- if ((volinfo->type == GF_CLUSTER_TYPE_REPLICATE) ||
- (volinfo->type == GF_CLUSTER_TYPE_DISPERSE)) {
- ret = glusterd_check_brick_order(dict, msg, volinfo->type);
- if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_BAD_BRKORDER,
- "Not adding brick because of "
- "bad brick order. %s",
- msg);
- *op_errstr = gf_strdup(msg);
- goto out;
- }
+ if (is_origin_glusterd(dict) && !is_force) {
+ ret = 0;
+ if (volinfo->type == GF_CLUSTER_TYPE_REPLICATE) {
+ gf_msg_debug(this->name, 0,
+ "Replicate cluster type "
+ "found. Checking brick order.");
+ if (replica_count)
+ ret = glusterd_check_brick_order(dict, msg, volinfo->type,
+ replica_count);
+ else
+ ret = glusterd_check_brick_order(dict, msg, volinfo->type,
+ volinfo->replica_count);
+ } else if (volinfo->type == GF_CLUSTER_TYPE_DISPERSE) {
+ gf_msg_debug(this->name, 0,
+ "Disperse cluster type"
+ " found. Checking brick order.");
+ ret = glusterd_check_brick_order(dict, msg, volinfo->type,
+ volinfo->disperse_count);
+ }
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_BAD_BRKORDER,
+ "Not adding brick because of "
+ "bad brick order. %s",
+ msg);
+ *op_errstr = gf_strdup(msg);
+ goto out;
}
}