|
|
14f8ab |
From 8b501d9dfbeecb3ffdc3cd11b7c74aa929356ed6 Mon Sep 17 00:00:00 2001
|
|
|
14f8ab |
From: jiffin tony thottan <jthottan@redhat.com>
|
|
|
14f8ab |
Date: Mon, 7 Dec 2015 14:38:54 +0530
|
|
|
14f8ab |
Subject: [PATCH 059/124] glusterd/ganesha : throw proper error for "gluster
|
|
|
14f8ab |
nfs-ganesha disable"
|
|
|
14f8ab |
|
|
|
14f8ab |
For first time or if "gluster nfs-ganesha enable" fails the global option
|
|
|
14f8ab |
"nfs-ganesha" won't be stored in glusterd's dictionary. In both cases the
|
|
|
14f8ab |
"gluster nfs-ganesha disable" throws following error :
|
|
|
14f8ab |
"nfs-ganesha: failed: nfs-ganesha is already (null)d."
|
|
|
14f8ab |
|
|
|
14f8ab |
Also this patch provides the missing prompt for nfs-ganesha disable in 3.10
|
|
|
14f8ab |
|
|
|
14f8ab |
Label: DOWNSTREAM ONLY
|
|
|
14f8ab |
|
|
|
14f8ab |
Change-Id: I7c9fd6dabedc0cfb14c5190b3554bc63a6bc0340
|
|
|
14f8ab |
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://review.gluster.org/16791
|
|
|
14f8ab |
Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
14f8ab |
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
14f8ab |
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
14f8ab |
Reviewed-by: soumya k <skoduri@redhat.com>
|
|
|
14f8ab |
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
|
|
|
14f8ab |
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://code.engineering.redhat.com/gerrit/167144
|
|
|
14f8ab |
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
|
|
|
14f8ab |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
14f8ab |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
14f8ab |
---
|
|
|
14f8ab |
cli/src/cli-cmd-parser.c | 33 +++++++++++++++++-----------
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 22 +++++--------------
|
|
|
14f8ab |
2 files changed, 26 insertions(+), 29 deletions(-)
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
|
|
|
14f8ab |
index cd9c445..f85958b 100644
|
|
|
14f8ab |
--- a/cli/src/cli-cmd-parser.c
|
|
|
14f8ab |
+++ b/cli/src/cli-cmd-parser.c
|
|
|
14f8ab |
@@ -5908,20 +5908,27 @@ cli_cmd_ganesha_parse(struct cli_state *state, const char **words,
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- question =
|
|
|
14f8ab |
- "Enabling NFS-Ganesha requires Gluster-NFS to be"
|
|
|
14f8ab |
- " disabled across the trusted pool. Do you "
|
|
|
14f8ab |
- "still want to continue?\n";
|
|
|
14f8ab |
-
|
|
|
14f8ab |
if (strcmp(value, "enable") == 0) {
|
|
|
14f8ab |
- answer = cli_cmd_get_confirmation(state, question);
|
|
|
14f8ab |
- if (GF_ANSWER_NO == answer) {
|
|
|
14f8ab |
- gf_log("cli", GF_LOG_ERROR,
|
|
|
14f8ab |
- "Global operation "
|
|
|
14f8ab |
- "cancelled, exiting");
|
|
|
14f8ab |
- ret = -1;
|
|
|
14f8ab |
- goto out;
|
|
|
14f8ab |
- }
|
|
|
14f8ab |
+ question =
|
|
|
14f8ab |
+ "Enabling NFS-Ganesha requires Gluster-NFS to be "
|
|
|
14f8ab |
+ "disabled across the trusted pool. Do you "
|
|
|
14f8ab |
+ "still want to continue?\n";
|
|
|
14f8ab |
+ } else if (strcmp(value, "disable") == 0) {
|
|
|
14f8ab |
+ question =
|
|
|
14f8ab |
+ "Disabling NFS-Ganesha will tear down the entire "
|
|
|
14f8ab |
+ "ganesha cluster across the trusted pool. Do you "
|
|
|
14f8ab |
+ "still want to continue?\n";
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ ret = -1;
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ answer = cli_cmd_get_confirmation(state, question);
|
|
|
14f8ab |
+ if (GF_ANSWER_NO == answer) {
|
|
|
14f8ab |
+ gf_log("cli", GF_LOG_ERROR,
|
|
|
14f8ab |
+ "Global operation "
|
|
|
14f8ab |
+ "cancelled, exiting");
|
|
|
14f8ab |
+ ret = -1;
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
cli_out("This will take a few minutes to complete. Please wait ..");
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
14f8ab |
index 6d72fda..1d17a33 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
14f8ab |
@@ -252,8 +252,7 @@ int
|
|
|
14f8ab |
glusterd_op_stage_set_ganesha(dict_t *dict, char **op_errstr)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
int ret = -1;
|
|
|
14f8ab |
- int value = -1;
|
|
|
14f8ab |
- gf_boolean_t option = _gf_false;
|
|
|
14f8ab |
+ char *value = NULL;
|
|
|
14f8ab |
char *str = NULL;
|
|
|
14f8ab |
glusterd_conf_t *priv = NULL;
|
|
|
14f8ab |
xlator_t *this = NULL;
|
|
|
14f8ab |
@@ -264,8 +263,8 @@ glusterd_op_stage_set_ganesha(dict_t *dict, char **op_errstr)
|
|
|
14f8ab |
priv = this->private;
|
|
|
14f8ab |
GF_ASSERT(priv);
|
|
|
14f8ab |
|
|
|
14f8ab |
- value = dict_get_str_boolean(dict, "value", _gf_false);
|
|
|
14f8ab |
- if (value == -1) {
|
|
|
14f8ab |
+ ret = dict_get_str(dict, "value", &value);
|
|
|
14f8ab |
+ if (value == NULL) {
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED,
|
|
|
14f8ab |
"value not present.");
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
@@ -273,22 +272,13 @@ glusterd_op_stage_set_ganesha(dict_t *dict, char **op_errstr)
|
|
|
14f8ab |
/* This dict_get will fail if the user had never set the key before */
|
|
|
14f8ab |
/*Ignoring the ret value and proceeding */
|
|
|
14f8ab |
ret = dict_get_str(priv->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL, &str);
|
|
|
14f8ab |
- if (ret == -1) {
|
|
|
14f8ab |
- gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_DICT_GET_FAILED,
|
|
|
14f8ab |
- "Global dict not present.");
|
|
|
14f8ab |
- ret = 0;
|
|
|
14f8ab |
- goto out;
|
|
|
14f8ab |
- }
|
|
|
14f8ab |
- /* Validity of the value is already checked */
|
|
|
14f8ab |
- ret = gf_string2boolean(str, &option);
|
|
|
14f8ab |
- /* Check if the feature is already enabled, fail in that case */
|
|
|
14f8ab |
- if (value == option) {
|
|
|
14f8ab |
- gf_asprintf(op_errstr, "nfs-ganesha is already %sd.", str);
|
|
|
14f8ab |
+ if (str ? strcmp(value, str) == 0 : strcmp(value, "disable") == 0) {
|
|
|
14f8ab |
+ gf_asprintf(op_errstr, "nfs-ganesha is already %sd.", value);
|
|
|
14f8ab |
ret = -1;
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- if (value) {
|
|
|
14f8ab |
+ if (strcmp(value, "enable")) {
|
|
|
14f8ab |
ret = start_ganesha(op_errstr);
|
|
|
14f8ab |
if (ret) {
|
|
|
14f8ab |
gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_NFS_GNS_START_FAIL,
|
|
|
14f8ab |
--
|
|
|
14f8ab |
1.8.3.1
|
|
|
14f8ab |
|