From 91c353001c0acf6b6a4c08181fa9a582ae3f880b Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Sat, 24 Sep 2016 13:18:24 +0530 Subject: glusterd: enable default configurations post upgrade to >= 3.9.0 versions With 3.8.0 onwards volume options like nfs.disable, transport.address-family have some default configuration value. If a volume was created pre upgrade to 3.8.0 or higher the default options are not set post upgrade. This patch takes care of putting the default values in the op-version bump up workflow. However these changes will only reflect from 3.9.0 onwards Change-Id: I9a8d848cd08d87ddcb80dbeac27eaae097d9cbeb BUG: 1379223 Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/15568 Reviewed-by: jiffin tony Thottan CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Smoke: Gluster Build System Reviewed-by: soumya k Reviewed-by: Kaushal M --- xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index b38b0e6960e..c14b3584efe 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -278,6 +278,7 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) char err_str[2048] = {0,}; gf_cli_rsp rsp = {0,}; xlator_t *this = NULL; + glusterd_conf_t *conf = NULL; char *free_ptr = NULL; char *trans_type = NULL; char *address_family_str = NULL; @@ -292,6 +293,9 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) this = THIS; GF_ASSERT(this); + conf = this->private; + GF_VALIDATE_OR_GOTO (this->name, conf, out); + ret = -1; ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { @@ -385,14 +389,19 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req) goto out; } } else if (!strcmp(trans_type, "tcp")) { - /* Setting default as inet for trans_type tcp */ - ret = dict_set_dynstr_with_alloc (dict, - "transport.address-family", - "inet"); - if (ret) { - gf_log (this->name, GF_LOG_ERROR, - "failed to set transport.address-family"); - goto out; + /* Setting default as inet for trans_type tcp if the op-version + * is >= 3.8.0 + */ + if (conf->op_version >= GD_OP_VERSION_3_8_0) { + ret = dict_set_dynstr_with_alloc (dict, + "transport.address-family", + "inet"); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "failed to set " + "transport.address-family"); + goto out; + } } } ret = dict_get_str (dict, "bricks", &bricks); -- cgit