summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2016-03-07 13:37:31 +0530
committerVijay Bellur <vbellur@redhat.com>2016-03-08 18:18:12 -0800
commitd1272ef0fdc9897fa388665e039b9f713109ef0c (patch)
tree226f706fc91fc3db3774d5ebf7d5a2ab540d1d3f
parente9fa7aeb1a32e22ff0749d67995e689028ca5a19 (diff)
glusterd: avoid setting op-version lower than current cluster op-version
This patch is backport of: http://review.gluster.org/#/c/13622/ 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: 1315562 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> >> 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> (cherry picked from commit 2d87a981657ee23d00c20813deddeb320e0afa8f) Change-Id: Ie75b2a0c43ab2c5a908f4d3800e1df62770d315b Reviewed-on: http://review.gluster.org/13635 Tested-by: Gaurav Kumar Garg <ggarg@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@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 801384e8e3d..8c39c304366 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1124,8 +1124,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;
}