|
|
3604df |
From 945286d6bdd8813e4c107be282cffe64bbeac44f Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
Date: Wed, 23 Nov 2016 16:04:26 +0530
|
|
|
3604df |
Subject: [PATCH 230/235] glusterd/ganesha : handle volume reset properly for
|
|
|
3604df |
ganesha options
|
|
|
3604df |
|
|
|
3604df |
The "gluster volume reset" should first unexport the volume and then delete
|
|
|
3604df |
export configuration file. Also reset option is not applicable for ganesha.enable
|
|
|
3604df |
if volume value is "all".
|
|
|
3604df |
This patch also changes the name of create_export_config into manange_export_config
|
|
|
3604df |
|
|
|
3604df |
Upstream reference :
|
|
|
3604df |
>Change-Id: Ie81a49e7d3e39a88bca9fbae5002bfda5cab34af
|
|
|
3604df |
>BUG: 1397795
|
|
|
3604df |
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
>Reviewed-on: http://review.gluster.org/15914
|
|
|
3604df |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Reviewed-by: soumya k <skoduri@redhat.com>
|
|
|
3604df |
>Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
|
|
|
3604df |
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
Change-Id: Ie81a49e7d3e39a88bca9fbae5002bfda5cab34af
|
|
|
3604df |
BUG: 1397450
|
|
|
3604df |
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/92365
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
extras/hook-scripts/reset/post/Makefile.am | 5 +-
|
|
|
3604df |
extras/hook-scripts/reset/post/S31ganesha-reset.sh | 48 ------------------
|
|
|
3604df |
glusterfs.spec.in | 4 +-
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 6 +--
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 57 ++++++++++------------
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd.h | 2 +-
|
|
|
3604df |
6 files changed, 35 insertions(+), 87 deletions(-)
|
|
|
3604df |
delete mode 100755 extras/hook-scripts/reset/post/S31ganesha-reset.sh
|
|
|
3604df |
|
|
|
3604df |
diff --git a/extras/hook-scripts/reset/post/Makefile.am b/extras/hook-scripts/reset/post/Makefile.am
|
|
|
3604df |
index bb28d99..1b336ac 100644
|
|
|
3604df |
--- a/extras/hook-scripts/reset/post/Makefile.am
|
|
|
3604df |
+++ b/extras/hook-scripts/reset/post/Makefile.am
|
|
|
3604df |
@@ -1,4 +1 @@
|
|
|
3604df |
-EXTRA_DIST = S31ganesha-reset.sh
|
|
|
3604df |
-
|
|
|
3604df |
-hookdir = $(GLUSTERD_WORKDIR)/hooks/1/reset/post/
|
|
|
3604df |
-hook_SCRIPTS = S31ganesha-reset.sh
|
|
|
3604df |
+EXTRA_DIST =
|
|
|
3604df |
diff --git a/extras/hook-scripts/reset/post/S31ganesha-reset.sh b/extras/hook-scripts/reset/post/S31ganesha-reset.sh
|
|
|
3604df |
deleted file mode 100755
|
|
|
3604df |
index 9538911..0000000
|
|
|
3604df |
--- a/extras/hook-scripts/reset/post/S31ganesha-reset.sh
|
|
|
3604df |
+++ /dev/null
|
|
|
3604df |
@@ -1,48 +0,0 @@
|
|
|
3604df |
-#!/bin/bash
|
|
|
3604df |
-
|
|
|
3604df |
-PROGNAME="Sganesha-reset"
|
|
|
3604df |
-OPTSPEC="volname:,gd-workdir:"
|
|
|
3604df |
-VOL=
|
|
|
3604df |
-GLUSTERD_WORKDIR=
|
|
|
3604df |
-
|
|
|
3604df |
-function parse_args () {
|
|
|
3604df |
- ARGS=$(getopt -l $OPTSPEC -o "o" -name $PROGNAME $@)
|
|
|
3604df |
- eval set -- "$ARGS"
|
|
|
3604df |
- while true; do
|
|
|
3604df |
- case $1 in
|
|
|
3604df |
- --volname)
|
|
|
3604df |
- shift
|
|
|
3604df |
- VOL=$1
|
|
|
3604df |
- ;;
|
|
|
3604df |
- --gd-workdir)
|
|
|
3604df |
- shift
|
|
|
3604df |
- GLUSTERD_WORKDIR=$1
|
|
|
3604df |
- ;;
|
|
|
3604df |
- *)
|
|
|
3604df |
- shift
|
|
|
3604df |
- break
|
|
|
3604df |
- ;;
|
|
|
3604df |
- esac
|
|
|
3604df |
- shift
|
|
|
3604df |
- done
|
|
|
3604df |
-}
|
|
|
3604df |
-
|
|
|
3604df |
-function is_volume_started () {
|
|
|
3604df |
- volname=$1
|
|
|
3604df |
- echo "$(grep status $GLUSTERD_WORKDIR/vols/"$volname"/info |\
|
|
|
3604df |
- cut -d"=" -f2)"
|
|
|
3604df |
-}
|
|
|
3604df |
-
|
|
|
3604df |
-parse_args $@
|
|
|
3604df |
-if ps aux | grep -q "[g]anesha.nfsd"
|
|
|
3604df |
- then
|
|
|
3604df |
- kill -s TERM `cat /var/run/ganesha.pid`
|
|
|
3604df |
- sleep 10
|
|
|
3604df |
- rm -rf /var/lib/glusterfs-ganesha/exports
|
|
|
3604df |
- rm -rf /var/lib/glusterfs-ganesha/.export_added
|
|
|
3604df |
- sed -i /conf/d /var/lib/ganesha/nfs-ganesha.conf
|
|
|
3604df |
- if [ "1" = $(is_volume_started "$VOL") ];
|
|
|
3604df |
- then
|
|
|
3604df |
- gluster volume start $VOL force
|
|
|
3604df |
- fi
|
|
|
3604df |
-fi
|
|
|
3604df |
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
|
|
|
3604df |
index f2231b3..9b29de3 100644
|
|
|
3604df |
--- a/glusterfs.spec.in
|
|
|
3604df |
+++ b/glusterfs.spec.in
|
|
|
3604df |
@@ -1226,7 +1226,6 @@ exit 0
|
|
|
3604df |
%{_libexecdir}/ganesha/*
|
|
|
3604df |
%{_prefix}/lib/ocf/resource.d/heartbeat/*
|
|
|
3604df |
%{_sharedstatedir}/glusterd/hooks/1/start/post/S31ganesha-start.sh
|
|
|
3604df |
-%{_sharedstatedir}/glusterd/hooks/1/reset/post/S31ganesha-reset.sh
|
|
|
3604df |
%endif
|
|
|
3604df |
|
|
|
3604df |
%if ( 0%{?_build_server} )
|
|
|
3604df |
@@ -2047,6 +2046,9 @@ end
|
|
|
3604df |
%endif
|
|
|
3604df |
|
|
|
3604df |
%changelog
|
|
|
3604df |
+* Thu Dec 7 2016 Jiffin Tony Thottan <jhottan@redhat.com>
|
|
|
3604df |
+- remove S31ganesha-reset.sh from hooks (#1397450)
|
|
|
3604df |
+
|
|
|
3604df |
* Fri Nov 18 2016 Soumya Koduri <skoduri@redhat.com>
|
|
|
3604df |
- As an interim fix add dependency on netstat(/net-tools) for glusterfs-ganesha package (#1395574)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
3604df |
index 670c21f..470d455 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
|
|
|
3604df |
@@ -216,7 +216,7 @@ glusterd_check_ganesha_cmd (char *key, char *value, char **errstr, dict_t *dict)
|
|
|
3604df |
"Unable to get volume name");
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
- ret = create_export_config (volname, "off", errstr);
|
|
|
3604df |
+ ret = manage_export_config (volname, "off", errstr);
|
|
|
3604df |
}
|
|
|
3604df |
}
|
|
|
3604df |
out:
|
|
|
3604df |
@@ -433,7 +433,7 @@ check_host_list (void)
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
int
|
|
|
3604df |
-create_export_config (char *volname, char *value, char **op_errstr)
|
|
|
3604df |
+manage_export_config (char *volname, char *value, char **op_errstr)
|
|
|
3604df |
{
|
|
|
3604df |
runner_t runner = {0,};
|
|
|
3604df |
int ret = -1;
|
|
|
3604df |
@@ -536,7 +536,7 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr)
|
|
|
3604df |
* is executed
|
|
|
3604df |
* */
|
|
|
3604df |
if (option) {
|
|
|
3604df |
- ret = create_export_config (volname, "on", op_errstr);
|
|
|
3604df |
+ ret = manage_export_config (volname, "on", op_errstr);
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
3604df |
GD_MSG_EXPORT_FILE_CREATE_FAIL,
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
3604df |
index 9afeb52..31b16e8 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
3604df |
@@ -1500,15 +1500,6 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
|
|
|
3604df |
ret = glusterd_validate_volume_id (dict, volinfo);
|
|
|
3604df |
if (ret)
|
|
|
3604df |
goto out;
|
|
|
3604df |
- ret = dict_get_str_boolean (priv->opts,
|
|
|
3604df |
- GLUSTERD_STORE_KEY_GANESHA_GLOBAL, _gf_false);
|
|
|
3604df |
- if (ret) {
|
|
|
3604df |
- ret = stop_ganesha (op_errstr);
|
|
|
3604df |
- if (ret)
|
|
|
3604df |
- gf_msg (THIS->name, GF_LOG_WARNING, 0,
|
|
|
3604df |
- GD_MSG_NFS_GNS_STOP_FAIL,
|
|
|
3604df |
- "Could not stop NFS-Ganesha service");
|
|
|
3604df |
- }
|
|
|
3604df |
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
@@ -1518,7 +1509,23 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
|
|
|
3604df |
GD_MSG_DICT_GET_FAILED, "Unable to get option key");
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
- if (strcmp(key, "all")) {
|
|
|
3604df |
+
|
|
|
3604df |
+ /* *
|
|
|
3604df |
+ * If key ganesha.enable is set, then volume should be unexported from
|
|
|
3604df |
+ * ganesha server. Also it is a volume-level option, perform only when
|
|
|
3604df |
+ * volume name not equal to "all"(in other words if volinfo != NULL)
|
|
|
3604df |
+ */
|
|
|
3604df |
+ if (volinfo && (!strcmp (key, "all") || !strcmp(key, "ganesha.enable"))) {
|
|
|
3604df |
+ if (glusterd_check_ganesha_export (volinfo)) {
|
|
|
3604df |
+ ret = ganesha_manage_export (dict, "off", op_errstr);
|
|
|
3604df |
+ if (ret)
|
|
|
3604df |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
3604df |
+ GD_MSG_NFS_GNS_RESET_FAIL,
|
|
|
3604df |
+ "Could not reset ganesha.enable key");
|
|
|
3604df |
+ }
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+ if (strcmp(key, "all")) {
|
|
|
3604df |
exists = glusterd_check_option_exists (key, &key_fixed);
|
|
|
3604df |
if (exists == -1) {
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
@@ -2058,7 +2065,6 @@ glusterd_op_reset_all_volume_options (xlator_t *this, dict_t *dict)
|
|
|
3604df |
gf_boolean_t all = _gf_false;
|
|
|
3604df |
char *next_version = NULL;
|
|
|
3604df |
gf_boolean_t quorum_action = _gf_false;
|
|
|
3604df |
- gf_boolean_t option = _gf_false;
|
|
|
3604df |
char *op_errstr = NULL;
|
|
|
3604df |
|
|
|
3604df |
conf = this->private;
|
|
|
3604df |
@@ -2088,15 +2094,6 @@ glusterd_op_reset_all_volume_options (xlator_t *this, dict_t *dict)
|
|
|
3604df |
|
|
|
3604df |
if (key_fixed)
|
|
|
3604df |
key = key_fixed;
|
|
|
3604df |
- option = dict_get_str_boolean (conf->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL,
|
|
|
3604df |
- _gf_false);
|
|
|
3604df |
- if (option) {
|
|
|
3604df |
- ret = tear_down_cluster (is_origin_glusterd (dict));
|
|
|
3604df |
- if (ret == -1)
|
|
|
3604df |
- gf_msg (THIS->name, GF_LOG_WARNING, errno,
|
|
|
3604df |
- GD_MSG_DICT_GET_FAILED,
|
|
|
3604df |
- "Could not tear down NFS-Ganesha cluster");
|
|
|
3604df |
- }
|
|
|
3604df |
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
dup_opt = dict_new ();
|
|
|
3604df |
@@ -2205,16 +2202,6 @@ glusterd_op_reset_volume (dict_t *dict, char **op_rspstr)
|
|
|
3604df |
|
|
|
3604df |
if (glusterd_is_quorum_changed (volinfo->dict, key, NULL))
|
|
|
3604df |
quorum_action = _gf_true;
|
|
|
3604df |
- ret = glusterd_check_ganesha_export (volinfo);
|
|
|
3604df |
- if (ret) {
|
|
|
3604df |
- ret = ganesha_manage_export (dict, "off", op_rspstr);
|
|
|
3604df |
- if (ret) {
|
|
|
3604df |
- gf_msg (THIS->name, GF_LOG_WARNING, 0,
|
|
|
3604df |
- GD_MSG_NFS_GNS_RESET_FAIL,
|
|
|
3604df |
- "Could not reset ganesha.enable key");
|
|
|
3604df |
- ret = 0;
|
|
|
3604df |
- }
|
|
|
3604df |
- }
|
|
|
3604df |
|
|
|
3604df |
ret = glusterd_options_reset (volinfo, key, &is_force);
|
|
|
3604df |
if (ret == -1) {
|
|
|
3604df |
@@ -2231,6 +2218,16 @@ glusterd_op_reset_volume (dict_t *dict, char **op_rspstr)
|
|
|
3604df |
}
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
+ if (!strcmp(key, "ganesha.enable") || !strcmp (key, "all")) {
|
|
|
3604df |
+ if (glusterd_check_ganesha_export (volinfo)) {
|
|
|
3604df |
+ ret = manage_export_config (volname, "off", op_rspstr);
|
|
|
3604df |
+ if (ret)
|
|
|
3604df |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
3604df |
+ GD_MSG_NFS_GNS_RESET_FAIL,
|
|
|
3604df |
+ "Could not reset ganesha.enable key");
|
|
|
3604df |
+ }
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
out:
|
|
|
3604df |
GF_FREE (key_fixed);
|
|
|
3604df |
if (quorum_action)
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
3604df |
index 23b7623..b926383 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
3604df |
@@ -1076,7 +1076,7 @@ int glusterd_check_ganesha_cmd (char *key, char *value,
|
|
|
3604df |
int glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr);
|
|
|
3604df |
int glusterd_op_set_ganesha (dict_t *dict, char **errstr);
|
|
|
3604df |
int ganesha_manage_export (dict_t *dict, char *value, char **op_errstr);
|
|
|
3604df |
-int create_export_config (char *volname, char *value, char **op_errstr);
|
|
|
3604df |
+int manage_export_config (char *volname, char *value, char **op_errstr);
|
|
|
3604df |
gf_boolean_t glusterd_check_ganesha_export (glusterd_volinfo_t *volinfo);
|
|
|
3604df |
int stop_ganesha (char **op_errstr);
|
|
|
3604df |
int tear_down_cluster (gf_boolean_t run_teardown);
|
|
|
3604df |
--
|
|
|
3604df |
2.9.3
|
|
|
3604df |
|