summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2016-03-07 13:37:31 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-03-07 20:54:57 -0800
commit2d87a981657ee23d00c20813deddeb320e0afa8f (patch)
tree65c1d707873e576028b502e5980f172325160d10
parent9c3fc4344a11f2b6d0a7906d45bc7a684d756839 (diff)
glusterd: avoid setting op-version lower than current cluster op-version
Currently glusterd allow setting a cluster op-version which is lower than current cluster op-version. Though command is successful but it does not set that lower op-version. With this fix it will return error message "Required op-version (requested op-version) should not be lower than current cluster op-version (current cluster op-version)" Change-Id: Ia5b61858ee22a5a26721ec12ab12ff48e1a40c82 BUG: 1315186 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/13622 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index ea1400d7637..05b59950da6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1138,8 +1138,22 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
"%s", errstr);
goto out;
}
- if (local_key_op_version > local_new_op_version)
+ if (local_key_op_version > local_new_op_version) {
local_new_op_version = local_key_op_version;
+ } else {
+ ret = -1;
+ snprintf (errstr, sizeof (errstr),
+ "Required op-version (%d) should"
+ " not be equal or lower than current"
+ " cluster op-version (%d).",
+ local_key_op_version,
+ local_new_op_version);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VERSION_UNSUPPORTED,
+ "%s", errstr);
+ goto out;
+ }
+
goto cont;
}