From 513cd0d12e3b72e9a3714deeee251414e651213f Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Sun, 2 Oct 2011 13:20:25 +0530 Subject: glusterd: take off 'auto-commit' behavior of decommissioning currently if 'remove-brick start' is given, after all the data is migrated, in the _cbk() function from rebalance complete we used to re-write the volume file without the bricks. But the flaw of this method is that, currently the _cbk() function is called on only the node on which rebalance actually happens, hence other nodes are not aware of this behavior. So, had to remove the 'auto-commit', instead we want the user to issue a command 'remove-brick commit' (or 'force') explicitely to remove the bricks Change-Id: Ifdac1292095029429da502aa6e4c0cf4ee124990 BUG: 1952 Reviewed-on: http://review.gluster.com/551 Tested-by: Gluster Build System Reviewed-by: Shishir Gowda Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index c61d18f664d..3bac37310a8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -842,6 +842,9 @@ glusterd_remove_brick_migrate_cbk (glusterd_volinfo_t *volinfo, gf_defrag_status_t status) { int ret = 0; + +#if 0 /* TODO: enable this behavior once cluster-wide awareness comes for + defrag cbk function */ glusterd_brickinfo_t *brickinfo = NULL; glusterd_brickinfo_t *tmp = NULL; @@ -903,8 +906,10 @@ glusterd_remove_brick_migrate_cbk (glusterd_volinfo_t *volinfo, "Unable to start nfs process (%d)", ret); } +#endif + volinfo->decommission_in_progress = 0; - return 0; + return ret; } @@ -995,6 +1000,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) int need_rebalance = 0; int force = 0; gf1_op_commands cmd = 0; + glusterd_brickinfo_t *brickinfo = NULL; + glusterd_brickinfo_t *tmp = NULL; ret = dict_get_str (dict, "volname", &volname); @@ -1037,7 +1044,7 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) } } - /* rebalance '_cbk()' will take care of volume file updates */ + /* no need to update anything */ ret = 0; goto out; } @@ -1054,9 +1061,14 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) } } - /* rebalance '_cbk()' will take care of volume file updates */ + /* Fall back to the old volume file */ + list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks, brick_list) { + if (!brickinfo->decommissioned) + continue; + brickinfo->decommissioned = 0; + } ret = 0; - goto out; + break; } case GF_OP_CMD_START: @@ -1078,12 +1090,12 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) UNLOCK (&volinfo->defrag->lock); } - ret = 0; /* Graph change happens in rebalance _cbk function, no need to do anything here */ - goto out; + /* TODO: '_cbk' function is not doing anything for now */ } + ret = 0; force = 1; break; } -- cgit