From 1a642df1e963bf13d44de5b28a72ed2eb4dbca88 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Tue, 30 Jul 2013 16:18:02 +0530 Subject: glusterd: Added op-version checks to geo-rep commands. Added op-version checks to all geo-rep commands. Min op-version should be 2. Change-Id: I942d897404e11e4d53123409731ba5cd252668fe BUG: 847839 Signed-off-by: Avra Sengupta Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/5732 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index debee9ea..745bc282 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -1391,6 +1391,22 @@ glusterd_op_stage_sys_exec (dict_t *dict, char **op_errstr) char command_path[PATH_MAX] = ""; struct stat st = {0,}; int ret = -1; + glusterd_conf_t *conf = NULL; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); + conf = this->private; + GF_ASSERT (conf); + + if (conf->op_version < 2) { + gf_log ("", GF_LOG_ERROR, "Op Version not supported."); + snprintf (errmsg, sizeof(errmsg), "One or more nodes do not" + " support the required op version."); + *op_errstr = gf_strdup (errmsg); + ret = -1; + goto out; + } ret = dict_get_str (dict, "command", &command); if (ret) { @@ -1449,6 +1465,15 @@ glusterd_op_stage_copy_file (dict_t *dict, char **op_errstr) goto out; } + if (priv->op_version < 2) { + gf_log ("", GF_LOG_ERROR, "Op Version not supported."); + snprintf (errmsg, sizeof(errmsg), "One or more nodes do not" + " support the required op version."); + *op_errstr = gf_strdup (errmsg); + ret = -1; + goto out; + } + ret = dict_get_str (dict, "host-uuid", &host_uuid); if (ret < 0) { gf_log ("", GF_LOG_ERROR, "Unable to fetch" @@ -1785,6 +1810,15 @@ glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr) return -1; } + if (conf->op_version < 2) { + gf_log ("", GF_LOG_ERROR, "Op Version not supported."); + snprintf (errmsg, sizeof(errmsg), "One or more nodes do not" + " support the required op version."); + *op_errstr = gf_strdup (errmsg); + ret = -1; + goto out; + } + exists = glusterd_check_volume_exists (volname); ret = glusterd_volinfo_find (volname, &volinfo); if ((ret) || (!exists)) { @@ -2008,6 +2042,15 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr) if (ret) goto out; + if (conf->op_version < 2) { + gf_log ("", GF_LOG_ERROR, "Op Version not supported."); + snprintf (errmsg, sizeof(errmsg), "One or more nodes do not" + " support the required op version."); + *op_errstr = gf_strdup (errmsg); + ret = -1; + goto out; + } + exists = glusterd_check_volume_exists (volname); ret = glusterd_volinfo_find (volname, &volinfo); if ((ret) || (!exists)) { -- cgit