|
|
256ebe |
From 1029c27982d2f91cb2d3c4fcc19aa5171111dfb9 Mon Sep 17 00:00:00 2001
|
|
|
256ebe |
From: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
256ebe |
Date: Mon, 16 Oct 2017 14:24:29 +0530
|
|
|
256ebe |
Subject: [PATCH 054/124] Revert "glusterd: (storhaug) remove ganesha"
|
|
|
256ebe |
|
|
|
256ebe |
This reverts commit 843e1b04b554ab887ec656ae7b468bb93ee4e2f7.
|
|
|
256ebe |
|
|
|
256ebe |
Label: DOWNSTREAM ONLY
|
|
|
256ebe |
|
|
|
256ebe |
Change-Id: I06b5450344c33f26da3d94b6f67051d41dfbba17
|
|
|
256ebe |
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
256ebe |
Reviewed-on: https://code.engineering.redhat.com/gerrit/167103
|
|
|
256ebe |
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
|
|
|
256ebe |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
256ebe |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
256ebe |
---
|
|
|
256ebe |
cli/src/cli-cmd-global.c | 57 ++
|
|
|
256ebe |
cli/src/cli-cmd-parser.c | 122 ++-
|
|
|
256ebe |
cli/src/cli-cmd.c | 3 +-
|
|
|
256ebe |
cli/src/cli-rpc-ops.c | 82 ++
|
|
|
256ebe |
cli/src/cli.h | 4 +
|
|
|
256ebe |
xlators/mgmt/glusterd/src/Makefile.am | 4 +-
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-errno.h | 2 +-
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 915 +++++++++++++++++++++
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-handler.c | 79 ++
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-messages.h | 2 +-
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 45 +-
|
|
|
256ebe |
.../mgmt/glusterd/src/glusterd-snapshot-utils.c | 196 +++++
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-store.h | 2 +
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 37 +
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 7 +
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd.h | 22 +
|
|
|
256ebe |
16 files changed, 1568 insertions(+), 11 deletions(-)
|
|
|
256ebe |
create mode 100644 xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/cli/src/cli-cmd-global.c b/cli/src/cli-cmd-global.c
|
|
|
256ebe |
index d0729ac..270b76f 100644
|
|
|
256ebe |
--- a/cli/src/cli-cmd-global.c
|
|
|
256ebe |
+++ b/cli/src/cli-cmd-global.c
|
|
|
256ebe |
@@ -36,6 +36,10 @@ int
|
|
|
256ebe |
cli_cmd_get_state_cbk(struct cli_state *state, struct cli_cmd_word *word,
|
|
|
256ebe |
const char **words, int wordcount);
|
|
|
256ebe |
|
|
|
256ebe |
+int
|
|
|
256ebe |
+cli_cmd_ganesha_cbk(struct cli_state *state, struct cli_cmd_word *word,
|
|
|
256ebe |
+ const char **words, int wordcount);
|
|
|
256ebe |
+
|
|
|
256ebe |
struct cli_cmd global_cmds[] = {
|
|
|
256ebe |
{
|
|
|
256ebe |
"global help",
|
|
|
256ebe |
@@ -48,6 +52,11 @@ struct cli_cmd global_cmds[] = {
|
|
|
256ebe |
cli_cmd_get_state_cbk,
|
|
|
256ebe |
"Get local state representation of mentioned daemon",
|
|
|
256ebe |
},
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ "nfs-ganesha {enable| disable} ",
|
|
|
256ebe |
+ cli_cmd_ganesha_cbk,
|
|
|
256ebe |
+ "Enable/disable NFS-Ganesha support",
|
|
|
256ebe |
+ },
|
|
|
256ebe |
{NULL, NULL, NULL}};
|
|
|
256ebe |
|
|
|
256ebe |
int
|
|
|
256ebe |
@@ -89,6 +98,54 @@ out:
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
int
|
|
|
256ebe |
+cli_cmd_ganesha_cbk(struct cli_state *state, struct cli_cmd_word *word,
|
|
|
256ebe |
+ const char **words, int wordcount)
|
|
|
256ebe |
+
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int sent = 0;
|
|
|
256ebe |
+ int parse_error = 0;
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ rpc_clnt_procedure_t *proc = NULL;
|
|
|
256ebe |
+ call_frame_t *frame = NULL;
|
|
|
256ebe |
+ dict_t *options = NULL;
|
|
|
256ebe |
+ cli_local_t *local = NULL;
|
|
|
256ebe |
+ char *op_errstr = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ proc = &cli_rpc_prog->proctable[GLUSTER_CLI_GANESHA];
|
|
|
256ebe |
+
|
|
|
256ebe |
+ frame = create_frame(THIS, THIS->ctx->pool);
|
|
|
256ebe |
+ if (!frame)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = cli_cmd_ganesha_parse(state, words, wordcount, &options, &op_errstr);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ if (op_errstr) {
|
|
|
256ebe |
+ cli_err("%s", op_errstr);
|
|
|
256ebe |
+ GF_FREE(op_errstr);
|
|
|
256ebe |
+ } else
|
|
|
256ebe |
+ cli_usage_out(word->pattern);
|
|
|
256ebe |
+ parse_error = 1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ CLI_LOCAL_INIT(local, words, frame, options);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (proc->fn) {
|
|
|
256ebe |
+ ret = proc->fn(frame, THIS, options);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ cli_cmd_sent_status_get(&sent);
|
|
|
256ebe |
+ if ((sent == 0) && (parse_error == 0))
|
|
|
256ebe |
+ cli_out("Setting global option failed");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ CLI_STACK_DESTROY(frame);
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
cli_cmd_get_state_cbk(struct cli_state *state, struct cli_cmd_word *word,
|
|
|
256ebe |
const char **words, int wordcount)
|
|
|
256ebe |
{
|
|
|
256ebe |
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
|
|
|
256ebe |
index d9ccba1..cd9c445 100644
|
|
|
256ebe |
--- a/cli/src/cli-cmd-parser.c
|
|
|
256ebe |
+++ b/cli/src/cli-cmd-parser.c
|
|
|
256ebe |
@@ -1694,7 +1694,7 @@ cli_cmd_volume_set_parse(struct cli_state *state, const char **words,
|
|
|
256ebe |
}
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
- if ((strcmp (key, "cluster.brick-multiplex") == 0)) {
|
|
|
256ebe |
+ if ((strcmp(key, "cluster.brick-multiplex") == 0)) {
|
|
|
256ebe |
question =
|
|
|
256ebe |
"Brick-multiplexing is supported only for "
|
|
|
256ebe |
"OCS converged or independent mode. Also it is "
|
|
|
256ebe |
@@ -1703,11 +1703,12 @@ cli_cmd_volume_set_parse(struct cli_state *state, const char **words,
|
|
|
256ebe |
"are running before this option is modified."
|
|
|
256ebe |
"Do you still want to continue?";
|
|
|
256ebe |
|
|
|
256ebe |
- answer = cli_cmd_get_confirmation (state, question);
|
|
|
256ebe |
+ answer = cli_cmd_get_confirmation(state, question);
|
|
|
256ebe |
if (GF_ANSWER_NO == answer) {
|
|
|
256ebe |
- gf_log ("cli", GF_LOG_ERROR, "Operation "
|
|
|
256ebe |
- "cancelled, exiting");
|
|
|
256ebe |
- *op_errstr = gf_strdup ("Aborted by user.");
|
|
|
256ebe |
+ gf_log("cli", GF_LOG_ERROR,
|
|
|
256ebe |
+ "Operation "
|
|
|
256ebe |
+ "cancelled, exiting");
|
|
|
256ebe |
+ *op_errstr = gf_strdup("Aborted by user.");
|
|
|
256ebe |
ret = -1;
|
|
|
256ebe |
goto out;
|
|
|
256ebe |
}
|
|
|
256ebe |
@@ -5848,3 +5849,114 @@ out:
|
|
|
256ebe |
|
|
|
256ebe |
return ret;
|
|
|
256ebe |
}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/* Parsing global option for NFS-Ganesha config
|
|
|
256ebe |
+ * gluster nfs-ganesha enable/disable */
|
|
|
256ebe |
+
|
|
|
256ebe |
+int32_t
|
|
|
256ebe |
+cli_cmd_ganesha_parse(struct cli_state *state, const char **words,
|
|
|
256ebe |
+ int wordcount, dict_t **options, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ dict_t *dict = NULL;
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ char *key = NULL;
|
|
|
256ebe |
+ char *value = NULL;
|
|
|
256ebe |
+ char *w = NULL;
|
|
|
256ebe |
+ char *opwords[] = {"enable", "disable", NULL};
|
|
|
256ebe |
+ const char *question = NULL;
|
|
|
256ebe |
+ gf_answer_t answer = GF_ANSWER_NO;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_ASSERT(words);
|
|
|
256ebe |
+ GF_ASSERT(options);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ dict = dict_new();
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!dict)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (wordcount != 2)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ key = (char *)words[0];
|
|
|
256ebe |
+ value = (char *)words[1];
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!key || !value) {
|
|
|
256ebe |
+ cli_out("Usage : nfs-ganesha <enable/disable>");
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = gf_strip_whitespace(value, strlen(value));
|
|
|
256ebe |
+ if (ret == -1)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strcmp(key, "nfs-ganesha")) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "Global option: error: ' %s '"
|
|
|
256ebe |
+ "is not a valid global option.",
|
|
|
256ebe |
+ key);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ w = str_getunamb(value, opwords);
|
|
|
256ebe |
+ if (!w) {
|
|
|
256ebe |
+ cli_out(
|
|
|
256ebe |
+ "Invalid global option \n"
|
|
|
256ebe |
+ "Usage : nfs-ganesha <enable/disable>");
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ question =
|
|
|
256ebe |
+ "Enabling NFS-Ganesha requires Gluster-NFS to be"
|
|
|
256ebe |
+ " disabled across the trusted pool. Do you "
|
|
|
256ebe |
+ "still want to continue?\n";
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strcmp(value, "enable") == 0) {
|
|
|
256ebe |
+ answer = cli_cmd_get_confirmation(state, question);
|
|
|
256ebe |
+ if (GF_ANSWER_NO == answer) {
|
|
|
256ebe |
+ gf_log("cli", GF_LOG_ERROR,
|
|
|
256ebe |
+ "Global operation "
|
|
|
256ebe |
+ "cancelled, exiting");
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ cli_out("This will take a few minutes to complete. Please wait ..");
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_set_str(dict, "key", key);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_log(THIS->name, GF_LOG_ERROR, "dict set on key failed");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_set_str(dict, "value", value);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_log(THIS->name, GF_LOG_ERROR, "dict set on value failed");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_set_str(dict, "globalname", "All");
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_log(THIS->name, GF_LOG_ERROR,
|
|
|
256ebe |
+ "dict set on global"
|
|
|
256ebe |
+ " key failed.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_set_int32(dict, "hold_global_locks", _gf_true);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_log(THIS->name, GF_LOG_ERROR,
|
|
|
256ebe |
+ "dict set on global key "
|
|
|
256ebe |
+ "failed.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ *options = dict;
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ dict_unref(dict);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
|
|
|
256ebe |
index 2ee8b1b..8c06905 100644
|
|
|
256ebe |
--- a/cli/src/cli-cmd.c
|
|
|
256ebe |
+++ b/cli/src/cli-cmd.c
|
|
|
256ebe |
@@ -366,7 +366,8 @@ cli_cmd_submit(struct rpc_clnt *rpc, void *req, call_frame_t *frame,
|
|
|
256ebe |
unsigned timeout = 0;
|
|
|
256ebe |
|
|
|
256ebe |
if ((GLUSTER_CLI_PROFILE_VOLUME == procnum) ||
|
|
|
256ebe |
- (GLUSTER_CLI_HEAL_VOLUME == procnum))
|
|
|
256ebe |
+ (GLUSTER_CLI_HEAL_VOLUME == procnum) ||
|
|
|
256ebe |
+ (GLUSTER_CLI_GANESHA == procnum))
|
|
|
256ebe |
timeout = cli_ten_minutes_timeout;
|
|
|
256ebe |
else
|
|
|
256ebe |
timeout = cli_default_conn_timeout;
|
|
|
256ebe |
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
|
|
|
256ebe |
index 12e7fcc..736cd18 100644
|
|
|
256ebe |
--- a/cli/src/cli-rpc-ops.c
|
|
|
256ebe |
+++ b/cli/src/cli-rpc-ops.c
|
|
|
256ebe |
@@ -2207,6 +2207,62 @@ out:
|
|
|
256ebe |
return ret;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+int
|
|
|
256ebe |
+gf_cli_ganesha_cbk(struct rpc_req *req, struct iovec *iov, int count,
|
|
|
256ebe |
+ void *myframe)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ gf_cli_rsp rsp = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ dict_t *dict = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_ASSERT(myframe);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (-1 == req->rpc_status) {
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
|
|
|
256ebe |
+ if (ret < 0) {
|
|
|
256ebe |
+ gf_log(((call_frame_t *)myframe)->this->name, GF_LOG_ERROR,
|
|
|
256ebe |
+ "Failed to decode xdr response");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ gf_log("cli", GF_LOG_DEBUG, "Received resp to ganesha");
|
|
|
256ebe |
+
|
|
|
256ebe |
+ dict = dict_new();
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!dict) {
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_unserialize(rsp.dict.dict_val, rsp.dict.dict_len, &dict);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (rsp.op_ret) {
|
|
|
256ebe |
+ if (strcmp(rsp.op_errstr, ""))
|
|
|
256ebe |
+ cli_err("nfs-ganesha: failed: %s", rsp.op_errstr);
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ cli_err("nfs-ganesha: failed");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ else {
|
|
|
256ebe |
+ cli_out("nfs-ganesha : success ");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = rsp.op_ret;
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ if (dict)
|
|
|
256ebe |
+ dict_unref(dict);
|
|
|
256ebe |
+ cli_cmd_broadcast_response(ret);
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
char *
|
|
|
256ebe |
is_server_debug_xlator(void *myframe)
|
|
|
256ebe |
{
|
|
|
256ebe |
@@ -4880,6 +4936,31 @@ out:
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
int32_t
|
|
|
256ebe |
+gf_cli_ganesha(call_frame_t *frame, xlator_t *this, void *data)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ gf_cli_req req = {{
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ }};
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+ dict_t *dict = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!frame || !this || !data) {
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ dict = data;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = cli_to_glusterd(&req, frame, gf_cli_ganesha_cbk,
|
|
|
256ebe |
+ (xdrproc_t)xdr_gf_cli_req, dict, GLUSTER_CLI_GANESHA,
|
|
|
256ebe |
+ this, cli_rpc_prog, NULL);
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ gf_log("cli", GF_LOG_DEBUG, "Returning %d", ret);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int32_t
|
|
|
256ebe |
gf_cli_set_volume(call_frame_t *frame, xlator_t *this, void *data)
|
|
|
256ebe |
{
|
|
|
256ebe |
gf_cli_req req = {{
|
|
|
256ebe |
@@ -12214,6 +12295,7 @@ struct rpc_clnt_procedure gluster_cli_actors[GLUSTER_CLI_MAXVALUE] = {
|
|
|
256ebe |
[GLUSTER_CLI_SYS_EXEC] = {"SYS_EXEC", gf_cli_sys_exec},
|
|
|
256ebe |
[GLUSTER_CLI_SNAP] = {"SNAP", gf_cli_snapshot},
|
|
|
256ebe |
[GLUSTER_CLI_BARRIER_VOLUME] = {"BARRIER VOLUME", gf_cli_barrier_volume},
|
|
|
256ebe |
+ [GLUSTER_CLI_GANESHA] = {"GANESHA", gf_cli_ganesha},
|
|
|
256ebe |
[GLUSTER_CLI_GET_VOL_OPT] = {"GET_VOL_OPT", gf_cli_get_vol_opt},
|
|
|
256ebe |
[GLUSTER_CLI_BITROT] = {"BITROT", gf_cli_bitrot},
|
|
|
256ebe |
[GLUSTER_CLI_ATTACH_TIER] = {"ATTACH_TIER", gf_cli_attach_tier},
|
|
|
256ebe |
diff --git a/cli/src/cli.h b/cli/src/cli.h
|
|
|
256ebe |
index b79a0a2..37e4d9d 100644
|
|
|
256ebe |
--- a/cli/src/cli.h
|
|
|
256ebe |
+++ b/cli/src/cli.h
|
|
|
256ebe |
@@ -282,6 +282,10 @@ cli_cmd_volume_set_parse(struct cli_state *state, const char **words,
|
|
|
256ebe |
int wordcount, dict_t **options, char **op_errstr);
|
|
|
256ebe |
|
|
|
256ebe |
int32_t
|
|
|
256ebe |
+cli_cmd_ganesha_parse(struct cli_state *state, const char **words,
|
|
|
256ebe |
+ int wordcount, dict_t **options, char **op_errstr);
|
|
|
256ebe |
+
|
|
|
256ebe |
+int32_t
|
|
|
256ebe |
cli_cmd_get_state_parse(struct cli_state *state, const char **words,
|
|
|
256ebe |
int wordcount, dict_t **options, char **op_errstr);
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
|
|
|
256ebe |
index c8dd8e3..5fe5156 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/Makefile.am
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/Makefile.am
|
|
|
256ebe |
@@ -10,7 +10,7 @@ glusterd_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS) $(LIB_DL)
|
|
|
256ebe |
glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \
|
|
|
256ebe |
glusterd-op-sm.c glusterd-utils.c glusterd-rpc-ops.c \
|
|
|
256ebe |
glusterd-store.c glusterd-handshake.c glusterd-pmap.c \
|
|
|
256ebe |
- glusterd-volgen.c glusterd-rebalance.c \
|
|
|
256ebe |
+ glusterd-volgen.c glusterd-rebalance.c glusterd-ganesha.c \
|
|
|
256ebe |
glusterd-quota.c glusterd-bitrot.c glusterd-geo-rep.c \
|
|
|
256ebe |
glusterd-replace-brick.c glusterd-log-ops.c glusterd-tier.c \
|
|
|
256ebe |
glusterd-volume-ops.c glusterd-brick-ops.c glusterd-mountbroker.c \
|
|
|
256ebe |
@@ -52,6 +52,8 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
|
|
|
256ebe |
-I$(CONTRIBDIR)/mount -I$(CONTRIBDIR)/userspace-rcu \
|
|
|
256ebe |
-DSBIN_DIR=\"$(sbindir)\" -DDATADIR=\"$(localstatedir)\" \
|
|
|
256ebe |
-DGSYNCD_PREFIX=\"$(GLUSTERFS_LIBEXECDIR)\" \
|
|
|
256ebe |
+ -DCONFDIR=\"$(localstatedir)/run/gluster/shared_storage/nfs-ganesha\" \
|
|
|
256ebe |
+ -DGANESHA_PREFIX=\"$(libexecdir)/ganesha\" \
|
|
|
256ebe |
-DSYNCDAEMON_COMPILE=$(SYNCDAEMON_COMPILE)
|
|
|
256ebe |
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-errno.h b/xlators/mgmt/glusterd/src/glusterd-errno.h
|
|
|
256ebe |
index 7e1575b..c74070e 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-errno.h
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-errno.h
|
|
|
256ebe |
@@ -27,7 +27,7 @@ enum glusterd_op_errno {
|
|
|
256ebe |
EG_ISSNAP = 30813, /* Volume is a snap volume */
|
|
|
256ebe |
EG_GEOREPRUN = 30814, /* Geo-Replication is running */
|
|
|
256ebe |
EG_NOTTHINP = 30815, /* Bricks are not thinly provisioned */
|
|
|
256ebe |
- EG_NOGANESHA = 30816, /* obsolete ganesha is not enabled */
|
|
|
256ebe |
+ EG_NOGANESHA = 30816, /* Global ganesha is not enabled */
|
|
|
256ebe |
};
|
|
|
256ebe |
|
|
|
256ebe |
#endif
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
256ebe |
new file mode 100644
|
|
|
256ebe |
index 0000000..fac16e6
|
|
|
256ebe |
--- /dev/null
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
256ebe |
@@ -0,0 +1,915 @@
|
|
|
256ebe |
+/*
|
|
|
256ebe |
+ Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
256ebe |
+ This file is part of GlusterFS.
|
|
|
256ebe |
+
|
|
|
256ebe |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
256ebe |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
256ebe |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
256ebe |
+ cases as published by the Free Software Foundation.
|
|
|
256ebe |
+*/
|
|
|
256ebe |
+
|
|
|
256ebe |
+#include <glusterfs/common-utils.h>
|
|
|
256ebe |
+#include "glusterd.h"
|
|
|
256ebe |
+#include "glusterd-op-sm.h"
|
|
|
256ebe |
+#include "glusterd-store.h"
|
|
|
256ebe |
+#include "glusterd-utils.h"
|
|
|
256ebe |
+#include "glusterd-nfs-svc.h"
|
|
|
256ebe |
+#include "glusterd-volgen.h"
|
|
|
256ebe |
+#include "glusterd-messages.h"
|
|
|
256ebe |
+#include <glusterfs/syscall.h>
|
|
|
256ebe |
+
|
|
|
256ebe |
+#include <ctype.h>
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+start_ganesha(char **op_errstr);
|
|
|
256ebe |
+
|
|
|
256ebe |
+typedef struct service_command {
|
|
|
256ebe |
+ char *binary;
|
|
|
256ebe |
+ char *service;
|
|
|
256ebe |
+ int (*action)(struct service_command *, char *);
|
|
|
256ebe |
+} service_command;
|
|
|
256ebe |
+
|
|
|
256ebe |
+/* parsing_ganesha_ha_conf will allocate the returned string
|
|
|
256ebe |
+ * to be freed (GF_FREE) by the caller
|
|
|
256ebe |
+ * return NULL if error or not found */
|
|
|
256ebe |
+static char *
|
|
|
256ebe |
+parsing_ganesha_ha_conf(const char *key)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+#define MAX_LINE 1024
|
|
|
256ebe |
+ char scratch[MAX_LINE * 2] = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ char *value = NULL, *pointer = NULL, *end_pointer = NULL;
|
|
|
256ebe |
+ FILE *fp;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ fp = fopen(GANESHA_HA_CONF, "r");
|
|
|
256ebe |
+ if (fp == NULL) {
|
|
|
256ebe |
+ gf_msg(THIS->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
256ebe |
+ "couldn't open the file %s", GANESHA_HA_CONF);
|
|
|
256ebe |
+ goto end_ret;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ while ((pointer = fgets(scratch, MAX_LINE, fp)) != NULL) {
|
|
|
256ebe |
+ /* Read config file until we get matching "^[[:space:]]*key" */
|
|
|
256ebe |
+ if (*pointer == '#') {
|
|
|
256ebe |
+ continue;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ while (isblank(*pointer)) {
|
|
|
256ebe |
+ pointer++;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ if (strncmp(pointer, key, strlen(key))) {
|
|
|
256ebe |
+ continue;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ pointer += strlen(key);
|
|
|
256ebe |
+ /* key found : if we fail to parse, we'll return an error
|
|
|
256ebe |
+ * rather than trying next one
|
|
|
256ebe |
+ * - supposition : conf file is bash compatible : no space
|
|
|
256ebe |
+ * around the '=' */
|
|
|
256ebe |
+ if (*pointer != '=') {
|
|
|
256ebe |
+ gf_msg(THIS->name, GF_LOG_ERROR, errno,
|
|
|
256ebe |
+ GD_MSG_GET_CONFIG_INFO_FAILED, "Parsing %s failed at key %s",
|
|
|
256ebe |
+ GANESHA_HA_CONF, key);
|
|
|
256ebe |
+ goto end_close;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ pointer++; /* jump the '=' */
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (*pointer == '"' || *pointer == '\'') {
|
|
|
256ebe |
+ /* dont get the quote */
|
|
|
256ebe |
+ pointer++;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ end_pointer = pointer;
|
|
|
256ebe |
+ /* stop at the next closing quote or blank/newline */
|
|
|
256ebe |
+ do {
|
|
|
256ebe |
+ end_pointer++;
|
|
|
256ebe |
+ } while (!(*end_pointer == '\'' || *end_pointer == '"' ||
|
|
|
256ebe |
+ isspace(*end_pointer) || *end_pointer == '\0'));
|
|
|
256ebe |
+ *end_pointer = '\0';
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* got it. copy it and return */
|
|
|
256ebe |
+ value = gf_strdup(pointer);
|
|
|
256ebe |
+ break;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+end_close:
|
|
|
256ebe |
+ fclose(fp);
|
|
|
256ebe |
+end_ret:
|
|
|
256ebe |
+ return value;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+sc_systemctl_action(struct service_command *sc, char *command)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ runner_add_args(&runner, sc->binary, command, sc->service, NULL);
|
|
|
256ebe |
+ return runner_run(&runner);
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+sc_service_action(struct service_command *sc, char *command)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ runner_add_args(&runner, sc->binary, sc->service, command, NULL);
|
|
|
256ebe |
+ return runner_run(&runner);
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+manage_service(char *action)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ struct stat stbuf = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ int i = 0;
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+ struct service_command sc_list[] = {{.binary = "/usr/bin/systemctl",
|
|
|
256ebe |
+ .service = "nfs-ganesha",
|
|
|
256ebe |
+ .action = sc_systemctl_action},
|
|
|
256ebe |
+ {.binary = "/sbin/invoke-rc.d",
|
|
|
256ebe |
+ .service = "nfs-ganesha",
|
|
|
256ebe |
+ .action = sc_service_action},
|
|
|
256ebe |
+ {.binary = "/sbin/service",
|
|
|
256ebe |
+ .service = "nfs-ganesha",
|
|
|
256ebe |
+ .action = sc_service_action},
|
|
|
256ebe |
+ {.binary = NULL}};
|
|
|
256ebe |
+
|
|
|
256ebe |
+ while (sc_list[i].binary != NULL) {
|
|
|
256ebe |
+ ret = sys_stat(sc_list[i].binary, &stbuf);
|
|
|
256ebe |
+ if (ret == 0) {
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0, "%s found.", sc_list[i].binary);
|
|
|
256ebe |
+ if (strcmp(sc_list[i].binary, "/usr/bin/systemctl") == 0)
|
|
|
256ebe |
+ ret = sc_systemctl_action(&sc_list[i], action);
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ ret = sc_service_action(&sc_list[i], action);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ i++;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_UNRECOGNIZED_SVC_MNGR,
|
|
|
256ebe |
+ "Could not %s NFS-Ganesha.Service manager for distro"
|
|
|
256ebe |
+ " not recognized.",
|
|
|
256ebe |
+ action);
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/*
|
|
|
256ebe |
+ * Check if the cluster is a ganesha cluster or not *
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+gf_boolean_t
|
|
|
256ebe |
+glusterd_is_ganesha_cluster()
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ gf_boolean_t ret_bool = _gf_false;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO("ganesha", this, out);
|
|
|
256ebe |
+ priv = this->private;
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO(this->name, priv, out);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_get_str_boolean(priv->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL,
|
|
|
256ebe |
+ _gf_false);
|
|
|
256ebe |
+ if (ret == _gf_true) {
|
|
|
256ebe |
+ ret_bool = _gf_true;
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "nfs-ganesha is enabled for the cluster");
|
|
|
256ebe |
+ } else
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "nfs-ganesha is disabled for the cluster");
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ return ret_bool;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/* Check if ganesha.enable is set to 'on', that checks if
|
|
|
256ebe |
+ * a particular volume is exported via NFS-Ganesha */
|
|
|
256ebe |
+gf_boolean_t
|
|
|
256ebe |
+glusterd_check_ganesha_export(glusterd_volinfo_t *volinfo)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ char *value = NULL;
|
|
|
256ebe |
+ gf_boolean_t is_exported = _gf_false;
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_volinfo_get(volinfo, "ganesha.enable", &value);
|
|
|
256ebe |
+ if ((ret == 0) && value) {
|
|
|
256ebe |
+ if (strcmp(value, "on") == 0) {
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ "ganesha.enable set"
|
|
|
256ebe |
+ " to %s",
|
|
|
256ebe |
+ value);
|
|
|
256ebe |
+ is_exported = _gf_true;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ return is_exported;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/* *
|
|
|
256ebe |
+ * The below function is called as part of commit phase for volume set option
|
|
|
256ebe |
+ * "ganesha.enable". If the value is "on", it creates export configuration file
|
|
|
256ebe |
+ * and then export the volume via dbus command. Incase of "off", the volume
|
|
|
256ebe |
+ * will be already unexported during stage phase, so it will remove the conf
|
|
|
256ebe |
+ * file from shared storage
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_check_ganesha_cmd(char *key, char *value, char **errstr, dict_t *dict)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+ char *volname = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_ASSERT(key);
|
|
|
256ebe |
+ GF_ASSERT(value);
|
|
|
256ebe |
+ GF_ASSERT(dict);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if ((strcmp(key, "ganesha.enable") == 0)) {
|
|
|
256ebe |
+ if ((strcmp(value, "on")) && (strcmp(value, "off"))) {
|
|
|
256ebe |
+ gf_asprintf(errstr,
|
|
|
256ebe |
+ "Invalid value"
|
|
|
256ebe |
+ " for volume set command. Use on/off only.");
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ if (strcmp(value, "on") == 0) {
|
|
|
256ebe |
+ ret = glusterd_handle_ganesha_op(dict, errstr, key, value);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ } else if (is_origin_glusterd(dict)) {
|
|
|
256ebe |
+ ret = dict_get_str(dict, "volname", &volname);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg("glusterd-ganesha", GF_LOG_ERROR, errno,
|
|
|
256ebe |
+ GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ ret = manage_export_config(volname, "off", errstr);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg("glusterd-ganesha", GF_LOG_ERROR, 0,
|
|
|
256ebe |
+ GD_MSG_NFS_GNS_OP_HANDLE_FAIL,
|
|
|
256ebe |
+ "Handling NFS-Ganesha"
|
|
|
256ebe |
+ " op failed.");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_op_stage_set_ganesha(dict_t *dict, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ int value = -1;
|
|
|
256ebe |
+ gf_boolean_t option = _gf_false;
|
|
|
256ebe |
+ char *str = NULL;
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_ASSERT(dict);
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+ priv = this->private;
|
|
|
256ebe |
+ GF_ASSERT(priv);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ value = dict_get_str_boolean(dict, "value", _gf_false);
|
|
|
256ebe |
+ if (value == -1) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
|
|
|
256ebe |
+ "value not present.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ /* This dict_get will fail if the user had never set the key before */
|
|
|
256ebe |
+ /*Ignoring the ret value and proceeding */
|
|
|
256ebe |
+ ret = dict_get_str(priv->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL, &str);
|
|
|
256ebe |
+ if (ret == -1) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_DICT_GET_FAILED,
|
|
|
256ebe |
+ "Global dict not present.");
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ /* Validity of the value is already checked */
|
|
|
256ebe |
+ ret = gf_string2boolean(str, &option);
|
|
|
256ebe |
+ /* Check if the feature is already enabled, fail in that case */
|
|
|
256ebe |
+ if (value == option) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr, "nfs-ganesha is already %sd.", str);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (value) {
|
|
|
256ebe |
+ ret = start_ganesha(op_errstr);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_NFS_GNS_START_FAIL,
|
|
|
256ebe |
+ "Could not start NFS-Ganesha");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ ret = stop_ganesha(op_errstr);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ "Could not stop "
|
|
|
256ebe |
+ "NFS-Ganesha.");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ if (!(*op_errstr)) {
|
|
|
256ebe |
+ *op_errstr = gf_strdup("Error, Validation Failed");
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "Error, Cannot Validate option :%s",
|
|
|
256ebe |
+ GLUSTERD_STORE_KEY_GANESHA_GLOBAL);
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "Error, Cannot Validate option");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_op_set_ganesha(dict_t *dict, char **errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ char *key = NULL;
|
|
|
256ebe |
+ char *value = NULL;
|
|
|
256ebe |
+ char *next_version = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+ GF_ASSERT(dict);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ priv = this->private;
|
|
|
256ebe |
+ GF_ASSERT(priv);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_get_str(dict, "key", &key);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
|
|
|
256ebe |
+ "Couldn't get key in global option set");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_get_str(dict, "value", &value);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
|
|
|
256ebe |
+ "Couldn't get value in global option set");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_handle_ganesha_op(dict, errstr, key, value);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_NFS_GNS_SETUP_FAIL,
|
|
|
256ebe |
+ "Initial NFS-Ganesha set up failed");
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ ret = dict_set_dynstr_with_alloc(priv->opts,
|
|
|
256ebe |
+ GLUSTERD_STORE_KEY_GANESHA_GLOBAL, value);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_DICT_SET_FAILED,
|
|
|
256ebe |
+ "Failed to set"
|
|
|
256ebe |
+ " nfs-ganesha in dict.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ ret = glusterd_get_next_global_opt_version_str(priv->opts, &next_version);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ "Could not fetch "
|
|
|
256ebe |
+ " global op version");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ ret = dict_set_str(priv->opts, GLUSTERD_GLOBAL_OPT_VERSION, next_version);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_store_options(this, priv->opts);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_STORE_FAIL,
|
|
|
256ebe |
+ "Failed to store options");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "returning %d", ret);
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/* Following function parse GANESHA_HA_CONF
|
|
|
256ebe |
+ * The sample file looks like below,
|
|
|
256ebe |
+ * HA_NAME="ganesha-ha-360"
|
|
|
256ebe |
+ * HA_VOL_NAME="ha-state"
|
|
|
256ebe |
+ * HA_CLUSTER_NODES="server1,server2"
|
|
|
256ebe |
+ * VIP_rhs_1="10.x.x.x"
|
|
|
256ebe |
+ * VIP_rhs_2="10.x.x.x." */
|
|
|
256ebe |
+
|
|
|
256ebe |
+/* Check if the localhost is listed as one of nfs-ganesha nodes */
|
|
|
256ebe |
+gf_boolean_t
|
|
|
256ebe |
+check_host_list(void)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ char *hostname, *hostlist;
|
|
|
256ebe |
+ gf_boolean_t ret = _gf_false;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ priv = THIS->private;
|
|
|
256ebe |
+ GF_ASSERT(priv);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ hostlist = parsing_ganesha_ha_conf("HA_CLUSTER_NODES");
|
|
|
256ebe |
+ if (hostlist == NULL) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_INFO, errno, GD_MSG_GET_CONFIG_INFO_FAILED,
|
|
|
256ebe |
+ "couldn't get HA_CLUSTER_NODES from file %s", GANESHA_HA_CONF);
|
|
|
256ebe |
+ return _gf_false;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* Hostlist is a comma separated list now */
|
|
|
256ebe |
+ hostname = strtok(hostlist, ",");
|
|
|
256ebe |
+ while (hostname != NULL) {
|
|
|
256ebe |
+ ret = gf_is_local_addr(hostname);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_NFS_GNS_HOST_FOUND,
|
|
|
256ebe |
+ "ganesha host found "
|
|
|
256ebe |
+ "Hostname is %s",
|
|
|
256ebe |
+ hostname);
|
|
|
256ebe |
+ break;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ hostname = strtok(NULL, ",");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_FREE(hostlist);
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+manage_export_config(char *volname, char *value, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_ASSERT(volname);
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ runner_add_args(&runner, "sh", GANESHA_PREFIX "/create-export-ganesha.sh",
|
|
|
256ebe |
+ CONFDIR, value, volname, NULL);
|
|
|
256ebe |
+ ret = runner_run(&runner);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "Failed to create"
|
|
|
256ebe |
+ " NFS-Ganesha export config file.");
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+/* Exports and unexports a particular volume via NFS-Ganesha */
|
|
|
256ebe |
+int
|
|
|
256ebe |
+ganesha_manage_export(dict_t *dict, char *value, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ glusterd_volinfo_t *volinfo = NULL;
|
|
|
256ebe |
+ dict_t *vol_opts = NULL;
|
|
|
256ebe |
+ char *volname = NULL;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ gf_boolean_t option = _gf_false;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+ priv = this->private;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_ASSERT(value);
|
|
|
256ebe |
+ GF_ASSERT(dict);
|
|
|
256ebe |
+ GF_ASSERT(priv);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_get_str(dict, "volname", &volname);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
|
|
|
256ebe |
+ "Unable to get volume name");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ ret = gf_string2boolean(value, &option);
|
|
|
256ebe |
+ if (ret == -1) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY,
|
|
|
256ebe |
+ "invalid value.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_volinfo_find(volname, &volinfo);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_VOL_NOT_FOUND,
|
|
|
256ebe |
+ FMTSTR_CHECK_VOL_EXISTS, volname);
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_check_ganesha_export(volinfo);
|
|
|
256ebe |
+ if (ret && option) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "ganesha.enable "
|
|
|
256ebe |
+ "is already 'on'.");
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ } else if (!option && !ret) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "ganesha.enable "
|
|
|
256ebe |
+ "is already 'off'.");
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* Check if global option is enabled, proceed only then */
|
|
|
256ebe |
+ ret = dict_get_str_boolean(priv->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL,
|
|
|
256ebe |
+ _gf_false);
|
|
|
256ebe |
+ if (ret == -1) {
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0,
|
|
|
256ebe |
+ "Failed to get "
|
|
|
256ebe |
+ "global option dict.");
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "The option "
|
|
|
256ebe |
+ "nfs-ganesha should be "
|
|
|
256ebe |
+ "enabled before setting ganesha.enable.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ if (!ret) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "The option "
|
|
|
256ebe |
+ "nfs-ganesha should be "
|
|
|
256ebe |
+ "enabled before setting ganesha.enable.");
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* *
|
|
|
256ebe |
+ * Create the export file from the node where ganesha.enable "on"
|
|
|
256ebe |
+ * is executed
|
|
|
256ebe |
+ * */
|
|
|
256ebe |
+ if (option) {
|
|
|
256ebe |
+ ret = manage_export_config(volname, "on", op_errstr);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_EXPORT_FILE_CREATE_FAIL,
|
|
|
256ebe |
+ "Failed to create"
|
|
|
256ebe |
+ "export file for NFS-Ganesha\n");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (check_host_list()) {
|
|
|
256ebe |
+ runner_add_args(&runner, "sh", GANESHA_PREFIX "/dbus-send.sh", CONFDIR,
|
|
|
256ebe |
+ value, volname, NULL);
|
|
|
256ebe |
+ ret = runner_run(&runner);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "Dynamic export"
|
|
|
256ebe |
+ " addition/deletion failed."
|
|
|
256ebe |
+ " Please see log file for details");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ vol_opts = volinfo->dict;
|
|
|
256ebe |
+ ret = dict_set_dynstr_with_alloc(vol_opts, "features.cache-invalidation",
|
|
|
256ebe |
+ value);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "Cache-invalidation could not"
|
|
|
256ebe |
+ " be set to %s.",
|
|
|
256ebe |
+ value);
|
|
|
256ebe |
+ ret = glusterd_store_volinfo(volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_asprintf(op_errstr, "failed to store volinfo for %s",
|
|
|
256ebe |
+ volinfo->volname);
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+tear_down_cluster(gf_boolean_t run_teardown)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ struct stat st = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ DIR *dir = NULL;
|
|
|
256ebe |
+ struct dirent *entry = NULL;
|
|
|
256ebe |
+ struct dirent scratch[2] = {
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ },
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ char path[PATH_MAX] = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (run_teardown) {
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ runner_add_args(&runner, "sh", GANESHA_PREFIX "/ganesha-ha.sh",
|
|
|
256ebe |
+ "teardown", CONFDIR, NULL);
|
|
|
256ebe |
+ ret = runner_run(&runner);
|
|
|
256ebe |
+ /* *
|
|
|
256ebe |
+ * Remove all the entries in CONFDIR expect ganesha.conf and
|
|
|
256ebe |
+ * ganesha-ha.conf
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+ dir = sys_opendir(CONFDIR);
|
|
|
256ebe |
+ if (!dir) {
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ "Failed to open directory %s. "
|
|
|
256ebe |
+ "Reason : %s",
|
|
|
256ebe |
+ CONFDIR, strerror(errno));
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_SKIP_IRRELEVANT_ENTRIES(entry, dir, scratch);
|
|
|
256ebe |
+ while (entry) {
|
|
|
256ebe |
+ snprintf(path, PATH_MAX, "%s/%s", CONFDIR, entry->d_name);
|
|
|
256ebe |
+ ret = sys_lstat(path, &st);
|
|
|
256ebe |
+ if (ret == -1) {
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ "Failed to stat entry %s :"
|
|
|
256ebe |
+ " %s",
|
|
|
256ebe |
+ path, strerror(errno));
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strcmp(entry->d_name, "ganesha.conf") == 0 ||
|
|
|
256ebe |
+ strcmp(entry->d_name, "ganesha-ha.conf") == 0)
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ " %s is not required"
|
|
|
256ebe |
+ " to remove",
|
|
|
256ebe |
+ path);
|
|
|
256ebe |
+ else if (S_ISDIR(st.st_mode))
|
|
|
256ebe |
+ ret = recursive_rmdir(path);
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ ret = sys_unlink(path);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ " Failed to remove %s. "
|
|
|
256ebe |
+ "Reason : %s",
|
|
|
256ebe |
+ path, strerror(errno));
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0, "%s %s",
|
|
|
256ebe |
+ ret ? "Failed to remove" : "Removed", entry->d_name);
|
|
|
256ebe |
+ GF_SKIP_IRRELEVANT_ENTRIES(entry, dir, scratch);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = sys_closedir(dir);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ "Failed to close dir %s. Reason :"
|
|
|
256ebe |
+ " %s",
|
|
|
256ebe |
+ CONFDIR, strerror(errno));
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+setup_cluster(gf_boolean_t run_setup)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (run_setup) {
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ runner_add_args(&runner, "sh", GANESHA_PREFIX "/ganesha-ha.sh", "setup",
|
|
|
256ebe |
+ CONFDIR, NULL);
|
|
|
256ebe |
+ ret = runner_run(&runner);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+teardown(gf_boolean_t run_teardown, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ int ret = 1;
|
|
|
256ebe |
+ glusterd_volinfo_t *volinfo = NULL;
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ dict_t *vol_opts = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ priv = THIS->private;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = tear_down_cluster(run_teardown);
|
|
|
256ebe |
+ if (ret == -1) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "Cleanup of NFS-Ganesha"
|
|
|
256ebe |
+ " HA config failed.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ runner_add_args(&runner, "sh", GANESHA_PREFIX "/ganesha-ha.sh", "cleanup",
|
|
|
256ebe |
+ CONFDIR, NULL);
|
|
|
256ebe |
+ ret = runner_run(&runner);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_msg_debug(THIS->name, 0,
|
|
|
256ebe |
+ "Could not clean up"
|
|
|
256ebe |
+ " NFS-Ganesha related config");
|
|
|
256ebe |
+
|
|
|
256ebe |
+ cds_list_for_each_entry(volinfo, &priv->volumes, vol_list)
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ vol_opts = volinfo->dict;
|
|
|
256ebe |
+ /* All the volumes exported via NFS-Ganesha will be
|
|
|
256ebe |
+ unexported, hence setting the appropriate keys */
|
|
|
256ebe |
+ ret = dict_set_str(vol_opts, "features.cache-invalidation", "off");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_msg(THIS->name, GF_LOG_WARNING, errno, GD_MSG_DICT_SET_FAILED,
|
|
|
256ebe |
+ "Could not set features.cache-invalidation "
|
|
|
256ebe |
+ "to off for %s",
|
|
|
256ebe |
+ volinfo->volname);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_set_str(vol_opts, "ganesha.enable", "off");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_msg(THIS->name, GF_LOG_WARNING, errno, GD_MSG_DICT_SET_FAILED,
|
|
|
256ebe |
+ "Could not set ganesha.enable to off for %s",
|
|
|
256ebe |
+ volinfo->volname);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_store_volinfo(volinfo,
|
|
|
256ebe |
+ GLUSTERD_VOLINFO_VER_AC_INCREMENT);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, GD_MSG_VOLINFO_SET_FAIL,
|
|
|
256ebe |
+ "failed to store volinfo for %s", volinfo->volname);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+stop_ganesha(char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ runner_add_args(&runner, "sh", GANESHA_PREFIX "/ganesha-ha.sh",
|
|
|
256ebe |
+ "--setup-ganesha-conf-files", CONFDIR, "no", NULL);
|
|
|
256ebe |
+ ret = runner_run(&runner);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "removal of symlink ganesha.conf "
|
|
|
256ebe |
+ "in /etc/ganesha failed");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (check_host_list()) {
|
|
|
256ebe |
+ ret = manage_service("stop");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "NFS-Ganesha service could not"
|
|
|
256ebe |
+ "be stopped.");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+start_ganesha(char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = -1;
|
|
|
256ebe |
+ dict_t *vol_opts = NULL;
|
|
|
256ebe |
+ glusterd_volinfo_t *volinfo = NULL;
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ runner_t runner = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+
|
|
|
256ebe |
+ priv = THIS->private;
|
|
|
256ebe |
+ GF_ASSERT(priv);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ cds_list_for_each_entry(volinfo, &priv->volumes, vol_list)
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ vol_opts = volinfo->dict;
|
|
|
256ebe |
+ /* Gluster-nfs has to be disabled across the trusted pool */
|
|
|
256ebe |
+ /* before attempting to start nfs-ganesha */
|
|
|
256ebe |
+ ret = dict_set_str(vol_opts, NFS_DISABLE_MAP_KEY, "on");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_store_volinfo(volinfo,
|
|
|
256ebe |
+ GLUSTERD_VOLINFO_VER_AC_INCREMENT);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ *op_errstr = gf_strdup(
|
|
|
256ebe |
+ "Failed to store the "
|
|
|
256ebe |
+ "Volume information");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* If the nfs svc is not initialized it means that the service is not
|
|
|
256ebe |
+ * running, hence we can skip the process of stopping gluster-nfs
|
|
|
256ebe |
+ * service
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+ if (priv->nfs_svc.inited) {
|
|
|
256ebe |
+ ret = priv->nfs_svc.stop(&(priv->nfs_svc), SIGKILL);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "Gluster-NFS service could"
|
|
|
256ebe |
+ "not be stopped, exiting.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (check_host_list()) {
|
|
|
256ebe |
+ runinit(&runner);
|
|
|
256ebe |
+ runner_add_args(&runner, "sh", GANESHA_PREFIX "/ganesha-ha.sh",
|
|
|
256ebe |
+ "--setup-ganesha-conf-files", CONFDIR, "yes", NULL);
|
|
|
256ebe |
+ ret = runner_run(&runner);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "creation of symlink ganesha.conf "
|
|
|
256ebe |
+ "in /etc/ganesha failed");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ ret = manage_service("start");
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "NFS-Ganesha failed to start."
|
|
|
256ebe |
+ "Please see log file for details");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+static int
|
|
|
256ebe |
+pre_setup(gf_boolean_t run_setup, char **op_errstr)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int ret = 0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = check_host_list();
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ ret = setup_cluster(run_setup);
|
|
|
256ebe |
+ if (ret == -1)
|
|
|
256ebe |
+ gf_asprintf(op_errstr,
|
|
|
256ebe |
+ "Failed to set up HA "
|
|
|
256ebe |
+ "config for NFS-Ganesha. "
|
|
|
256ebe |
+ "Please check the log file for details");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_handle_ganesha_op(dict_t *dict, char **op_errstr, char *key,
|
|
|
256ebe |
+ char *value)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int32_t ret = -1;
|
|
|
256ebe |
+ gf_boolean_t option = _gf_false;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_ASSERT(dict);
|
|
|
256ebe |
+ GF_ASSERT(op_errstr);
|
|
|
256ebe |
+ GF_ASSERT(key);
|
|
|
256ebe |
+ GF_ASSERT(value);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strcmp(key, "ganesha.enable") == 0) {
|
|
|
256ebe |
+ ret = ganesha_manage_export(dict, value, op_errstr);
|
|
|
256ebe |
+ if (ret < 0)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* It is possible that the key might not be set */
|
|
|
256ebe |
+ ret = gf_string2boolean(value, &option);
|
|
|
256ebe |
+ if (ret == -1) {
|
|
|
256ebe |
+ gf_asprintf(op_errstr, "Invalid value in key-value pair.");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (strcmp(key, GLUSTERD_STORE_KEY_GANESHA_GLOBAL) == 0) {
|
|
|
256ebe |
+ /* *
|
|
|
256ebe |
+ * The set up/teardown of pcs cluster should be performed only
|
|
|
256ebe |
+ * once. This will done on the node in which the cli command
|
|
|
256ebe |
+ * 'gluster nfs-ganesha <enable/disable>' got executed. So that
|
|
|
256ebe |
+ * node should part of ganesha HA cluster
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+ if (option) {
|
|
|
256ebe |
+ ret = pre_setup(is_origin_glusterd(dict), op_errstr);
|
|
|
256ebe |
+ if (ret < 0)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ ret = teardown(is_origin_glusterd(dict), op_errstr);
|
|
|
256ebe |
+ if (ret < 0)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
256ebe |
index de44af7..528993c 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
256ebe |
@@ -1911,6 +1911,83 @@ glusterd_op_begin(rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
|
|
|
256ebe |
return ret;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+int
|
|
|
256ebe |
+__glusterd_handle_ganesha_cmd(rpcsvc_request_t *req)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int32_t ret = -1;
|
|
|
256ebe |
+ gf_cli_req cli_req = {{
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ }};
|
|
|
256ebe |
+ dict_t *dict = NULL;
|
|
|
256ebe |
+ glusterd_op_t cli_op = GD_OP_GANESHA;
|
|
|
256ebe |
+ char *op_errstr = NULL;
|
|
|
256ebe |
+ char err_str[2048] = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_ASSERT(this);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_ASSERT(req);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req);
|
|
|
256ebe |
+ if (ret < 0) {
|
|
|
256ebe |
+ snprintf(err_str, sizeof(err_str),
|
|
|
256ebe |
+ "Failed to decode "
|
|
|
256ebe |
+ "request received from cli");
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_REQ_DECODE_FAIL, "%s",
|
|
|
256ebe |
+ err_str);
|
|
|
256ebe |
+ req->rpc_err = GARBAGE_ARGS;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (cli_req.dict.dict_len) {
|
|
|
256ebe |
+ /* Unserialize the dictionary */
|
|
|
256ebe |
+ dict = dict_new();
|
|
|
256ebe |
+ if (!dict) {
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = dict_unserialize(cli_req.dict.dict_val, cli_req.dict.dict_len,
|
|
|
256ebe |
+ &dict);
|
|
|
256ebe |
+ if (ret < 0) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_UNSERIALIZE_FAIL,
|
|
|
256ebe |
+ "failed to "
|
|
|
256ebe |
+ "unserialize req-buffer to dictionary");
|
|
|
256ebe |
+ snprintf(err_str, sizeof(err_str),
|
|
|
256ebe |
+ "Unable to decode "
|
|
|
256ebe |
+ "the command");
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ dict->extra_stdfree = cli_req.dict.dict_val;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ gf_msg_trace(this->name, 0, "Received global option request");
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_op_begin_synctask(req, GD_OP_GANESHA, dict);
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ if (err_str[0] == '\0')
|
|
|
256ebe |
+ snprintf(err_str, sizeof(err_str), "Operation failed");
|
|
|
256ebe |
+ ret = glusterd_op_send_cli_response(cli_op, ret, 0, req, dict, err_str);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ if (op_errstr)
|
|
|
256ebe |
+ GF_FREE(op_errstr);
|
|
|
256ebe |
+ if (dict)
|
|
|
256ebe |
+ dict_unref(dict);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_handle_ganesha_cmd(rpcsvc_request_t *req)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ return glusterd_big_locked_handler(req, __glusterd_handle_ganesha_cmd);
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
static int
|
|
|
256ebe |
__glusterd_handle_reset_volume(rpcsvc_request_t *req)
|
|
|
256ebe |
{
|
|
|
256ebe |
@@ -6644,6 +6721,8 @@ rpcsvc_actor_t gd_svc_cli_actors[GLUSTER_CLI_MAXVALUE] = {
|
|
|
256ebe |
[GLUSTER_CLI_BARRIER_VOLUME] = {"BARRIER_VOLUME",
|
|
|
256ebe |
GLUSTER_CLI_BARRIER_VOLUME,
|
|
|
256ebe |
glusterd_handle_barrier, NULL, 0, DRC_NA},
|
|
|
256ebe |
+ [GLUSTER_CLI_GANESHA] = {"GANESHA", GLUSTER_CLI_GANESHA,
|
|
|
256ebe |
+ glusterd_handle_ganesha_cmd, NULL, 0, DRC_NA},
|
|
|
256ebe |
[GLUSTER_CLI_GET_VOL_OPT] = {"GET_VOL_OPT", GLUSTER_CLI_GET_VOL_OPT,
|
|
|
256ebe |
glusterd_handle_get_vol_opt, NULL, 0, DRC_NA},
|
|
|
256ebe |
[GLUSTER_CLI_BITROT] = {"BITROT", GLUSTER_CLI_BITROT,
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
|
|
|
256ebe |
index 1a4bd54..9558480 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
|
|
|
256ebe |
@@ -297,7 +297,7 @@ GLFS_MSGID(
|
|
|
256ebe |
GD_MSG_LOCALTIME_LOGGING_VOL_OPT_VALIDATE_FAIL,
|
|
|
256ebe |
GD_MSG_LOCALTIME_LOGGING_ENABLE, GD_MSG_LOCALTIME_LOGGING_DISABLE,
|
|
|
256ebe |
GD_MSG_PORTS_EXHAUSTED, GD_MSG_CHANGELOG_GET_FAIL,
|
|
|
256ebe |
- GD_MSG_MANAGER_FUNCTION_FAILED,
|
|
|
256ebe |
+ GD_MSG_MANAGER_FUNCTION_FAILED, GD_MSG_NFS_GANESHA_DISABLED,
|
|
|
256ebe |
GD_MSG_DAEMON_LOG_LEVEL_VOL_OPT_VALIDATE_FAIL);
|
|
|
256ebe |
|
|
|
256ebe |
#endif /* !_GLUSTERD_MESSAGES_H_ */
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
256ebe |
index 12d857a..a630c48 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
256ebe |
@@ -1176,6 +1176,13 @@ glusterd_op_stage_set_volume(dict_t *dict, char **op_errstr)
|
|
|
256ebe |
if (ret)
|
|
|
256ebe |
goto out;
|
|
|
256ebe |
|
|
|
256ebe |
+ if ((strcmp(key, "ganesha.enable") == 0) &&
|
|
|
256ebe |
+ (strcmp(value, "off") == 0)) {
|
|
|
256ebe |
+ ret = ganesha_manage_export(dict, "off", op_errstr);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
ret = glusterd_check_quota_cmd(key, value, errstr, sizeof(errstr));
|
|
|
256ebe |
if (ret)
|
|
|
256ebe |
goto out;
|
|
|
256ebe |
@@ -1677,6 +1684,20 @@ glusterd_op_stage_reset_volume(dict_t *dict, char **op_errstr)
|
|
|
256ebe |
goto out;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+ /* *
|
|
|
256ebe |
+ * If key ganesha.enable is set, then volume should be unexported from
|
|
|
256ebe |
+ * ganesha server. Also it is a volume-level option, perform only when
|
|
|
256ebe |
+ * volume name not equal to "all"(in other words if volinfo != NULL)
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+ if (volinfo && (!strcmp(key, "all") || !strcmp(key, "ganesha.enable"))) {
|
|
|
256ebe |
+ if (glusterd_check_ganesha_export(volinfo)) {
|
|
|
256ebe |
+ ret = ganesha_manage_export(dict, "off", op_errstr);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_NFS_GNS_RESET_FAIL,
|
|
|
256ebe |
+ "Could not reset ganesha.enable key");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
if (strcmp(key, "all")) {
|
|
|
256ebe |
exists = glusterd_check_option_exists(key, &key_fixed);
|
|
|
256ebe |
if (exists == -1) {
|
|
|
256ebe |
@@ -2393,6 +2414,15 @@ glusterd_op_reset_volume(dict_t *dict, char **op_rspstr)
|
|
|
256ebe |
}
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+ if (!strcmp(key, "ganesha.enable") || !strcmp(key, "all")) {
|
|
|
256ebe |
+ if (glusterd_check_ganesha_export(volinfo)) {
|
|
|
256ebe |
+ ret = manage_export_config(volname, "off", op_rspstr);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_NFS_GNS_RESET_FAIL,
|
|
|
256ebe |
+ "Could not reset ganesha.enable key");
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
out:
|
|
|
256ebe |
GF_FREE(key_fixed);
|
|
|
256ebe |
if (quorum_action)
|
|
|
256ebe |
@@ -2964,6 +2994,10 @@ glusterd_op_set_volume(dict_t *dict, char **errstr)
|
|
|
256ebe |
}
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+ ret = glusterd_check_ganesha_cmd(key, value, errstr, dict);
|
|
|
256ebe |
+ if (ret == -1)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
if (!is_key_glusterd_hooks_friendly(key)) {
|
|
|
256ebe |
ret = glusterd_check_option_exists(key, &key_fixed);
|
|
|
256ebe |
GF_ASSERT(ret);
|
|
|
256ebe |
@@ -4494,7 +4528,8 @@ glusterd_op_build_payload(dict_t **req, char **op_errstr, dict_t *op_ctx)
|
|
|
256ebe |
|
|
|
256ebe |
case GD_OP_SYNC_VOLUME:
|
|
|
256ebe |
case GD_OP_COPY_FILE:
|
|
|
256ebe |
- case GD_OP_SYS_EXEC: {
|
|
|
256ebe |
+ case GD_OP_SYS_EXEC:
|
|
|
256ebe |
+ case GD_OP_GANESHA: {
|
|
|
256ebe |
dict_copy(dict, req_dict);
|
|
|
256ebe |
} break;
|
|
|
256ebe |
|
|
|
256ebe |
@@ -5944,6 +5979,10 @@ glusterd_op_stage_validate(glusterd_op_t op, dict_t *dict, char **op_errstr,
|
|
|
256ebe |
ret = glusterd_op_stage_set_volume(dict, op_errstr);
|
|
|
256ebe |
break;
|
|
|
256ebe |
|
|
|
256ebe |
+ case GD_OP_GANESHA:
|
|
|
256ebe |
+ ret = glusterd_op_stage_set_ganesha(dict, op_errstr);
|
|
|
256ebe |
+ break;
|
|
|
256ebe |
+
|
|
|
256ebe |
case GD_OP_RESET_VOLUME:
|
|
|
256ebe |
ret = glusterd_op_stage_reset_volume(dict, op_errstr);
|
|
|
256ebe |
break;
|
|
|
256ebe |
@@ -6074,7 +6113,9 @@ glusterd_op_commit_perform(glusterd_op_t op, dict_t *dict, char **op_errstr,
|
|
|
256ebe |
case GD_OP_SET_VOLUME:
|
|
|
256ebe |
ret = glusterd_op_set_volume(dict, op_errstr);
|
|
|
256ebe |
break;
|
|
|
256ebe |
-
|
|
|
256ebe |
+ case GD_OP_GANESHA:
|
|
|
256ebe |
+ ret = glusterd_op_set_ganesha(dict, op_errstr);
|
|
|
256ebe |
+ break;
|
|
|
256ebe |
case GD_OP_RESET_VOLUME:
|
|
|
256ebe |
ret = glusterd_op_reset_volume(dict, op_errstr);
|
|
|
256ebe |
break;
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
256ebe |
index 2958443..041946d 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
256ebe |
@@ -3788,6 +3788,148 @@ out:
|
|
|
256ebe |
return ret;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+/* *
|
|
|
256ebe |
+ * Here there are two possibilities, either destination is snaphot or
|
|
|
256ebe |
+ * clone. In the case of snapshot nfs_ganesha export file will be copied
|
|
|
256ebe |
+ * to snapdir. If it is clone , then new export file will be created for
|
|
|
256ebe |
+ * the clone in the GANESHA_EXPORT_DIRECTORY, replacing occurences of
|
|
|
256ebe |
+ * volname with clonename
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_copy_nfs_ganesha_file(glusterd_volinfo_t *src_vol,
|
|
|
256ebe |
+ glusterd_volinfo_t *dest_vol)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int32_t ret = -1;
|
|
|
256ebe |
+ char snap_dir[PATH_MAX] = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ char src_path[PATH_MAX] = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ char dest_path[PATH_MAX] = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ char buffer[BUFSIZ] = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ char *find_ptr = NULL;
|
|
|
256ebe |
+ char *buff_ptr = NULL;
|
|
|
256ebe |
+ char *tmp_ptr = NULL;
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ struct stat stbuf = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+ FILE *src = NULL;
|
|
|
256ebe |
+ FILE *dest = NULL;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO("snapshot", this, out);
|
|
|
256ebe |
+ priv = this->private;
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO(this->name, priv, out);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO(this->name, src_vol, out);
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO(this->name, dest_vol, out);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (glusterd_check_ganesha_export(src_vol) == _gf_false) {
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0,
|
|
|
256ebe |
+ "%s is not exported via "
|
|
|
256ebe |
+ "NFS-Ganesha. Skipping copy of export conf.",
|
|
|
256ebe |
+ src_vol->volname);
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (src_vol->is_snap_volume) {
|
|
|
256ebe |
+ GLUSTERD_GET_SNAP_DIR(snap_dir, src_vol->snapshot, priv);
|
|
|
256ebe |
+ ret = snprintf(src_path, PATH_MAX, "%s/export.%s.conf", snap_dir,
|
|
|
256ebe |
+ src_vol->snapshot->snapname);
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ ret = snprintf(src_path, PATH_MAX, "%s/export.%s.conf",
|
|
|
256ebe |
+ GANESHA_EXPORT_DIRECTORY, src_vol->volname);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ if (ret < 0 || ret >= PATH_MAX)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = sys_lstat(src_path, &stbuf);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ /*
|
|
|
256ebe |
+ * This code path is hit, only when the src_vol is being *
|
|
|
256ebe |
+ * exported via NFS-Ganesha. So if the conf file is not *
|
|
|
256ebe |
+ * available, we fail the snapshot operation. *
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
256ebe |
+ "Stat on %s failed with %s", src_path, strerror(errno));
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (dest_vol->is_snap_volume) {
|
|
|
256ebe |
+ memset(snap_dir, 0, PATH_MAX);
|
|
|
256ebe |
+ GLUSTERD_GET_SNAP_DIR(snap_dir, dest_vol->snapshot, priv);
|
|
|
256ebe |
+ ret = snprintf(dest_path, sizeof(dest_path), "%s/export.%s.conf",
|
|
|
256ebe |
+ snap_dir, dest_vol->snapshot->snapname);
|
|
|
256ebe |
+ if (ret < 0)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_copy_file(src_path, dest_path);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
|
|
|
256ebe |
+ "Failed to copy %s in %s", src_path, dest_path);
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ ret = snprintf(dest_path, sizeof(dest_path), "%s/export.%s.conf",
|
|
|
256ebe |
+ GANESHA_EXPORT_DIRECTORY, dest_vol->volname);
|
|
|
256ebe |
+ if (ret < 0)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ src = fopen(src_path, "r");
|
|
|
256ebe |
+ dest = fopen(dest_path, "w");
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!src || !dest) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_FILE_OP_FAILED,
|
|
|
256ebe |
+ "Failed to open %s", dest ? src_path : dest_path);
|
|
|
256ebe |
+ ret = -1;
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* *
|
|
|
256ebe |
+ * if the source volume is snapshot, the export conf file
|
|
|
256ebe |
+ * consists of orginal volname
|
|
|
256ebe |
+ */
|
|
|
256ebe |
+ if (src_vol->is_snap_volume)
|
|
|
256ebe |
+ find_ptr = gf_strdup(src_vol->parent_volname);
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ find_ptr = gf_strdup(src_vol->volname);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if (!find_ptr)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ /* Replacing volname with clonename */
|
|
|
256ebe |
+ while (fgets(buffer, BUFSIZ, src)) {
|
|
|
256ebe |
+ buff_ptr = buffer;
|
|
|
256ebe |
+ while ((tmp_ptr = strstr(buff_ptr, find_ptr))) {
|
|
|
256ebe |
+ while (buff_ptr < tmp_ptr)
|
|
|
256ebe |
+ fputc((int)*buff_ptr++, dest);
|
|
|
256ebe |
+ fputs(dest_vol->volname, dest);
|
|
|
256ebe |
+ buff_ptr += strlen(find_ptr);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ fputs(buff_ptr, dest);
|
|
|
256ebe |
+ memset(buffer, 0, BUFSIZ);
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ if (src)
|
|
|
256ebe |
+ fclose(src);
|
|
|
256ebe |
+ if (dest)
|
|
|
256ebe |
+ fclose(dest);
|
|
|
256ebe |
+ if (find_ptr)
|
|
|
256ebe |
+ GF_FREE(find_ptr);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
int32_t
|
|
|
256ebe |
glusterd_restore_geo_rep_files(glusterd_volinfo_t *snap_vol)
|
|
|
256ebe |
{
|
|
|
256ebe |
@@ -3876,6 +4018,60 @@ out:
|
|
|
256ebe |
return ret;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_restore_nfs_ganesha_file(glusterd_volinfo_t *src_vol,
|
|
|
256ebe |
+ glusterd_snap_t *snap)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ int32_t ret = -1;
|
|
|
256ebe |
+ char snap_dir[PATH_MAX] = "";
|
|
|
256ebe |
+ char src_path[PATH_MAX] = "";
|
|
|
256ebe |
+ char dest_path[PATH_MAX] = "";
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
+ struct stat stbuf = {
|
|
|
256ebe |
+ 0,
|
|
|
256ebe |
+ };
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO("snapshot", this, out);
|
|
|
256ebe |
+ priv = this->private;
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO(this->name, priv, out);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO(this->name, src_vol, out);
|
|
|
256ebe |
+ GF_VALIDATE_OR_GOTO(this->name, snap, out);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ GLUSTERD_GET_SNAP_DIR(snap_dir, snap, priv);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = snprintf(src_path, sizeof(src_path), "%s/export.%s.conf", snap_dir,
|
|
|
256ebe |
+ snap->snapname);
|
|
|
256ebe |
+ if (ret < 0)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = sys_lstat(src_path, &stbuf);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ if (errno == ENOENT) {
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "%s not found", src_path);
|
|
|
256ebe |
+ } else
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
256ebe |
+ "Stat on %s failed with %s", src_path, strerror(errno));
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = snprintf(dest_path, sizeof(dest_path), "%s/export.%s.conf",
|
|
|
256ebe |
+ GANESHA_EXPORT_DIRECTORY, src_vol->volname);
|
|
|
256ebe |
+ if (ret < 0)
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ ret = glusterd_copy_file(src_path, dest_path);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
|
|
|
256ebe |
+ "Failed to copy %s in %s", src_path, dest_path);
|
|
|
256ebe |
+
|
|
|
256ebe |
+out:
|
|
|
256ebe |
+ return ret;
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
/* Snapd functions */
|
|
|
256ebe |
int
|
|
|
256ebe |
glusterd_is_snapd_enabled(glusterd_volinfo_t *volinfo)
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h
|
|
|
256ebe |
index e60be6e..41d0001 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-store.h
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-store.h
|
|
|
256ebe |
@@ -118,6 +118,8 @@ typedef enum glusterd_store_ver_ac_ {
|
|
|
256ebe |
#define GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SKIPPED "migration-skipped"
|
|
|
256ebe |
#define GLUSTERD_STORE_KEY_VOL_MIGRATION_RUN_TIME "migration-run-time"
|
|
|
256ebe |
|
|
|
256ebe |
+#define GLUSTERD_STORE_KEY_GANESHA_GLOBAL "nfs-ganesha"
|
|
|
256ebe |
+
|
|
|
256ebe |
int32_t
|
|
|
256ebe |
glusterd_store_volinfo(glusterd_volinfo_t *volinfo,
|
|
|
256ebe |
glusterd_volinfo_ver_ac_t ac);
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
256ebe |
index 86ef470..a0417ca 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
256ebe |
@@ -1823,6 +1823,18 @@ glusterd_op_stage_stop_volume(dict_t *dict, char **op_errstr)
|
|
|
256ebe |
goto out;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+ ret = glusterd_check_ganesha_export(volinfo);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ ret = ganesha_manage_export(dict, "off", op_errstr);
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(THIS->name, GF_LOG_WARNING, 0,
|
|
|
256ebe |
+ GD_MSG_NFS_GNS_UNEXPRT_VOL_FAIL,
|
|
|
256ebe |
+ "Could not "
|
|
|
256ebe |
+ "unexport volume via NFS-Ganesha");
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
if (glusterd_is_defrag_on(volinfo)) {
|
|
|
256ebe |
snprintf(msg, sizeof(msg),
|
|
|
256ebe |
"rebalance session is "
|
|
|
256ebe |
@@ -2674,6 +2686,8 @@ glusterd_op_start_volume(dict_t *dict, char **op_errstr)
|
|
|
256ebe |
xlator_t *this = NULL;
|
|
|
256ebe |
glusterd_conf_t *conf = NULL;
|
|
|
256ebe |
glusterd_svc_t *svc = NULL;
|
|
|
256ebe |
+ char *str = NULL;
|
|
|
256ebe |
+ gf_boolean_t option = _gf_false;
|
|
|
256ebe |
|
|
|
256ebe |
this = THIS;
|
|
|
256ebe |
GF_ASSERT(this);
|
|
|
256ebe |
@@ -2731,6 +2745,29 @@ glusterd_op_start_volume(dict_t *dict, char **op_errstr)
|
|
|
256ebe |
}
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+ ret = dict_get_str(conf->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL, &str);
|
|
|
256ebe |
+ if (ret != 0) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_DICT_GET_FAILED,
|
|
|
256ebe |
+ "Global dict not present.");
|
|
|
256ebe |
+ ret = 0;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ } else {
|
|
|
256ebe |
+ ret = gf_string2boolean(str, &option);
|
|
|
256ebe |
+ /* Check if the feature is enabled and set nfs-disable to true */
|
|
|
256ebe |
+ if (option) {
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "NFS-Ganesha is enabled");
|
|
|
256ebe |
+ /* Gluster-nfs should not start when NFS-Ganesha is enabled*/
|
|
|
256ebe |
+ ret = dict_set_str(volinfo->dict, NFS_DISABLE_MAP_KEY, "on");
|
|
|
256ebe |
+ if (ret) {
|
|
|
256ebe |
+ gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
|
|
|
256ebe |
+ "Failed to set nfs.disable for"
|
|
|
256ebe |
+ "volume %s",
|
|
|
256ebe |
+ volname);
|
|
|
256ebe |
+ goto out;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
ret = glusterd_start_volume(volinfo, flags, _gf_true);
|
|
|
256ebe |
if (ret)
|
|
|
256ebe |
goto out;
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
256ebe |
index d1244e4..13f423a 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
|
|
|
256ebe |
@@ -2597,6 +2597,13 @@ struct volopt_map_entry glusterd_volopt_map[] = {
|
|
|
256ebe |
.voltype = "features/upcall",
|
|
|
256ebe |
.op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
},
|
|
|
256ebe |
+ {
|
|
|
256ebe |
+ .key = "ganesha.enable",
|
|
|
256ebe |
+ .voltype = "features/ganesha",
|
|
|
256ebe |
+ .value = "off",
|
|
|
256ebe |
+ .option = "ganesha.enable",
|
|
|
256ebe |
+ .op_version = GD_OP_VERSION_3_7_0,
|
|
|
256ebe |
+ },
|
|
|
256ebe |
/* Lease translator options */
|
|
|
256ebe |
{
|
|
|
256ebe |
.key = "features.leases",
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
256ebe |
index 67867f8..5135181 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
256ebe |
@@ -61,6 +61,9 @@
|
|
|
256ebe |
#define GLUSTERD_LOCALTIME_LOGGING_KEY "cluster.localtime-logging"
|
|
|
256ebe |
#define GLUSTERD_DAEMON_LOG_LEVEL_KEY "cluster.daemon-log-level"
|
|
|
256ebe |
|
|
|
256ebe |
+#define GANESHA_HA_CONF CONFDIR "/ganesha-ha.conf"
|
|
|
256ebe |
+#define GANESHA_EXPORT_DIRECTORY CONFDIR "/exports"
|
|
|
256ebe |
+
|
|
|
256ebe |
#define GLUSTERD_SNAPS_MAX_HARD_LIMIT 256
|
|
|
256ebe |
#define GLUSTERD_SNAPS_DEF_SOFT_LIMIT_PERCENT 90
|
|
|
256ebe |
#define GLUSTERD_SNAPS_MAX_SOFT_LIMIT_PERCENT 100
|
|
|
256ebe |
@@ -1356,6 +1359,25 @@ glusterd_op_stop_volume(dict_t *dict);
|
|
|
256ebe |
int
|
|
|
256ebe |
glusterd_op_delete_volume(dict_t *dict);
|
|
|
256ebe |
int
|
|
|
256ebe |
+glusterd_handle_ganesha_op(dict_t *dict, char **op_errstr, char *key,
|
|
|
256ebe |
+ char *value);
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_check_ganesha_cmd(char *key, char *value, char **errstr, dict_t *dict);
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_op_stage_set_ganesha(dict_t *dict, char **op_errstr);
|
|
|
256ebe |
+int
|
|
|
256ebe |
+glusterd_op_set_ganesha(dict_t *dict, char **errstr);
|
|
|
256ebe |
+int
|
|
|
256ebe |
+ganesha_manage_export(dict_t *dict, char *value, char **op_errstr);
|
|
|
256ebe |
+gf_boolean_t
|
|
|
256ebe |
+glusterd_is_ganesha_cluster();
|
|
|
256ebe |
+gf_boolean_t
|
|
|
256ebe |
+glusterd_check_ganesha_export(glusterd_volinfo_t *volinfo);
|
|
|
256ebe |
+int
|
|
|
256ebe |
+stop_ganesha(char **op_errstr);
|
|
|
256ebe |
+int
|
|
|
256ebe |
+tear_down_cluster(gf_boolean_t run_teardown);
|
|
|
256ebe |
+int
|
|
|
256ebe |
manage_export_config(char *volname, char *value, char **op_errstr);
|
|
|
256ebe |
|
|
|
256ebe |
int
|
|
|
256ebe |
--
|
|
|
256ebe |
1.8.3.1
|
|
|
256ebe |
|