summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorjiffin tony thottan <jthottan@redhat.com>2015-12-07 14:38:54 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2017-04-24 10:32:20 +0000
commit6026944157798e0aca087a540776c0701ab0ced6 (patch)
treef0e47576340218faaf49bf5a3bb6c4d67ea3d1ca /xlators
parentc8e1c2d9382bd57fbdcc491e21fe24be3d4a1252 (diff)
glusterd/ganesha : throw proper error for "gluster nfs-ganesha disable"
For first time or if "gluster nfs-ganesha enable" fails the global option "nfs-ganesha" won't be stored in glusterd's dictionary. In both cases the "gluster nfs-ganesha disable" throws following error : "nfs-ganesha: failed: nfs-ganesha is already (null)d." Also this patch provides the missing prompt for nfs-ganesha disable in 3.10 Change-Id: I7c9fd6dabedc0cfb14c5190b3554bc63a6bc0340 BUG: 1427759 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: https://review.gluster.org/16791 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-ganesha.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 2e62f9d7ba1..0348f7c280b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -258,8 +258,7 @@ int
glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
{
int ret = -1;
- int value = -1;
- gf_boolean_t option = _gf_false;
+ char *value = NULL;
char *str = NULL;
glusterd_conf_t *priv = NULL;
xlator_t *this = NULL;
@@ -270,8 +269,8 @@ glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
priv = this->private;
GF_ASSERT (priv);
- value = dict_get_str_boolean (dict, "value", _gf_false);
- if (value == -1) {
+ ret = dict_get_str (dict, "value", &value);
+ if (value == NULL) {
gf_msg (this->name, GF_LOG_ERROR, errno,
GD_MSG_DICT_GET_FAILED,
"value not present.");
@@ -280,22 +279,13 @@ glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
/* This dict_get will fail if the user had never set the key before */
/*Ignoring the ret value and proceeding */
ret = dict_get_str (priv->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL, &str);
- if (ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING, errno,
- GD_MSG_DICT_GET_FAILED, "Global dict not present.");
- ret = 0;
- goto out;
+ /* Check if the feature is already enabled/disable, fail in that case */
+ if (str ? strcmp (value, str) == 0 : strcmp (value, "disable") == 0) {
+ gf_asprintf (op_errstr, "nfs-ganesha is already %sd.", value);
+ ret = -1;
+ goto out;
}
- /* Validity of the value is already checked */
- ret = gf_string2boolean (str, &option);
- /* Check if the feature is already enabled, fail in that case */
- if (value == option) {
- gf_asprintf (op_errstr, "nfs-ganesha is already %sd.", str);
- ret = -1;
- goto out;
- }
-
- if (value) {
+ if (strcmp (value, "enable") == 0) {
ret = start_ganesha (op_errstr);
if (ret) {
gf_msg (THIS->name, GF_LOG_ERROR, 0,