[SCM] CTDB repository - branch 1.13 updated - ctdb-1.13-70-g0489d75

Ronnie Sahlberg sahlberg at samba.org
Mon Apr 2 22:26:06 MDT 2012


The branch, 1.13 has been updated
       via  0489d75a27b63f3f2e69f18400498e667995738a (commit)
       via  2899dd5d400bbfcaddc2b8a0e9a405dca979f6d0 (commit)
      from  aaec46211b72f7d6886832301eee169d4b6a5f80 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.13


- Log -----------------------------------------------------------------
commit 0489d75a27b63f3f2e69f18400498e667995738a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Apr 3 13:45:22 2012 +1000

    New version 1.41

commit 2899dd5d400bbfcaddc2b8a0e9a405dca979f6d0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Apr 3 13:43:21 2012 +1000

    CTDB: add back the "rebalanceip" command

-----------------------------------------------------------------------

Summary of changes:
 packaging/RPM/ctdb.spec.in |    2 +
 tools/ctdb.c               |   75 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index f9a5cef..8db59d2 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -145,6 +145,8 @@ development libraries for ctdb
 %{_libdir}/libctdb.a
 
 %changelog
+* Tue Apr 3 2012 : Version 1.41
+ - add back the rebalanceip command
 * Thu Mar 1 2012 : Version 1.13
  - This is the new stable branch for modern features for ctdb.
    Main new features are performance/scaling improvements for
diff --git a/tools/ctdb.c b/tools/ctdb.c
index d482eab..a56d579 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -1619,6 +1619,80 @@ static int control_rebalancenode(struct ctdb_context *ctdb, int argc, const char
 }
 
 
+static int rebalance_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr)
+{
+	struct ctdb_public_ip ip;
+	int ret;
+	uint32_t *nodes;
+	uint32_t disable_time;
+	TDB_DATA data;
+	struct ctdb_node_map *nodemap=NULL;
+	TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+
+	disable_time = 30;
+	data.dptr  = (uint8_t*)&disable_time;
+	data.dsize = sizeof(disable_time);
+	ret = ctdb_client_send_message(ctdb, CTDB_BROADCAST_CONNECTED, CTDB_SRVID_DISABLE_IP_CHECK, data);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,("Failed to send message to disable ipcheck\n"));
+		return -1;
+	}
+
+	ip.pnn  = -1;
+	ip.addr = *addr;
+
+	data.dptr  = (uint8_t *)&ip;
+	data.dsize = sizeof(ip);
+
+	ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, tmp_ctx, &nodemap);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR, ("Unable to get nodemap from node %u\n", options.pnn));
+		talloc_free(tmp_ctx);
+		return ret;
+	}
+
+       	nodes = list_of_active_nodes(ctdb, nodemap, tmp_ctx, true);
+	ret = ctdb_client_async_control(ctdb, CTDB_CONTROL_RELEASE_IP,
+					nodes, 0,
+					LONGTIMELIMIT(),
+					false, data,
+					NULL, NULL,
+					NULL);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,("Failed to release IP on nodes\n"));
+		talloc_free(tmp_ctx);
+		return -1;
+	}
+
+	talloc_free(tmp_ctx);
+	return 0;
+}
+
+/*
+  release an ip form all nodes and have it re-assigned by recd
+ */
+static int control_rebalanceip(struct ctdb_context *ctdb, int argc, const char **argv)
+{
+	ctdb_sock_addr addr;
+
+	if (argc < 1) {
+		usage();
+		return -1;
+	}
+
+	if (parse_ip(argv[0], NULL, 0, &addr) == 0) {
+		DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
+		return -1;
+	}
+
+	if (rebalance_ip(ctdb, &addr) != 0) {
+		DEBUG(DEBUG_ERR,("Error when trying to reassign ip\n"));
+		return -1;
+	}
+
+	return 0;
+}
+
 static int getips_store_callback(void *param, void *data)
 {
 	struct ctdb_public_ip *node_ip = (struct ctdb_public_ip *)data;
@@ -5582,6 +5656,7 @@ static const struct {
 	{ "listnodes",       control_listnodes,		false,	true, "list all nodes in the cluster"},
 	{ "reloadnodes",     control_reload_nodes_file,	false,	false, "reload the nodes file and restart the transport on all nodes"},
 	{ "moveip",          control_moveip,		false,	false, "move/failover an ip address to another node", "<ip> <node>"},
+	{ "rebalanceip",     control_rebalanceip,	false,	false, "release an ip from the node and let recd rebalance it", "<ip>"},
 	{ "addip",           control_addip,		true,	false, "add a ip address to a node", "<ip/mask> <iface>"},
 	{ "delip",           control_delip,		false,	false, "delete an ip address from a node", "<ip>"},
 	{ "eventscript",     control_eventscript,	true,	false, "run the eventscript with the given parameters on a node", "<arguments>"},


-- 
CTDB repository


More information about the samba-cvs mailing list