summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-04-13 23:30:22 +0000
committerAnand Avati <avati@gluster.com>2011-04-14 01:01:00 -0700
commit8c833f1ecab9af3762f4e332126399e61fae090c (patch)
treea89003da4b51562c4a2cd1b461811dceb5ce682a /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parent93cb168fb362c7aea3c10371574a5c5566bb0222 (diff)
mgmt/glusterd: fail the volume stop opeeration if Gsync sessions are active.
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2751 (Volme stop must not be proceeded if gsync sessions are active for the volume) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2751
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index ad95e340c..b1ace26da 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -110,6 +110,9 @@ typedef struct glusterd_quota_child_info {
static int
glusterd_restart_brick_servers (glusterd_volinfo_t *);
+static int
+glusterd_check_gsync_running (glusterd_volinfo_t *volinfo, gf_boolean_t *flag);
+
char*
glusterd_op_sm_state_name_get (int state)
@@ -495,6 +498,7 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr)
char *volname = NULL;
int flags = 0;
gf_boolean_t exists = _gf_false;
+ gf_boolean_t is_run = _gf_false;
glusterd_volinfo_t *volinfo = NULL;
char msg[2048] = {0};
@@ -530,6 +534,23 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr)
ret = -1;
goto out;
}
+ ret = glusterd_check_gsync_running (volinfo, &is_run);
+ if (ret && (is_run == _gf_false))
+ gf_log ("", GF_LOG_WARNING, "Unable to get the status"
+ " of active gsync session");
+ if (is_run) {
+ gf_log ("", GF_LOG_WARNING, "Gsync sessions active"
+ "for the volume %s ", volname);
+ snprintf (msg, sizeof(msg), "Gsync sessions are active "
+ "for the volume '%s'.\nUse 'volume gsync "
+ "status' command for more info. Use 'force'"
+ "option to ignore and stop stop the volume",
+ volname);
+ *op_errstr = gf_strdup (msg);
+ ret = -1;
+ goto out;
+ }
+
}
@@ -2328,6 +2349,21 @@ out:
}
static int
+glusterd_check_gsync_running (glusterd_volinfo_t *volinfo, gf_boolean_t *flag)
+{
+
+ GF_ASSERT (volinfo);
+ GF_ASSERT (flag);
+
+ if (volinfo->gsync_slaves->count)
+ *flag = _gf_true;
+ else
+ *flag = _gf_false;
+
+ return 0;
+}
+
+static int
glusterd_op_verify_gsync_running (glusterd_volinfo_t *volinfo,
char *master, char *slave,
char **op_errstr)