diff options
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 36 |
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 ad95e340c70..b1ace26da98 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) |