From cd5c9df4b67073089a5502d5e4c2e2e7d2141e4a Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Fri, 8 Oct 2010 07:06:57 +0000 Subject: mgmt/glusterd: Fix replace brick to pass src-brick and dst-brick port nos properly. Fix also contains patch from shishir ng for maintaining replace-brick states in glusterd. Signed-off-by: Pavan Vilas Sondur Signed-off-by: Vijay Bellur BUG: 1235 (Bug for all pump/migrate commits) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1235 --- xlators/mgmt/glusterd/src/glusterd-utils.c | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 11a19d2a25e..cceecc11ce7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2337,3 +2337,53 @@ out: gf_log ("", GF_LOG_DEBUG, "returning %d ", ret); return ret; } + +inline int +glusterd_is_rb_started(glusterd_volinfo_t *volinfo) +{ + gf_log ("", GF_LOG_DEBUG, + "is_rb_started:status=%d", volinfo->rb_status); + return (volinfo->rb_status == GF_RB_STATUS_STARTED); + +} + +inline int +glusterd_is_rb_paused ( glusterd_volinfo_t *volinfo) +{ + gf_log ("", GF_LOG_DEBUG, + "is_rb_paused:status=%d", volinfo->rb_status); + + return (volinfo->rb_status == GF_RB_STATUS_PAUSED); +} + +inline int +glusterd_set_rb_status (glusterd_volinfo_t *volinfo, gf_rb_status_t status) +{ + gf_log ("", GF_LOG_DEBUG, + "setting status from %d to %d", + volinfo->rb_status, + status); + + volinfo->rb_status = status; + return 0; +} + +inline int +glusterd_rb_check_bricks (glusterd_volinfo_t *volinfo, + glusterd_brickinfo_t *src, glusterd_brickinfo_t *dst) +{ + if (!volinfo->src_brick || !volinfo->dst_brick) + return -1; + + if (strcmp (volinfo->src_brick->hostname, src->hostname) || + strcmp (volinfo->src_brick->path, src->path)) { + gf_log("", GF_LOG_ERROR, "Replace brick src bricks differ"); + return -1; + } + if (strcmp (volinfo->dst_brick->hostname, dst->hostname) || + strcmp (volinfo->dst_brick->path, dst->path)) { + gf_log ("", GF_LOG_ERROR, "Replace brick dst bricks differ"); + return -1; + } + return 0; +} -- cgit