summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2016-06-27 15:08:25 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-08-25 22:54:00 -0700
commit79e9aa5d7a24275f857d2cf23f910f63c53e9d4e (patch)
treecdb53aeabf5264198eb9cf5faa4c85899649e9fd /xlators
parent0343da57b51c8b83ae59743740632ec058a0d333 (diff)
ganesha/scripts : remove 'HA_VOL_SERVER' from the code
The parameter HA_VOL_SERVER introduced intially ganesha-ha.conf to specify gluster server from which to mount the shared data volume. But after introducing new cli for the same purpose, it become unnecessary. The existence of that parameter can lead confussion to the users. This patch will remove/replace all the instance of HA_VOL_SERVER from the code Change-Id: I638c61dcd2c21ebdb279bbb141d35bb806bd3ef0 BUG: 1350371 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/14812 Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com> 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> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-ganesha.c62
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h2
3 files changed, 20 insertions, 46 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 1becbbc7e53..badb4c2f067 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -364,46 +364,14 @@ out:
return ret;
}
-/* Following 2 functions parse GANESHA_HA_CONF
+/* Following function parse GANESHA_HA_CONF
* The sample file looks like below,
* HA_NAME="ganesha-ha-360"
* HA_VOL_NAME="ha-state"
- * HA_VOL_MNT="/mount-point"
- * HA_VOL_SERVER="server1"
* HA_CLUSTER_NODES="server1,server2"
* VIP_rhs_1="10.x.x.x"
* VIP_rhs_2="10.x.x.x." */
-gf_boolean_t
-is_ganesha_host (void)
-{
- char *host_from_file = NULL;
- gf_boolean_t ret = _gf_false;
- xlator_t *this = NULL;
-
- this = THIS;
-
- host_from_file = parsing_ganesha_ha_conf ("HA_VOL_SERVER");
- if (host_from_file == NULL) {
- gf_msg (this->name, GF_LOG_INFO, errno,
- GD_MSG_GET_CONFIG_INFO_FAILED,
- "couldn't get HA_VOL_SERVER from file %s",
- GANESHA_HA_CONF);
- return _gf_false;
- }
-
- ret = gf_is_local_addr (host_from_file);
- if (ret) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- GD_MSG_NFS_GNS_HOST_FOUND,
- "ganesha host found "
- "Hostname is %s", host_from_file);
- }
-
- GF_FREE (host_from_file);
- return ret;
-}
-
/* Check if the localhost is listed as one of nfs-ganesha nodes */
gf_boolean_t
check_host_list (void)
@@ -411,7 +379,7 @@ check_host_list (void)
glusterd_conf_t *priv = NULL;
char *hostname, *hostlist;
- int ret = _gf_false;
+ gf_boolean_t ret = _gf_false;
xlator_t *this = NULL;
this = THIS;
@@ -639,7 +607,7 @@ out:
}
int
-tear_down_cluster(void)
+tear_down_cluster(gf_boolean_t run_teardown)
{
int ret = 0;
runner_t runner = {0,};
@@ -649,7 +617,7 @@ tear_down_cluster(void)
struct dirent scratch[2] = {{0,},};
char path[PATH_MAX] = {0,};
- if (is_ganesha_host()) {
+ if (run_teardown) {
runinit (&runner);
runner_add_args (&runner, "sh",
GANESHA_PREFIX"/ganesha-ha.sh", "teardown",
@@ -709,12 +677,12 @@ out:
int
-setup_cluster(void)
+setup_cluster(gf_boolean_t run_setup)
{
int ret = 0;
runner_t runner = {0,};
- if (is_ganesha_host()) {
+ if (run_setup) {
runinit (&runner);
runner_add_args (&runner, "sh", GANESHA_PREFIX"/ganesha-ha.sh",
"setup", CONFDIR, NULL);
@@ -725,7 +693,7 @@ setup_cluster(void)
static int
-teardown (char **op_errstr)
+teardown (gf_boolean_t run_teardown, char **op_errstr)
{
runner_t runner = {0,};
int ret = 1;
@@ -735,7 +703,7 @@ teardown (char **op_errstr)
priv = THIS->private;
- ret = tear_down_cluster();
+ ret = tear_down_cluster (run_teardown);
if (ret == -1) {
gf_asprintf (op_errstr, "Cleanup of NFS-Ganesha"
" HA config failed.");
@@ -873,14 +841,14 @@ out:
}
static int
-pre_setup (char **op_errstr)
+pre_setup (gf_boolean_t run_setup, char **op_errstr)
{
int ret = 0;
ret = check_host_list();
if (ret) {
- ret = setup_cluster();
+ ret = setup_cluster(run_setup);
if (ret == -1)
gf_asprintf (op_errstr, "Failed to set up HA "
"config for NFS-Ganesha. "
@@ -927,12 +895,18 @@ glusterd_handle_ganesha_op (dict_t *dict, char **op_errstr,
}
if (strcmp (key, GLUSTERD_STORE_KEY_GANESHA_GLOBAL) == 0) {
+ /* *
+ * The set up/teardown of pcs cluster should be performed only
+ * once. This will done on the node in which the cli command
+ * 'gluster nfs-ganesha <enable/disable>' got executed. So that
+ * node should part of ganesha HA cluster
+ */
if (option) {
- ret = pre_setup (op_errstr);
+ ret = pre_setup (is_origin_glusterd (dict), op_errstr);
if (ret < 0)
goto out;
} else {
- ret = teardown (op_errstr);
+ ret = teardown (is_origin_glusterd (dict), op_errstr);
if (ret < 0)
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index b4eb8b13c66..5519d2f734c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2047,7 +2047,7 @@ glusterd_op_reset_all_volume_options (xlator_t *this, dict_t *dict)
option = dict_get_str_boolean (conf->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL,
_gf_false);
if (option) {
- ret = tear_down_cluster();
+ ret = tear_down_cluster (is_origin_glusterd (dict));
if (ret == -1)
gf_msg (THIS->name, GF_LOG_WARNING, errno,
GD_MSG_DICT_GET_FAILED,
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index c07fe42fe61..11b55cbb79d 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -1072,7 +1072,7 @@ int ganesha_manage_export (char *volname, char *value, char **op_errstr,
gf_boolean_t reboot);
gf_boolean_t glusterd_check_ganesha_export (glusterd_volinfo_t *volinfo);
int stop_ganesha (char **op_errstr);
-int tear_down_cluster (void);
+int tear_down_cluster (gf_boolean_t run_teardown);
int glusterd_op_add_brick (dict_t *dict, char **op_errstr);
int glusterd_op_remove_brick (dict_t *dict, char **op_errstr);
int glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr,