summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKaleb S KEITHLEY <kkeithle@redhat.com>2016-03-15 06:16:31 -0400
committerNiels de Vos <ndevos@redhat.com>2016-04-27 00:59:30 -0700
commita4f84d786b596387aa0d659fb5cc8a933c95c01b (patch)
tree85e0f319cf0405a632c5a268dfb25407c054dba8 /xlators
parent3c35329feb4dd479c9e4856ee27fa4b12c708db2 (diff)
glusterd: default value of nfs.disable, change from false to true
Next step in eventual deprecation of glusterfs nfs server in favor of ganesha.nfsd. Also replace several open-coded strings with constant. Change-Id: If52f5e880191a14fd38e69b70a32b0300dd93a50 BUG: 1092414 Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/13738 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-ganesha.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c10
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-nfs-svc.c28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-nfs-svc.h9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-helper.c8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c1
10 files changed, 47 insertions, 42 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index ddbb7446cda..821cd6feb39 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -689,7 +689,7 @@ start_ganesha (char **op_errstr)
vol_opts = volinfo->dict;
/* Gluster-nfs has to be disabled across the trusted pool */
/* before attempting to start nfs-ganesha */
- ret = dict_set_str (vol_opts, "nfs.disable", "on");
+ ret = dict_set_str (vol_opts, NFS_DISABLE_MAP_KEY, "on");
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index f10d3cec4cd..e2f3f5661cd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -1504,7 +1504,7 @@ glusterd_handle_cli_list_friends (rpcsvc_request_t *req)
__glusterd_handle_cli_list_friends);
}
-int
+static int
__glusterd_handle_cli_get_volume (rpcsvc_request_t *req)
{
int32_t ret = -1;
@@ -1524,9 +1524,7 @@ __glusterd_handle_cli_get_volume (rpcsvc_request_t *req)
goto out;
}
- gf_msg ("glusterd", GF_LOG_INFO, 0,
- GD_MSG_GET_VOL_REQ_RCVD,
- "Received get vol req");
+ gf_msg_plain (GF_LOG_INFO, "Received get vol req");
if (cli_req.dict.dict_len) {
/* Unserialize the dictionary */
@@ -1944,7 +1942,7 @@ glusterd_handle_ganesha_cmd (rpcsvc_request_t *req)
return glusterd_big_locked_handler (req, __glusterd_handle_ganesha_cmd);
}
-int
+static int
__glusterd_handle_reset_volume (rpcsvc_request_t *req)
{
int32_t ret = -1;
@@ -1959,6 +1957,8 @@ __glusterd_handle_reset_volume (rpcsvc_request_t *req)
this = THIS;
GF_ASSERT (this);
+ gf_msg_plain (GF_LOG_DEBUG, "Received reset vol req");
+
ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
if (ret < 0) {
snprintf (err_str, sizeof (err_str), "Failed to decode request "
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
index ea24c1e1d25..60b792ffac2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
@@ -17,15 +17,7 @@
#include "glusterd-messages.h"
#include "glusterd-svc-helper.h"
-char *nfs_svc_name = "nfs";
-
-void
-glusterd_nfssvc_build (glusterd_svc_t *svc)
-{
- svc->manager = glusterd_nfssvc_manager;
- svc->start = glusterd_nfssvc_start;
- svc->stop = glusterd_nfssvc_stop;
-}
+static char *nfs_svc_name = "nfs";
static gf_boolean_t
glusterd_nfssvc_need_start ()
@@ -40,7 +32,7 @@ glusterd_nfssvc_need_start ()
if (!glusterd_is_volume_started (volinfo))
continue;
- if (dict_get_str_boolean (volinfo->dict, "nfs.disable", 0))
+ if (dict_get_str_boolean (volinfo->dict, NFS_DISABLE_MAP_KEY, 1))
continue;
start = _gf_true;
break;
@@ -67,7 +59,7 @@ glusterd_nfssvc_create_volfile ()
filepath, NULL);
}
-int
+static int
glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags)
{
int ret = -1;
@@ -108,15 +100,13 @@ out:
return ret;
}
-int
+static int
glusterd_nfssvc_start (glusterd_svc_t *svc, int flags)
{
return glusterd_svc_start (svc, flags, NULL);
-
- return 0;
}
-int
+static int
glusterd_nfssvc_stop (glusterd_svc_t *svc, int sig)
{
int ret = -1;
@@ -137,6 +127,14 @@ out:
return ret;
}
+void
+glusterd_nfssvc_build (glusterd_svc_t *svc)
+{
+ svc->manager = glusterd_nfssvc_manager;
+ svc->start = glusterd_nfssvc_start;
+ svc->stop = glusterd_nfssvc_stop;
+}
+
int
glusterd_nfssvc_reconfigure ()
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h
index 6b803ba6874..6330b71ba7d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h
@@ -20,15 +20,6 @@ int
glusterd_nfssvc_init (glusterd_svc_t *svc);
int
-glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags);
-
-int
-glusterd_nfssvc_start (glusterd_svc_t *svc, int flags);
-
-int
-glusterd_nfssvc_stop (glusterd_svc_t *svc, int sig);
-
-int
glusterd_nfssvc_reconfigure ();
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 339195b00e6..f3c0f1a5216 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -399,8 +399,6 @@ static char *glusterd_op_sm_event_names[] = {
"GD_OP_EVENT_INVALID"
};
-extern struct volopt_map_entry glusterd_volopt_map[];
-
char*
glusterd_op_sm_state_name_get (int state)
{
@@ -1661,7 +1659,8 @@ glusterd_op_stage_status_volume (dict_t *dict, char **op_errstr)
vol_opts = volinfo->dict;
if ((cmd & GF_CLI_STATUS_NFS) != 0) {
- nfs_disabled = dict_get_str_boolean (vol_opts, "nfs.disable",
+ nfs_disabled = dict_get_str_boolean (vol_opts,
+ NFS_DISABLE_MAP_KEY,
_gf_false);
if (nfs_disabled) {
ret = -1;
@@ -3295,7 +3294,7 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
}
nfs_disabled = dict_get_str_boolean (vol_opts,
- "nfs.disable",
+ NFS_DISABLE_MAP_KEY,
_gf_false);
if (!nfs_disabled) {
ret = glusterd_add_node_to_dict
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
index 7cb44ba688f..44ee6d08d68 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
@@ -183,15 +183,11 @@ glusterd_svc_check_volfile_identical (char *svc_name,
need_unlink = 1;
- ret = glusterd_create_global_volfile (builder,
- tmpvol, NULL);
+ ret = glusterd_create_global_volfile (builder, tmpvol, NULL);
if (ret)
goto out;
- ret = glusterd_check_files_identical (orgvol, tmpvol,
- identical);
- if (ret)
- goto out;
+ ret = glusterd_check_files_identical (orgvol, tmpvol, identical);
out:
if (need_unlink)
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index b1076c835fd..807b4ecf5e6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -10484,6 +10484,26 @@ glusterd_enable_default_options (glusterd_volinfo_t *volinfo, char *option)
conf = this->private;
GF_ASSERT (conf);
+#ifdef GD_OP_VERSION_3_8_0
+ if (conf->op_version >= GD_OP_VERSION_3_8_0) {
+ /* nfs.disable needs to be enabled for new volumes with
+ * >= gluster version 3.7 (for now) 3.8 later
+ */
+ if (!option || !strcmp (NFS_DISABLE_MAP_KEY, option)) {
+ ret = dict_set_dynstr_with_alloc (volinfo->dict,
+ NFS_DISABLE_MAP_KEY, "on");
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
+ "Failed to set option '"
+ NFS_DISABLE_MAP_KEY "' on volume "
+ "%s", volinfo->volname);
+ goto out;
+ }
+ }
+ }
+#endif
+
if (conf->op_version >= GD_OP_VERSION_3_7_0) {
/* Set needed volume options in volinfo->dict
* For ex.,
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 50ca60a2e6c..24e99d2be9f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -4953,7 +4953,7 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
if (voliter->status != GLUSTERD_STATUS_STARTED)
continue;
- if (dict_get_str_boolean (voliter->dict, "nfs.disable", 0))
+ if (dict_get_str_boolean (voliter->dict, NFS_DISABLE_MAP_KEY, 0))
continue;
ret = gf_asprintf (&skey, "rpc-auth.addr.%s.allow",
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index a01ef3a74fb..befe618454a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2577,7 +2577,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
if (option) {
gf_msg_debug (this->name, 0, "NFS-Ganesha is enabled");
/* Gluster-nfs should not start when NFS-Ganesha is enabled*/
- ret = dict_set_str (volinfo->dict, "nfs.disable", "on");
+ ret = dict_set_str (volinfo->dict, NFS_DISABLE_MAP_KEY, "on");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED, "Failed to set nfs.disable for"
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 40323bb7ece..d07a5f07cb4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -2146,6 +2146,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
{ .key = NFS_DISABLE_MAP_KEY,
.voltype = "nfs/server",
.option = "!nfs-disable",
+ .value = "on",
.op_version = 1
},
{ .key = "nfs.nlm",