summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-01-27 05:23:34 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-01-27 03:17:13 -0800
commit7d883898c5225df3f7c38e67274b74ff8ac396c0 (patch)
tree9a1daefd1137a5c210a20d2c6485c5228f8f154d /xlators/mgmt/glusterd
parent66808736b7af00a868e98464282b1118fc80a612 (diff)
mgmt/glusterd: restart bricks when syncdaemon is enabled
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2310 (georeplication) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2310
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c62
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h2
3 files changed, 64 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 6f5dfa7a8b2..699ebdb2b7e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3421,6 +3421,52 @@ out:
}
static int
+glusterd_stop_bricks (glusterd_volinfo_t *volinfo)
+{
+ glusterd_brickinfo_t *brickinfo = NULL;
+
+ list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ if (glusterd_brick_stop (volinfo, brickinfo))
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
+glusterd_start_bricks (glusterd_volinfo_t *volinfo)
+{
+ glusterd_brickinfo_t *brickinfo = NULL;
+
+ list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ if (glusterd_brick_start (volinfo, brickinfo))
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
+glusterd_restart_brick_servers (glusterd_volinfo_t *volinfo)
+{
+ if (!volinfo)
+ return -1;
+ if (glusterd_stop_bricks (volinfo)) {
+ gf_log ("", GF_LOG_ERROR, "Restart Failed: Unable to "
+ "stop brick servers");
+ return -1;
+ }
+ usleep (500000);
+ if (glusterd_start_bricks (volinfo)) {
+ gf_log ("", GF_LOG_ERROR, "Restart Failed: Unable to "
+ "start brick servers");
+ return -1;
+ }
+ return 0;
+}
+
+
+static int
glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
{
int ret = 0;
@@ -3430,10 +3476,12 @@ glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
int count = 1;
+ int restart_flag = 0;
char *key = NULL;
char *key_fixed = NULL;
char *value = NULL;
char str[50] = {0, };
+
GF_ASSERT (req);
this = THIS;
@@ -3501,6 +3549,12 @@ glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
} else
ret = -1;
+ if (strcmp (key, MARKER_VOL_KEY) == 0 &&
+ GLUSTERD_STATUS_STARTED == volinfo->status) {
+
+ restart_flag = 1;
+ }
+
if (ret) {
gf_log ("", GF_LOG_ERROR,
"Unable to set the options in 'volume set'");
@@ -3529,6 +3583,13 @@ glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
goto out;
}
+ if (restart_flag) {
+ if (glusterd_restart_brick_servers (volinfo)) {
+ ret = -1;
+ goto out;
+ }
+ }
+
ret = glusterd_store_update_volume (volinfo);
if (ret)
goto out;
@@ -3998,6 +4059,7 @@ out:
return ret;
}
+
static int
glusterd_op_stop_volume (gd1_mgmt_stage_op_req *req)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index aa8bc517811..a87d26f7921 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -83,8 +83,6 @@ struct volopt_map_entry {
char *value;
};
-#define MARKER_VOL_KEY "monitor.xtime-marker"
-
static struct volopt_map_entry glusterd_volopt_map[] = {
{"cluster.lookup-unhashed", "cluster/distribute", }, /* NODOC */
{"cluster.min-free-disk", "cluster/distribute", }, /* NODOC */
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index e84e183ee53..372832c7c86 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -27,6 +27,8 @@
#include "glusterd.h"
+#define MARKER_VOL_KEY "monitor.xtime-marker"
+
int glusterd_create_rb_volfiles (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo);