ctdb-ipalloc: Rename ctdb_takeover_run_core() to ipalloc()
authorMartin Schwenke <martin@meltin.net>
Fri, 6 Nov 2015 05:25:32 +0000 (16:25 +1100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 4 Dec 2015 08:17:17 +0000 (09:17 +0100)
It just does IP allocation...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_takeover.c
ctdb/tests/eventscripts/stubs/ctdb
ctdb/tests/src/ctdb_takeover_tests.c
ctdb/tests/takeover/scripts/local.sh
ctdb/tests/takeover/simulation/ctdb_takeover.py

index 942dcf7b1e61cab80e7aa24dcc7b5f88ff29d98b..db10975b7d5cbcb728837882f1438ebfcebfc179 100644 (file)
@@ -2206,7 +2206,7 @@ static bool all_nodes_are_disabled(struct ctdb_node_map_old *nodemap)
 }
 
 /* The calculation part of the IP allocation algorithm. */
-static bool ctdb_takeover_run_core(struct ipalloc_state *ipalloc_state)
+static bool ipalloc(struct ipalloc_state *ipalloc_state)
 {
        bool ret;
 
@@ -2653,7 +2653,7 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodem
        ipalloc_state->force_rebalance_nodes = force_rebalance_nodes;
 
        /* Do the IP reassignment calculations */
-       ctdb_takeover_run_core(ipalloc_state);
+       ipalloc(ipalloc_state);
 
        /* Now tell all nodes to release any public IPs should not
         * host.  This will be a NOOP on nodes that don't currently
index aa3ac730ddf8039fe38460725007c6946934db44..021353d3dbfb87736717ba2bc6f9e9e5451754a9 100755 (executable)
@@ -135,7 +135,7 @@ ip_reallocate ()
        done
        CTDB_TEST_LOGLEVEL=2 \
            "ctdb_takeover_tests" \
-           "ctdb_takeover_run_core" "$_flags" <"$FAKE_CTDB_IP_LAYOUT" |
+           "ipalloc" "$_flags" <"$FAKE_CTDB_IP_LAYOUT" |
            sort >"$_t"
        mv "$_t" "$FAKE_CTDB_IP_LAYOUT"
     ) <"$FAKE_CTDB_IP_LAYOUT"
index 49ef2e823f11097602a306c14503ae3b49c644d7..6797de467fd205fda0b4ad11f0bf2a9ea9864869 100644 (file)
@@ -423,7 +423,7 @@ static enum ctdb_runstate *get_runstate(TALLOC_CTX *tmp_ctx,
  * by a blank line.  This mode is for testing weird behaviours where
  * the IP layouts differs across nodes and we want to improve
  * create_merged_ip_list(), so should only be used in tests of
- * ctdb_takeover_run_core().  Yes, it is a hack...  :-)
+ * ipalloc().  Yes, it is a hack...  :-)
  */
 static void ctdb_test_init(const char nodestates[],
                           struct ctdb_context **ctdb,
@@ -589,8 +589,8 @@ static void ctdb_test_lcp2_failback_loop(const char nodestates[])
 /* IP layout is read from stdin.  See comment for ctdb_test_init() for
  * explanation of read_ips_for_multiple_nodes.
  */
-static void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
-                                            bool read_ips_for_multiple_nodes)
+static void ctdb_test_ipalloc(const char nodestates[],
+                             bool read_ips_for_multiple_nodes)
 {
        struct ctdb_context *ctdb;
        struct ipalloc_state *ipalloc_state;
@@ -598,7 +598,7 @@ static void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
        ctdb_test_init(nodestates, &ctdb, &ipalloc_state,
                       read_ips_for_multiple_nodes);
 
-       ctdb_takeover_run_core(ipalloc_state);
+       ipalloc(ipalloc_state);
 
        print_ctdb_public_ip_list(ipalloc_state->all_ips);
 
@@ -639,12 +639,12 @@ int main(int argc, const char *argv[])
        } else if (argc == 3 && strcmp(argv[1], "lcp2_failback_loop") == 0) {
                ctdb_test_lcp2_failback_loop(argv[2]);
        } else if (argc == 3 &&
-                  strcmp(argv[1], "ctdb_takeover_run_core") == 0) {
-               ctdb_test_ctdb_takeover_run_core(argv[2], false);
+                  strcmp(argv[1], "ipalloc") == 0) {
+               ctdb_test_ipalloc(argv[2], false);
        } else if (argc == 4 &&
-                  strcmp(argv[1], "ctdb_takeover_run_core") == 0 &&
+                  strcmp(argv[1], "ipalloc") == 0 &&
                   strcmp(argv[3], "multi") == 0) {
-               ctdb_test_ctdb_takeover_run_core(argv[2], true);
+               ctdb_test_ipalloc(argv[2], true);
        } else {
                usage();
        }
index a84f58bcbf1cb33f0730a120f30dd0eaddfe60c9..60375f07688e3a97f2c8409ff3129c32a2608096 100644 (file)
@@ -1,6 +1,6 @@
 # Hey Emacs, this is a -*- shell-script -*- !!!  :-)
 
-test_prog="ctdb_takeover_tests ctdb_takeover_run_core"
+test_prog="ctdb_takeover_tests ipalloc"
 
 define_test ()
 {
index 4b7ceef468260eb6b5be64166b54a37e5b94c79a..1aeeaca67e88ed52a79a30611d2ba98c9d9c17eb 100755 (executable)
@@ -761,7 +761,7 @@ class Cluster(object):
         # Written while asleep...
 
         # Convert the cluster state to something that be fed to
-        # ctdb_takeover_tests ctdb_takeover_run_core ...
+        # ctdb_takeover_tests ipalloc ...
 
         in_lines = []
         for ip in sorted(list(self.all_public_ips)):
@@ -786,7 +786,7 @@ class Cluster(object):
         else:
             os.environ["CTDB_TEST_LOGLEVEL"] = "0"
 
-        p = subprocess.Popen("../../bin/ctdb_takeover_tests ctdb_takeover_run_core %s 2>&1" % nodestates,
+        p = subprocess.Popen("../../bin/ctdb_takeover_tests ipalloc %s 2>&1" % nodestates,
                              shell=True,
                              stdin=subprocess.PIPE, stdout=subprocess.PIPE)
         p.stdin.write("\n".join(in_lines))