From 22aa43c16357811f8218215d2f2f830005860c96 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Sun, 14 Nov 2010 12:08:23 +0000 Subject: mgmt/glusterd: fixes for uninterrupted replace-brick with nfs Signed-off-by: Vijay Bellur Signed-off-by: Anand V. Avati BUG: 2084 ([3.1.1qa5] : replace-brick fails to migrate data when migration from same hostname) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2084 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 34 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 62dd7fa90cc..4671aa8dfd4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2045,11 +2045,18 @@ rb_src_brick_restart (glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *src_brickinfo, int activate_pump) { - int ret = 0; + int ret = 0; gf_log ("", GF_LOG_DEBUG, "Attempting to kill src"); + ret = glusterd_nfs_server_stop (); + + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to stop nfs, ret: %d", + ret); + } + ret = glusterd_volume_stop_glusterfs (volinfo, src_brickinfo); if (ret) { gf_log ("", GF_LOG_ERROR, "Unable to stop " @@ -2084,8 +2091,12 @@ rb_src_brick_restart (glusterd_volinfo_t *volinfo, goto out; } - out: + ret = glusterd_nfs_server_start (); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to start nfs, ret: %d", + ret); + } return ret; } @@ -3055,12 +3066,6 @@ glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req, dict_t *rsp_dict) "Received commit - will be adding dst brick and " "removing src brick"); - ret = glusterd_check_generate_start_nfs (volinfo); - if (ret) { - gf_log ("", GF_LOG_CRITICAL, "Failed to generate " - " nfs volume file"); - } - if (!glusterd_is_local_addr (dst_brickinfo->hostname) && replace_op != GF_REPLACE_OP_COMMIT_FORCE) { gf_log ("", GF_LOG_NORMAL, @@ -3080,18 +3085,31 @@ glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req, dict_t *rsp_dict) } + ret = glusterd_nfs_server_stop (); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to stop nfs" + "server, ret: %d", ret); + } + ret = glusterd_op_perform_replace_brick (volinfo, src_brick, dst_brick); if (ret) { gf_log ("", GF_LOG_CRITICAL, "Unable to add " "dst-brick: %s to volume: %s", dst_brick, volinfo->volname); + (void) glusterd_check_generate_start_nfs (volinfo); goto out; } volinfo->version++; volinfo->defrag_status = 0; + ret = glusterd_check_generate_start_nfs (volinfo); + if (ret) { + gf_log ("", GF_LOG_CRITICAL, "Failed to generate " + " nfs volume file"); + } + ret = glusterd_store_update_volume (volinfo); if (ret) -- cgit