summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorSamikshan Bairagya <samikshan@gmail.com>2016-12-19 15:07:14 +0530
committerAtin Mukherjee <amukherj@redhat.com>2017-01-08 21:16:12 -0800
commit76fbeafbf56a61768c81f622b354e3c95a00e986 (patch)
tree0b8959761c59a86067368b6883feef2240578fbe /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parent3fcd790d9ca01a95026026d64385c52b5476174d (diff)
glusterd: Get maximum supported op-version in a cluster
gluster volume get <VOLNAME> cluster.opversion gives us the current op-version on which the cluster is operating. There is no command that lets the user know the maximum supported op-version that the cluster can run on. This patch adds a new global option cluster.max-op-version, that can be used to retrieve the maximum supported op-version in a cluster. Usage: # gluster volume get all cluster.max-op-version Example output: Option Value ------ ----- cluster.max-op-version 30900 NOTE: The only way to test this feature for now is to set the GD_OP_VERSION_MAX macro to different values (30800 for 3.8,30900 for 3.9, and so on) and rebuild glusterd. Since the regression test framework currently doesn't have support to simulate these tests, there are no accompanying regression tests for this feature. It should be possible to add tests once glusto comes in and makes it easier to run a heterogeneous cluster. Change-Id: I547480ee5e7912664784643e436feb198b6d16d0 BUG: 1365822 Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: http://review.gluster.org/16283 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index c2b0f53dcc4..ffae6296404 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -67,6 +67,7 @@ glusterd_all_vol_opts valid_all_vol_opts[] = {
{ GLUSTERD_QUORUM_RATIO_KEY },
{ GLUSTERD_SHARED_STORAGE_KEY },
{ GLUSTERD_GLOBAL_OP_VERSION_KEY },
+ { GLUSTERD_MAX_OP_VERSION_KEY },
{ NULL },
};
@@ -2471,6 +2472,25 @@ out:
return ret;
}
+int
+glusterd_op_get_max_opversion (char **op_errstr, dict_t *rsp_dict)
+{
+ int ret = -1;
+
+ GF_VALIDATE_OR_GOTO (THIS->name, rsp_dict, out);
+
+ ret = dict_set_int32 (rsp_dict, "max-opversion", GD_OP_VERSION_MAX);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
+ "Setting value for max-opversion to dict failed");
+ goto out;
+ }
+
+out:
+ gf_msg_debug (THIS->name, 0, "Returning %d", ret);
+ return ret;
+}
+
static int
glusterd_set_shared_storage (dict_t *dict, char *key, char *value,
char **op_errstr)
@@ -7955,6 +7975,7 @@ glusterd_op_free_ctx (glusterd_op_t op, void *ctx)
case GD_OP_STATEDUMP_VOLUME:
case GD_OP_CLEARLOCKS_VOLUME:
case GD_OP_DEFRAG_BRICK_VOLUME:
+ case GD_OP_MAX_OPVERSION:
dict_unref (ctx);
break;
default: