diff options
author | Krishnan Parthasarathi <kp@gluster.com> | 2011-07-26 19:24:10 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-27 01:26:02 -0700 |
commit | 7382534ac11deda2317d31f5545409824e785380 (patch) | |
tree | 1fdf63d20d06a046175a75ed0df40b6fac52cc10 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 154d8c7a3d09779d2b2eaf7247bd9b8c9420edaa (diff) |
glusterd: handle replace-brick in paused state.v3.1.6qa2
This change ensures that glusterd retains 'state' information
of an ongoing replace brick operation even if it went down midway.
Change-Id: I01d5f86c22c91a3e8801614ea172956719061a05
BUG: 3252
Reviewed-on: http://review.gluster.com/110
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 35 |
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 6ef1723bd..7de8f6af6 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; } |