[sheepdog] [PATCH 3/3] sheep: correct check of node id in create_cluster()

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Jan 14 06:23:23 CET 2015


We should compare node id with node_id_cmp() (the bug was introduced
in 5fed9d696c70).

Cc: Saeki Masaki <saeki.masaki at po.ntts.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/group.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 2034300..85b9249 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -1360,12 +1360,8 @@ int create_cluster(int port, int64_t zone, int nr_vnodes,
 
 	if (!is_cluster_autovnodes(&sys->cinfo)) {
 		for (i = 0; i < nr_nodes; i++) {
-			if ((addr_to_str(sys->this_node.nid.addr,
-					sys->this_node.nid.port)
-				== addr_to_str(sys->cinfo.nodes[i].nid.addr,
-					sys->cinfo.nodes[i].nid.port))
-				&& (sys->this_node.nid.port
-					== sys->cinfo.nodes[i].nid.port)) {
+			if (!node_id_cmp(&sys->this_node.nid,
+					 &sys->cinfo.nodes[i].nid)) {
 				vnodes = sys->cinfo.nodes[i].nr_vnodes;
 				break;
 			}
-- 
1.9.1




More information about the sheepdog mailing list