summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2017-03-27 16:09:56 -0400
committerKaleb KEITHLEY <kkeithle@redhat.com>2017-04-28 14:08:41 +0000
commit83abcba6b42f94eb5a6495a634d4055362a9d79d (patch)
tree401e7638258acf9ef4c04af00a0bbfc443b570e3 /xlators/mgmt
parentab88f655e6423f51e2f2fac9265ff4d4f5c3e579 (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')
-rw-r--r--xlators/mgmt/glusterd/src/Makefile.am4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-messages.h11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-nfs-svc.c28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c35
6 files changed, 36 insertions, 50 deletions
diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
index 4858deeeedd..b0f5a9b540c 100644
--- a/xlators/mgmt/glusterd/src/Makefile.am
+++ b/xlators/mgmt/glusterd/src/Makefile.am
@@ -1,6 +1,8 @@
xlator_LTLIBRARIES = glusterd.la
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mgmt
-glusterd_la_CPPFLAGS = $(AM_CPPFLAGS) "-DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\""
+glusterd_la_CPPFLAGS = $(AM_CPPFLAGS) \
+ -DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\" \
+ -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\"
glusterd_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS)
glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \
glusterd-op-sm.c glusterd-utils.c glusterd-rpc-ops.c \
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index efeda0d4edf..8cfc26ce905 100644
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
@@ -41,7 +41,7 @@
#define GLUSTERD_COMP_BASE GLFS_MSGID_GLUSTERD
-#define GLFS_NUM_MESSAGES 599
+#define GLFS_NUM_MESSAGES 600
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
@@ -4842,8 +4842,17 @@
* @recommendedaction
*
*/
+
#define GD_MSG_CLIENTS_GET_STATE_FAILED (GLUSTERD_COMP_BASE + 599)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_GNFS_XLATOR_NOT_INSTALLED (GLUSTERD_COMP_BASE + 600)
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
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;
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h
index c505d1e897c..8b70a62a4e3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h
@@ -29,7 +29,6 @@ struct glusterd_svc_ {
char name[PATH_MAX];
glusterd_conn_t conn;
glusterd_proc_t proc;
- glusterd_svc_build_t build;
glusterd_svc_manager_t manager;
glusterd_svc_start_t start;
glusterd_svc_stop_t stop;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 32ebcb8b9b2..e00d9a12fa5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -597,11 +597,8 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo)
new_volinfo->xl = THIS;
- new_volinfo->snapd.svc.build = glusterd_snapdsvc_build;
- new_volinfo->snapd.svc.build (&(new_volinfo->snapd.svc));
-
- new_volinfo->tierd.svc.build = glusterd_tierdsvc_build;
- new_volinfo->tierd.svc.build (&(new_volinfo->tierd.svc));
+ glusterd_snapdsvc_build (&new_volinfo->snapd.svc);
+ glusterd_tierdsvc_build (&new_volinfo->tierd.svc);
pthread_mutex_init (&new_volinfo->reflock, NULL);
*volinfo = glusterd_volinfo_ref (new_volinfo);
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 0f6d888b968..0a2641842aa 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1331,34 +1331,6 @@ out:
return ret;
}
-static void
-glusterd_svcs_build ()
-{
- xlator_t *this = NULL;
- glusterd_conf_t *priv = NULL;
-
- this = THIS;
- GF_ASSERT (this);
-
- priv = this->private;
- GF_ASSERT (priv);
-
- priv->shd_svc.build = glusterd_shdsvc_build;
- priv->shd_svc.build (&(priv->shd_svc));
-
- priv->nfs_svc.build = glusterd_nfssvc_build;
- priv->nfs_svc.build (&(priv->nfs_svc));
-
- priv->quotad_svc.build = glusterd_quotadsvc_build;
- priv->quotad_svc.build (&(priv->quotad_svc));
-
- priv->bitd_svc.build = glusterd_bitdsvc_build;
- priv->bitd_svc.build (&(priv->bitd_svc));
-
- priv->scrub_svc.build = glusterd_scrubsvc_build;
- priv->scrub_svc.build (&(priv->scrub_svc));
-}
-
static int
is_upgrade (dict_t *options, gf_boolean_t *upgrade)
{
@@ -1806,7 +1778,12 @@ init (xlator_t *this)
this->private = conf;
glusterd_mgmt_v3_lock_init ();
glusterd_txn_opinfo_dict_init ();
- glusterd_svcs_build ();
+
+ glusterd_shdsvc_build (&conf->shd_svc);
+ glusterd_nfssvc_build (&conf->nfs_svc);
+ glusterd_quotadsvc_build (&conf->quotad_svc);
+ glusterd_bitdsvc_build (&conf->bitd_svc);
+ glusterd_scrubsvc_build (&conf->scrub_svc);
/* Make install copies few of the hook-scripts by creating hooks
* directory. Hence purposefully not doing the check for the presence of