summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-12-03 12:57:13 +0200
committerAmar Tumballi <amarts@gmail.com>2019-12-18 03:47:42 +0000
commit194e4216c8e30612f96f8f3712fdb3f1c96b3a08 (patch)
treede825272940d753f129b43187837f7f5c3584d69
parent6f6b253deed134c5fee37e1e3d2fd44b18e1db6e (diff)
[RFC]#ifdef gNFS related code if we are not compiling gNFS
If we are not compiling gNFS (--enable-gnfs is not given in the ./configure script params), there is little point in compiling code that is related to it. This patch tries to eliminate it. My hope (and it's not clear from the code ) is that I did not break the NFS Ganesha support as well. Other than that, tried to compile with and without anad it looks sane. Change-Id: I8d6c98066b9fceab4ec10fc6f5e81ab069e853bd updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
-rw-r--r--configure.ac1
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-ganesha.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-nfs-svc.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-nfs-svc.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-reset-brick.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-statedump.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-helper.c8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c17
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c23
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c9
17 files changed, 67 insertions, 30 deletions
diff --git a/configure.ac b/configure.ac
index 772958d..d9af961 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1317,6 +1317,7 @@ AC_ARG_ENABLE([gnfs],
[Enable legacy gnfs server xlator.]))
if test "x${with_server}" = "xyes" -a "x$enable_gnfs" = "xyes"; then
BUILD_GNFS="yes"
+ GF_CFLAGS="$GF_CFLAGS -DBUILD_GNFS"
RPCBIND_SERVICE="rpcbind.service"
fi
AM_CONDITIONAL([BUILD_GNFS], [test x$BUILD_GNFS = xyes])
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index c63e1e2..a984a43 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -1492,10 +1492,12 @@ glusterfs_handle_node_status(rpcsvc_request_t *req)
}
any = active->first;
- if ((cmd & GF_CLI_STATUS_NFS) != 0)
- ret = gf_asprintf(&node_name, "%s", "nfs-server");
- else if ((cmd & GF_CLI_STATUS_SHD) != 0)
+ if ((cmd & GF_CLI_STATUS_SHD) != 0)
ret = gf_asprintf(&node_name, "%s", "glustershd");
+#ifdef BUILD_GNFS
+ else if ((cmd & GF_CLI_STATUS_NFS) != 0)
+ ret = gf_asprintf(&node_name, "%s", "nfs-server");
+#endif
else if ((cmd & GF_CLI_STATUS_QUOTAD) != 0)
ret = gf_asprintf(&node_name, "%s", "quotad");
else if ((cmd & GF_CLI_STATUS_BITD) != 0)
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index caba34f..0c18cc4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -13,7 +13,6 @@
#include "glusterd-op-sm.h"
#include "glusterd-store.h"
#include "glusterd-utils.h"
-#include "glusterd-nfs-svc.h"
#include "glusterd-volgen.h"
#include "glusterd-messages.h"
#include <glusterfs/syscall.h>
@@ -793,12 +792,13 @@ start_ganesha(char **op_errstr)
cds_list_for_each_entry(volinfo, &priv->volumes, vol_list)
{
vol_opts = volinfo->dict;
+#ifdef BUILD_GNFS
/* Gluster-nfs has to be disabled across the trusted pool */
/* before attempting to start nfs-ganesha */
ret = dict_set_str(vol_opts, NFS_DISABLE_MAP_KEY, "on");
if (ret)
goto out;
-
+#endif
ret = glusterd_store_volinfo(volinfo,
GLUSTERD_VOLINFO_VER_AC_INCREMENT);
if (ret) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
index 36e9052..4908dbb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
@@ -8,6 +8,8 @@
cases as published by the Free Software Foundation.
*/
+#ifdef BUILD_GNFS
+
#include <glusterfs/globals.h>
#include <glusterfs/run.h>
#include <glusterfs/syscall.h>
@@ -223,3 +225,4 @@ out:
gf_msg_debug(this ? this->name : "glusterd", 0, "Returning %d", ret);
return ret;
}
+#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h
index 47e8983..6bfdde9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.h
@@ -13,6 +13,7 @@
#include "glusterd-svc-mgmt.h"
+#ifdef BUILD_GNFS
void
glusterd_nfssvc_build(glusterd_svc_t *svc);
@@ -22,4 +23,5 @@ glusterd_nfssvc_init(glusterd_svc_t *svc);
int
glusterd_nfssvc_reconfigure();
+#endif /* BUILD_GNFS */
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index ab7e170..2e57539 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -38,7 +38,6 @@
#include "glusterd-svc-helper.h"
#include "glusterd-shd-svc-helper.h"
#include "glusterd-shd-svc.h"
-#include "glusterd-nfs-svc.h"
#include "glusterd-quotad-svc.h"
#include "glusterd-server-quorum.h"
#include <sys/types.h>
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index 53d5605..5985ab2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -14,7 +14,6 @@
#include "glusterd-op-sm.h"
#include "glusterd-store.h"
#include "glusterd-utils.h"
-#include "glusterd-nfs-svc.h"
#include "glusterd-quotad-svc.h"
#include "glusterd-volgen.h"
#include "glusterd-messages.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index efaddde..a861240 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -18,7 +18,6 @@
#include "glusterd-utils.h"
#include "glusterd-svc-mgmt.h"
#include "glusterd-svc-helper.h"
-#include "glusterd-nfs-svc.h"
#include "glusterd-volgen.h"
#include "glusterd-messages.h"
#include "glusterd-server-quorum.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
index b591d84..e4d247a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
@@ -18,7 +18,6 @@
#include "glusterd-utils.h"
#include "glusterd-svc-mgmt.h"
#include "glusterd-svc-helper.h"
-#include "glusterd-nfs-svc.h"
#include "glusterd-volgen.h"
#include "glusterd-messages.h"
#include "glusterd-mgmt.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd-statedump.c b/xlators/mgmt/glusterd/src/glusterd-statedump.c
index 69d4cf4..735b5d4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-statedump.c
+++ b/xlators/mgmt/glusterd/src/glusterd-statedump.c
@@ -12,7 +12,6 @@
#include "glusterd.h"
#include "glusterd-shd-svc.h"
#include "glusterd-quotad-svc.h"
-#include "glusterd-nfs-svc.h"
#include "glusterd-locks.h"
#include "glusterd-messages.h"
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
index 3b965ea..a27838b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
@@ -17,7 +17,9 @@
#include "glusterd-svc-mgmt.h"
#include "glusterd-shd-svc.h"
#include "glusterd-quotad-svc.h"
+#ifdef BUILD_GNFS
#include "glusterd-nfs-svc.h"
+#endif
#include "glusterd-bitd-svc.h"
#include "glusterd-shd-svc-helper.h"
#include "glusterd-scrub-svc.h"
@@ -38,11 +40,12 @@ glusterd_svcs_reconfigure(glusterd_volinfo_t *volinfo)
conf = this->private;
GF_ASSERT(conf);
+#ifdef BUILD_GNFS
svc_name = "nfs";
ret = glusterd_nfssvc_reconfigure();
if (ret)
goto out;
-
+#endif
svc_name = "self-heald";
if (volinfo) {
ret = glusterd_shdsvc_reconfigure(volinfo);
@@ -122,10 +125,11 @@ glusterd_svcs_manager(glusterd_volinfo_t *volinfo)
if (volinfo && volinfo->is_snap_volume)
return 0;
+#if BUILD_GNFS
ret = conf->nfs_svc.manager(&(conf->nfs_svc), NULL, PROC_START_NO_WAIT);
if (ret)
goto out;
-
+#endif
if (conf->op_version == GD_OP_VERSION_MIN)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 6b44ebd..4809e5f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -53,7 +53,6 @@
#include "glusterd-svc-mgmt.h"
#include "glusterd-svc-helper.h"
#include "glusterd-shd-svc.h"
-#include "glusterd-nfs-svc.h"
#include "glusterd-quotad-svc.h"
#include "glusterd-snapd-svc.h"
#include "glusterd-bitd-svc.h"
@@ -91,6 +90,7 @@
#define NLMV4_VERSION 4
#define NLMV1_VERSION 1
+#ifdef BUILD_GNFS
#define GLUSTERD_GET_NFS_PIDFILE(pidfile, priv) \
do { \
int32_t _nfs_pid_len; \
@@ -100,6 +100,7 @@
pidfile[0] = 0; \
} \
} while (0)
+#endif
#define GLUSTERD_GET_QUOTAD_PIDFILE(pidfile, priv) \
do { \
@@ -5498,12 +5499,14 @@ glusterd_add_node_to_dict(char *server, dict_t *dict, int count,
*/
keylen = snprintf(key, sizeof(key), "brick%d.hostname", count);
- if (!strcmp(server, priv->nfs_svc.name))
- ret = dict_set_nstrn(dict, key, keylen, "NFS Server",
- SLEN("NFS Server"));
- else if (!strcmp(server, priv->quotad_svc.name))
+ if (!strcmp(server, priv->quotad_svc.name))
ret = dict_set_nstrn(dict, key, keylen, "Quota Daemon",
SLEN("Quota Daemon"));
+#ifdef BUILD_GNFS
+ else if (!strcmp(server, priv->nfs_svc.name))
+ ret = dict_set_nstrn(dict, key, keylen, "NFS Server",
+ SLEN("NFS Server"));
+#endif
else if (!strcmp(server, priv->bitd_svc.name))
ret = dict_set_nstrn(dict, key, keylen, "Bitrot Daemon",
SLEN("Bitrot Daemon"));
@@ -5518,6 +5521,7 @@ glusterd_add_node_to_dict(char *server, dict_t *dict, int count,
if (ret)
goto out;
+#ifdef BUILD_GNFS
/* Port is available only for the NFS server.
* Self-heal daemon doesn't provide any port for access
* by entities other than gluster.
@@ -5531,6 +5535,7 @@ glusterd_add_node_to_dict(char *server, dict_t *dict, int count,
} else
port = GF_NFS3_PORT;
}
+#endif
keylen = snprintf(key, sizeof(key), "brick%d.port", count);
ret = dict_set_int32n(dict, key, keylen, port);
if (ret)
@@ -8734,6 +8739,7 @@ glusterd_brick_terminate(glusterd_volinfo_t *volinfo,
op_errstr, SIGTERM);
}
+#ifdef BUILD_GNFS
int
glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr)
{
@@ -8815,6 +8821,7 @@ out:
GF_FREE(dup_options);
return ret;
}
+#endif
int
glusterd_client_statedump(char *volname, char *options, int option_cnt,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 7ee5984..b58f158 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -403,8 +403,10 @@ glusterd_brick_terminate(glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo, char *options,
int option_cnt, char **op_errstr);
+#ifdef BUILD_GNFS
int
glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr);
+#endif
int
glusterd_client_statedump(char *volname, char *options, int option_cnt,
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 2036272..61bc597 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1154,9 +1154,11 @@ get_transport_type(glusterd_volinfo_t *volinfo, dict_t *set_dict, char *transt,
if (ret)
get_vol_transport_type(volinfo, transt);
} else {
+#ifdef BUILD_GNFS
ret = dict_get_str_sizen(set_dict, "nfs.transport-type", &tt);
if (ret)
get_vol_nfs_transport_type(volinfo, transt);
+#endif
}
if (!ret)
@@ -2933,8 +2935,10 @@ _get_xlator_opt_key_from_vme(struct volopt_map_entry *vme, char **key)
*key = gf_strdup(AUTH_ALLOW_OPT_KEY);
else if (!strcmp(vme->key, AUTH_REJECT_MAP_KEY))
*key = gf_strdup(AUTH_REJECT_OPT_KEY);
+#ifdef BUILD_GNFS
else if (!strcmp(vme->key, NFS_DISABLE_MAP_KEY))
*key = gf_strdup(NFS_DISABLE_OPT_KEY);
+#endif
else {
if (vme->option) {
if (vme->option[0] == '!') {
@@ -3906,11 +3910,13 @@ client_graph_set_perf_options(volgen_graph_t *graph,
volname = volinfo->volname;
+#ifdef BUILD_GNFS
tmp_data = dict_get_sizen(set_dict, "nfs-volume-file");
if (!tmp_data)
return volgen_graph_set_options_generic(graph, set_dict, volinfo,
&perfxl_option_handler);
else
+#endif
return volgen_graph_set_options_generic(graph, set_dict, volname,
&nfsperfxl_option_handler);
}
@@ -4354,6 +4360,7 @@ out:
return ret;
}
+#ifdef BUILD_GNFS
static int
nfs_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
void *param)
@@ -4434,6 +4441,7 @@ out:
return 0;
}
+#endif
char *
volgen_get_shd_key(int type)
{
@@ -4722,6 +4730,8 @@ out:
return ret;
}
+#ifdef BUILD_GNFS
+
static int
volgen_graph_set_iam_nfsd(const volgen_graph_t *graph)
{
@@ -4914,7 +4924,7 @@ out:
return ret;
}
-
+#endif
/****************************
*
* Volume generation interface
@@ -6105,7 +6115,8 @@ out:
return ret;
}
-int
+#ifdef BUILD_GNFS
+static int
validate_nfsopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
char **op_errstr)
{
@@ -6170,6 +6181,7 @@ out:
gf_msg_debug(this->name, 0, "Returning %d", ret);
return ret;
}
+#endif
int
validate_clientopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
@@ -6287,13 +6299,13 @@ glusterd_validate_globalopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
gf_msg_debug("glusterd", 0, "Could not Validate client");
goto out;
}
-
+#ifdef BUILD_GNFS
ret = validate_nfsopts(volinfo, val_dict, op_errstr);
if (ret) {
gf_msg_debug("glusterd", 0, "Could not Validate nfs");
goto out;
}
-
+#endif
ret = validate_shdopts(volinfo, val_dict, op_errstr);
if (ret) {
gf_msg_debug("glusterd", 0, "Could not Validate self-heald");
@@ -6343,12 +6355,13 @@ glusterd_validate_reconfopts(glusterd_volinfo_t *volinfo, dict_t *val_dict,
goto out;
}
+#ifdef BUILD_GNFS
ret = validate_nfsopts(volinfo, val_dict, op_errstr);
if (ret) {
gf_msg_debug("glusterd", 0, "Could not Validate nfs");
goto out;
}
-
+#endif
ret = validate_shdopts(volinfo, val_dict, op_errstr);
if (ret) {
gf_msg_debug("glusterd", 0, "Could not Validate self-heald");
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index 30e6820..cd4d0c7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -216,9 +216,10 @@ int
build_shd_graph(glusterd_volinfo_t *volinfo, volgen_graph_t *graph,
dict_t *mod_dict);
+#ifdef BUILD_GNFS
int
build_nfs_graph(volgen_graph_t *graph, dict_t *mod_dict);
-
+#endif
int
build_quotad_graph(volgen_graph_t *graph, dict_t *mod_dict);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 4d084e3..b2bb246 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2786,16 +2786,16 @@ glusterd_op_statedump_volume(dict_t *dict, char **op_errstr)
if (ret)
goto out;
gf_msg_debug("glusterd", 0, "Performing statedump on volume %s", volname);
- if (strstr(options, "nfs") != NULL) {
- ret = glusterd_nfs_statedump(options, option_cnt, op_errstr);
+ if (strstr(options, "quotad")) {
+ ret = glusterd_quotad_statedump(options, option_cnt, op_errstr);
if (ret)
goto out;
-
- } else if (strstr(options, "quotad")) {
- ret = glusterd_quotad_statedump(options, option_cnt, op_errstr);
+#ifdef BUILD_GNFS
+ } else if (strstr(options, "nfs") != NULL) {
+ ret = glusterd_nfs_statedump(options, option_cnt, op_errstr);
if (ret)
goto out;
-
+#endif
} else if (strstr(options, "client")) {
ret = glusterd_client_statedump(volname, options, option_cnt,
op_errstr);
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index c17f285..cd2c5da 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -37,7 +37,9 @@
#include "glusterd-locks.h"
#include "glusterd-svc-mgmt.h"
#include "glusterd-shd-svc.h"
+#ifdef BUILD_GNFS
#include "glusterd-nfs-svc.h"
+#endif
#include "glusterd-bitd-svc.h"
#include "glusterd-scrub-svc.h"
#include "glusterd-quotad-svc.h"
@@ -1562,6 +1564,7 @@ init(xlator_t *this)
exit(1);
}
+#ifdef BUILD_GNFS
ret = glusterd_init_var_run_dirs(this, rundir, GLUSTERD_NFS_RUN_DIR);
if (ret) {
gf_msg(this->name, GF_LOG_CRITICAL, 0, GD_MSG_CREATE_DIR_FAILED,
@@ -1569,6 +1572,7 @@ init(xlator_t *this)
"nfs running directory");
exit(1);
}
+#endif
ret = glusterd_init_var_run_dirs(this, rundir, GLUSTERD_QUOTAD_RUN_DIR);
if (ret) {
@@ -1662,6 +1666,7 @@ init(xlator_t *this)
exit(1);
}
+#ifdef BUILD_GNFS
len = snprintf(storedir, sizeof(storedir), "%s/nfs", workdir);
if ((len < 0) || (len >= sizeof(storedir))) {
exit(1);
@@ -1674,7 +1679,7 @@ init(xlator_t *this)
storedir, errno);
exit(1);
}
-
+#endif
len = snprintf(storedir, sizeof(storedir), "%s/bitd", workdir);
if ((len < 0) || (len >= sizeof(storedir))) {
exit(1);
@@ -1921,7 +1926,9 @@ init(xlator_t *this)
glusterd_mgmt_v3_lock_timer_init();
glusterd_txn_opinfo_dict_init();
+#ifdef BUILD_GNFS
glusterd_nfssvc_build(&conf->nfs_svc);
+#endif
glusterd_quotadsvc_build(&conf->quotad_svc);
glusterd_bitdsvc_build(&conf->bitd_svc);
glusterd_scrubsvc_build(&conf->scrub_svc);