|
|
3604df |
From aec05dcb188287df2961631f7c7f32e7d4f7ee1f Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
Date: Sat, 24 Sep 2016 13:18:24 +0530
|
|
|
3604df |
Subject: [PATCH 106/141] glusterd: enable default configurations post upgrade to >= 3.9.0 versions
|
|
|
3604df |
|
|
|
3604df |
With 3.8.0 onwards volume options like nfs.disable, transport.address-family
|
|
|
3604df |
have some default configuration value. If a volume was created pre upgrade to
|
|
|
3604df |
3.8.0 or higher the default options are not set post upgrade. This patch takes
|
|
|
3604df |
care of putting the default values in the op-version bump up workflow. However
|
|
|
3604df |
these changes will only reflect from 3.9.0 onwards
|
|
|
3604df |
|
|
|
3604df |
>Reviewed-on: http://review.gluster.org/15568
|
|
|
3604df |
>Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Reviewed-by: soumya k <skoduri@redhat.com>
|
|
|
3604df |
>Reviewed-by: Kaushal M <kaushal@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
>Reviewed-on: http://review.gluster.org/15652
|
|
|
3604df |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
This also fixes BZ 1378342 & BZ 1378676
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I9a8d848cd08d87ddcb80dbeac27eaae097d9cbeb
|
|
|
3604df |
BUG: 1378677
|
|
|
3604df |
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/87434
|
|
|
3604df |
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 65 ++++++++++++++++++++++-
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 25 ++++++---
|
|
|
3604df |
2 files changed, 80 insertions(+), 10 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
3604df |
index 1b50038..2b6814b 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
3604df |
@@ -2252,6 +2252,68 @@ out:
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
static int
|
|
|
3604df |
+glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
|
|
|
3604df |
+{
|
|
|
3604df |
+ int ret = -1;
|
|
|
3604df |
+ xlator_t *this = NULL;
|
|
|
3604df |
+ glusterd_conf_t *conf = NULL;
|
|
|
3604df |
+ char *address_family_str = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ this = THIS;
|
|
|
3604df |
+ GF_VALIDATE_OR_GOTO ("glusterd", this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ conf = this->private;
|
|
|
3604df |
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ /* 3.9.0 onwards gNFS will be disabled by default. In case of an upgrade
|
|
|
3604df |
+ * from anything below than 3.9.0 to 3.9.x the volume's dictionary will
|
|
|
3604df |
+ * not have 'nfs.disable' key set which means the same will not be set
|
|
|
3604df |
+ * to on until explicitly done. setnfs.disable to 'on' at op-version
|
|
|
3604df |
+ * bump up flow is the ideal way here. The same is also applicable for
|
|
|
3604df |
+ * transport.address-family where if the transport type is set to tcp
|
|
|
3604df |
+ * then transport.address-family is defaulted to 'inet'.
|
|
|
3604df |
+ */
|
|
|
3604df |
+ if (conf->op_version >= GD_OP_VERSION_3_9_0) {
|
|
|
3604df |
+ if (dict_get_str_boolean (volinfo->dict, NFS_DISABLE_MAP_KEY,
|
|
|
3604df |
+ 1)) {
|
|
|
3604df |
+ ret = dict_set_dynstr_with_alloc (volinfo->dict,
|
|
|
3604df |
+ NFS_DISABLE_MAP_KEY,
|
|
|
3604df |
+ "on");
|
|
|
3604df |
+ if (ret) {
|
|
|
3604df |
+ gf_msg (this->name, GF_LOG_ERROR, errno,
|
|
|
3604df |
+ GD_MSG_DICT_SET_FAILED, "Failed to set "
|
|
|
3604df |
+ "option ' NFS_DISABLE_MAP_KEY ' on "
|
|
|
3604df |
+ "volume %s", volinfo->volname);
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+ }
|
|
|
3604df |
+ ret = dict_get_str (volinfo->dict, "transport.address-family",
|
|
|
3604df |
+ &address_family_str);
|
|
|
3604df |
+ if (ret) {
|
|
|
3604df |
+ if (volinfo->transport_type == GF_TRANSPORT_TCP) {
|
|
|
3604df |
+ ret = dict_set_dynstr_with_alloc
|
|
|
3604df |
+ (volinfo->dict,
|
|
|
3604df |
+ "transport.address-family",
|
|
|
3604df |
+ "inet");
|
|
|
3604df |
+ if (ret) {
|
|
|
3604df |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
3604df |
+ errno, GD_MSG_DICT_SET_FAILED,
|
|
|
3604df |
+ "failed to set transport."
|
|
|
3604df |
+ "address-family on %s",
|
|
|
3604df |
+ volinfo->volname);
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+ }
|
|
|
3604df |
+ }
|
|
|
3604df |
+ }
|
|
|
3604df |
+ ret = glusterd_store_volinfo (volinfo,
|
|
|
3604df |
+ GLUSTERD_VOLINFO_VER_AC_INCREMENT);
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ return ret;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+static int
|
|
|
3604df |
glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
|
|
|
3604df |
char **op_errstr)
|
|
|
3604df |
{
|
|
|
3604df |
@@ -2319,8 +2381,7 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
|
|
|
3604df |
}
|
|
|
3604df |
}
|
|
|
3604df |
cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
|
|
|
3604df |
- ret = glusterd_store_volinfo
|
|
|
3604df |
- (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
|
|
|
3604df |
+ ret = glusterd_update_volumes_dict (volinfo);
|
|
|
3604df |
if (ret)
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
3604df |
index fcb4b3e..95dbafa 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
3604df |
@@ -278,6 +278,7 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req)
|
|
|
3604df |
char err_str[2048] = {0,};
|
|
|
3604df |
gf_cli_rsp rsp = {0,};
|
|
|
3604df |
xlator_t *this = NULL;
|
|
|
3604df |
+ glusterd_conf_t *conf = NULL;
|
|
|
3604df |
char *free_ptr = NULL;
|
|
|
3604df |
char *trans_type = NULL;
|
|
|
3604df |
char *address_family_str = NULL;
|
|
|
3604df |
@@ -292,6 +293,9 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req)
|
|
|
3604df |
this = THIS;
|
|
|
3604df |
GF_ASSERT(this);
|
|
|
3604df |
|
|
|
3604df |
+ conf = this->private;
|
|
|
3604df |
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
|
|
|
3604df |
+
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
|
|
|
3604df |
if (ret < 0) {
|
|
|
3604df |
@@ -385,14 +389,19 @@ __glusterd_handle_create_volume (rpcsvc_request_t *req)
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
} else if (!strcmp(trans_type, "tcp")) {
|
|
|
3604df |
- /* Setting default as inet for trans_type tcp */
|
|
|
3604df |
- ret = dict_set_dynstr_with_alloc (dict,
|
|
|
3604df |
- "transport.address-family",
|
|
|
3604df |
- "inet");
|
|
|
3604df |
- if (ret) {
|
|
|
3604df |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
3604df |
- "failed to set transport.address-family");
|
|
|
3604df |
- goto out;
|
|
|
3604df |
+ /* Setting default as inet for trans_type tcp if the op-version
|
|
|
3604df |
+ * is >= 3.8.0
|
|
|
3604df |
+ */
|
|
|
3604df |
+ if (conf->op_version >= GD_OP_VERSION_3_8_0) {
|
|
|
3604df |
+ ret = dict_set_dynstr_with_alloc (dict,
|
|
|
3604df |
+ "transport.address-family",
|
|
|
3604df |
+ "inet");
|
|
|
3604df |
+ if (ret) {
|
|
|
3604df |
+ gf_log (this->name, GF_LOG_ERROR,
|
|
|
3604df |
+ "failed to set "
|
|
|
3604df |
+ "transport.address-family");
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
}
|
|
|
3604df |
}
|
|
|
3604df |
ret = dict_get_str (dict, "bricks", &bricks);
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|