diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2017-03-27 16:09:56 -0400 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2017-04-28 14:08:41 +0000 |
commit | 83abcba6b42f94eb5a6495a634d4055362a9d79d (patch) | |
tree | 401e7638258acf9ef4c04af00a0bbfc443b570e3 /xlators/mgmt/glusterd/src/glusterd-nfs-svc.c | |
parent | ab88f655e6423f51e2f2fac9265ff4d4f5c3e579 (diff) |
build: conditionally build legacy gNFS server and associated sub-packaging
Plus some additional logic in glusterd to ensure gnfs (glusterfs)
daemons are never started if server/nfs xlator is not installed.
As a service, nfs is still initialized. The glusterfs-gnfs RPM
may be installed or uninstalled independent of anything else,
including on a system where gluster is actively running, so the
existence of the xlator is always tested before trying to start
gnfs.
Change-Id: I56743ad1cb36a84917226d7d26cb9d015d441e66
BUG: 1326219
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/16958
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-nfs-svc.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-nfs-svc.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c index da343420790..bff4c6cf5d5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c @@ -10,6 +10,7 @@ #include "globals.h" #include "run.h" +#include "syscall.h" #include "glusterd.h" #include "glusterd-utils.h" #include "glusterd-volgen.h" @@ -17,8 +18,6 @@ #include "glusterd-messages.h" #include "glusterd-svc-helper.h" -static char *nfs_svc_name = "nfs"; - static gf_boolean_t glusterd_nfssvc_need_start () { @@ -41,19 +40,13 @@ glusterd_nfssvc_need_start () return start; } -int -glusterd_nfssvc_init (glusterd_svc_t *svc) -{ - return glusterd_svc_init (svc, nfs_svc_name); -} - static int glusterd_nfssvc_create_volfile () { char filepath[PATH_MAX] = {0,}; glusterd_conf_t *conf = THIS->private; - glusterd_svc_build_volfile_path (nfs_svc_name, conf->workdir, + glusterd_svc_build_volfile_path (conf->nfs_svc.name, conf->workdir, filepath, sizeof (filepath)); return glusterd_create_global_volfile (build_nfs_graph, filepath, NULL); @@ -65,15 +58,16 @@ glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags) int ret = -1; if (!svc->inited) { - ret = glusterd_nfssvc_init (svc); + ret = glusterd_svc_init (svc, "nfs"); if (ret) { gf_msg (THIS->name, GF_LOG_ERROR, 0, - GD_MSG_FAILED_INIT_NFSSVC, "Failed to init nfs " - "service"); + GD_MSG_FAILED_INIT_NFSSVC, + "Failed to init nfs service"); goto out; } else { svc->inited = _gf_true; - gf_msg_debug (THIS->name, 0, "nfs service initialized"); + gf_msg_debug (THIS->name, 0, + "nfs service initialized"); } } @@ -81,6 +75,14 @@ glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags) if (ret) goto out; + /* not an error, or a (very) soft error at best */ + if (sys_access (XLATORDIR "/nfs/server.so", R_OK) != 0) { + gf_msg (THIS->name, GF_LOG_INFO, 0, + GD_MSG_GNFS_XLATOR_NOT_INSTALLED, + "nfs/server.so xlator is not installed"); + goto out; + } + ret = glusterd_nfssvc_create_volfile (); if (ret) goto out; |