diff options
author | Krishnan Parthasarathi <kp@gluster.com> | 2011-07-06 14:10:25 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-27 01:50:32 -0700 |
commit | baf66413aa1d7ea65d092f2301d2ec749b6a217e (patch) | |
tree | 1bcc67bef0ab4c2b8a6dba04d81502ecc7e1d5b3 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 48665f87f55d07eb790c882e5b10217416140319 (diff) |
glusterd: handle replace-brick in paused state.
This change ensures that glusterd retains 'state' information
of an ongoing replace brick operation even if it went down midway.
Change-Id: I697c2f27a96b3200c7865bd1d3a1de9692ce0da1
BUG: 3252
Reviewed-on: http://review.gluster.com/6
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 | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 230c29c47d3..780738df23d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -4056,11 +4056,6 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict) "Failed to generate nfs volume file"); } - ret = glusterd_store_volinfo (volinfo, - GLUSTERD_VOLINFO_VER_AC_INCREMENT); - - if (ret) - goto out; ret = glusterd_fetchspec_notify (THIS); glusterd_set_rb_status (volinfo, GF_RB_STATUS_NONE); @@ -4129,6 +4124,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) @@ -4142,9 +4147,12 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict) ret = -1; goto out; } - + if (!ret && replace_op != GF_REPLACE_OP_STATUS) + ret = glusterd_store_volinfo (volinfo, + GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) - goto out; + gf_log (THIS->name, GF_LOG_ERROR, "Couldn't store" + " replace brick operation's state"); out: return ret; |