From 0e7f8af0db8201ee892979713ac86d5548f5ec73 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Thu, 11 Jul 2013 19:42:16 +0530 Subject: cli,glusterd: Improve detach check validation This patch improves the validation for the 'peer detach' command. A check for if volumes exist with some bricks on the peer being detached validation is added in peer detach code flow (even force would have this validation). This patch also gurantees that peer detach doesn't fail for a volume with all its brick on the peer which is getting detached and there are no other bricks on this peer. The following steps need to be followed for removing a downed and unrecoverable peer. * If a replacement system is available - add it to the cluster - use replace-brick to migrate bricks of the downed peer to the new peer (since data cannot be recovered anyway use the 'replace-brick commit force' command) or, If no replacement system is available, - remove bricks of the downed peer using 'remove-brick' Change-Id: Ie85ac5b66e87bec365fdedd8352b645bb25e1c33 BUG: 983590 Signed-off-by: Kaushal M Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/5325 Reviewed-by: Krishnan Parthasarathi Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-sm.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index c671edf68..fd56e5abf 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -527,6 +527,9 @@ out: return ret; } +/* Clean up stale volumes on the peer being detached. The volumes which have + * bricks on other peers are stale with respect to the detached peer. + */ static int glusterd_peer_detach_cleanup (glusterd_conf_t *priv) { @@ -538,6 +541,12 @@ glusterd_peer_detach_cleanup (glusterd_conf_t *priv) list_for_each_entry_safe (volinfo,tmp_volinfo, &priv->volumes, vol_list) { + /* The peer detach checks make sure that, at this point in the + * detach process, there are only volumes contained completely + * within or completely outside the detached peer. + * The only stale volumes at this point are the ones + * completely outside the peer and can be safely deleted. + */ if (!glusterd_friend_contains_vol_bricks (volinfo, MY_UUID)) { gf_log (THIS->name, GF_LOG_INFO, -- cgit