ctdb-ipalloc: Drop implicit dependency on ctdb-common
authorMartin Schwenke <martin@meltin.net>
Thu, 26 May 2016 05:31:47 +0000 (15:31 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 4 Jul 2016 13:42:26 +0000 (15:42 +0200)
Use new functions from protocol API instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ipalloc_common.c
ctdb/server/ipalloc_nondeterministic.c

index 95d5ecf0c2127d9052e6e624ab80305c89b9150b..1a52ff3772f851e7db55df1d8343222778af8150 100644 (file)
@@ -32,6 +32,8 @@
 #include "common/common.h"
 #include "common/rb_tree.h"
 
+#include "protocol/protocol_api.h"
+
 #include "server/ipalloc_private.h"
 
 #define TAKEOVER_TIMEOUT() timeval_current_ofs(ctdb->tunable.takeover_timeout,0)
@@ -72,7 +74,7 @@ static bool can_node_host_ip(struct ipalloc_state *ipalloc_state,
        public_ips = &ipalloc_state->available_public_ips[pnn];
 
        for (i=0; i<public_ips->num; i++) {
-               if (ctdb_same_ip(&ip->addr, &public_ips->ip[i].addr)) {
+               if (ctdb_sock_addr_same(&ip->addr, &public_ips->ip[i].addr)) {
                        /* yes, this node can serve this public ip */
                        return true;
                }
@@ -125,7 +127,8 @@ int find_takeover_node(struct ipalloc_state *ipalloc_state,
        }
        if (pnn == -1) {
                DEBUG(DEBUG_WARNING,(__location__ " Could not find node to take over public address '%s'\n",
-                       ctdb_addr_to_str(&ip->addr)));
+                                    ctdb_sock_addr_to_string(ipalloc_state,
+                                                             &ip->addr)));
 
                return -1;
        }
@@ -175,7 +178,8 @@ void basic_allocate_unassigned(struct ipalloc_state *ipalloc_state)
                        if (find_takeover_node(ipalloc_state, t)) {
                                DEBUG(DEBUG_WARNING,
                                      ("Failed to find node to cover ip %s\n",
-                                      ctdb_addr_to_str(&t->addr)));
+                                      ctdb_sock_addr_to_string(ipalloc_state,
+                                                               &t->addr)));
                        }
                }
        }
@@ -195,7 +199,8 @@ void unassign_unsuitable_ips(struct ipalloc_state *ipalloc_state)
                if (!can_node_host_ip(ipalloc_state, t->pnn, t) != 0) {
                        /* this node can not serve this ip. */
                        DEBUG(DEBUG_DEBUG,("Unassign IP: %s from %d\n",
-                                          ctdb_addr_to_str(&(t->addr)),
+                                          ctdb_sock_addr_to_string(ipalloc_state,
+                                                                   &t->addr),
                                           t->pnn));
                        t->pnn = -1;
                }
index 9951aaac91c87ffe93e407204ba78c5044e85bd1..bb5f8faf9c85dc17d328764c2b07b0a23dbc1607 100644 (file)
@@ -28,6 +28,8 @@
 #include "common/logging.h"
 #include "common/common.h"
 
+#include "protocol/protocol_api.h"
+
 #include "server/ipalloc_private.h"
 
 /* Basic non-deterministic rebalancing algorithm.
@@ -92,7 +94,8 @@ try_again:
                if (maxnode == -1) {
                        DEBUG(DEBUG_WARNING,
                              (__location__ " Could not find maxnode. May not be able to serve ip '%s'\n",
-                              ctdb_addr_to_str(&t->addr)));
+                              ctdb_sock_addr_to_string(ipalloc_state,
+                                                       &t->addr)));
 
                        continue;
                }