From 710c52d23a2e7839a156c123167c6e13c8207f76 Mon Sep 17 00:00:00 2001 From: JulesWang Date: Fri, 25 Jan 2013 11:49:18 +0800 Subject: glusterd: make 'glusterd_is_local_addr' return bool Change-Id: Id3bd0bfc4802c166f7a32b0cc6a726aeb5617b5d BUG: 890618 Signed-off-by: JulesWang Reviewed-on: http://review.gluster.org/4427 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 39 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index ef262b85..b5026193 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -763,25 +763,7 @@ glusterd_op_stage_sync_volume (dict_t *dict, char **op_errstr) goto out; } - ret = glusterd_is_local_addr (hostname); - if (ret) { - ret = glusterd_friend_find (NULL, hostname, &peerinfo); - if (ret) { - snprintf (msg, sizeof (msg), "%s, is not a friend", - hostname); - *op_errstr = gf_strdup (msg); - goto out; - } - - if (!peerinfo->connected) { - snprintf (msg, sizeof (msg), "%s, is not connected at " - "the moment", hostname); - *op_errstr = gf_strdup (msg); - ret = -1; - goto out; - } - } else { - + if (glusterd_is_local_addr (hostname)) { //volname is not present in case of sync all ret = dict_get_str (dict, "volname", &volname); if (!ret) { @@ -800,6 +782,23 @@ glusterd_op_stage_sync_volume (dict_t *dict, char **op_errstr) } else { ret = 0; } + } else { + ret = glusterd_friend_find (NULL, hostname, &peerinfo); + if (ret) { + snprintf (msg, sizeof (msg), "%s, is not a friend", + hostname); + *op_errstr = gf_strdup (msg); + goto out; + } + + if (!peerinfo->connected) { + snprintf (msg, sizeof (msg), "%s, is not connected at " + "the moment", hostname); + *op_errstr = gf_strdup (msg); + ret = -1; + goto out; + } + } out: @@ -1654,7 +1653,7 @@ glusterd_op_sync_volume (dict_t *dict, char **op_errstr, goto out; } - if (glusterd_is_local_addr (hostname)) { + if (!glusterd_is_local_addr (hostname)) { ret = 0; goto out; } -- cgit