summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 6ef1723bd72..7de8f6af6f8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3207,7 +3207,6 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
goto out;
}
- volinfo->version++;
volinfo->defrag_status = 0;
ret = glusterd_check_generate_start_nfs (volinfo);
@@ -3216,14 +3215,6 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
"Failed to generate nfs volume file");
}
- ret = glusterd_store_update_volume (volinfo);
-
- if (ret)
- goto out;
-
- ret = glusterd_volume_compute_cksum (volinfo);
- if (ret)
- goto out;
ret = glusterd_fetchspec_notify (THIS);
glusterd_set_rb_status (volinfo, GF_RB_STATUS_NONE);
@@ -3291,6 +3282,16 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
"received status - doing nothing");
ctx = glusterd_op_get_ctx (GD_OP_REPLACE_BRICK);
if (ctx) {
+ if (glusterd_is_rb_paused (volinfo)) {
+ ret = dict_set_str (ctx, "status-reply",
+ "replace brick has been paused");
+ if (ret)
+ gf_log (THIS->name, GF_LOG_ERROR,
+ "failed to set pump status"
+ "in ctx");
+ goto out;
+ }
+
ret = rb_do_operation_status (volinfo, src_brickinfo,
dst_brickinfo);
if (ret)
@@ -3308,6 +3309,22 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict)
if (ret)
goto out;
+ if (!ret && replace_op != GF_REPLACE_OP_STATUS) {
+ volinfo->version++;
+ ret = glusterd_store_update_volume (volinfo);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_DEBUG, "Couldn't store"
+ " replace-brick operation's state.");
+ goto out;
+ }
+
+ ret = glusterd_volume_compute_cksum (volinfo);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_DEBUG, "Computing "
+ " for volume store failed.");
+ goto out;
+ }
+ }
out:
return ret;
}