[SCM] CTDB repository - branch master updated -
ctdb-1.0.84-8-g2a52336
Ronnie Sahlberg
sahlberg at samba.org
Tue Jun 9 00:59:59 GMT 2009
The branch, master has been updated
via 2a52336ec021dfe8d56ba72726feb7b2dbd41f68 (commit)
via d350c631850377c09968d2978ef57d2bd0d50116 (commit)
via 0ca28d7336463ecd2ff65620d8dbcbb496991531 (commit)
via 6318ea13464e2fe630084c40802d8e697c2cb999 (commit)
via 4d5d22e64270cfb31be6acd71f4f97ec43df5b2c (commit)
from 7eb137aa4c24c69bd93b98fb3c7108e5f3288ebd (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 2a52336ec021dfe8d56ba72726feb7b2dbd41f68
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Jun 9 10:58:46 2009 +1000
remove unused variable
commit d350c631850377c09968d2978ef57d2bd0d50116
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Jun 9 10:57:46 2009 +1000
dont require particular values for NoIPFailback and DeterministicIPs when
using ctdb moveip
commit 0ca28d7336463ecd2ff65620d8dbcbb496991531
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Jun 9 10:56:50 2009 +1000
improve ctdb moveip so that it does not always trigger a recovery.
commit 6318ea13464e2fe630084c40802d8e697c2cb999
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 5 17:57:14 2009 +1000
try avoiding to cause a recovery when deleting a public ip from a node
commit 4d5d22e64270cfb31be6acd71f4f97ec43df5b2c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 5 17:00:47 2009 +1000
when adding an ip, try manually adding and takingover the ip instead of triggering a full recovery to do the same thing
-----------------------------------------------------------------------
Summary of changes:
server/ctdb_takeover.c | 11 +++-
tools/ctdb.c | 138 ++++++++++++++++++++++++------------------------
2 files changed, 78 insertions(+), 71 deletions(-)
Changeset truncated at 500 lines:
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 21f7dc8..5cd711d 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -2021,7 +2021,7 @@ int32_t ctdb_control_send_gratious_arp(struct ctdb_context *ctdb, TDB_DATA indat
int32_t ctdb_control_add_public_address(struct ctdb_context *ctdb, TDB_DATA indata)
{
struct ctdb_control_ip_iface *pub = (struct ctdb_control_ip_iface *)indata.dptr;
-
+ int ret;
/* verify the size of indata */
if (indata.dsize < offsetof(struct ctdb_control_ip_iface, iface)) {
@@ -2039,7 +2039,14 @@ int32_t ctdb_control_add_public_address(struct ctdb_context *ctdb, TDB_DATA inda
return -1;
}
- return ctdb_add_public_address(ctdb, &pub->addr, pub->mask, &pub->iface[0]);
+ ret = ctdb_add_public_address(ctdb, &pub->addr, pub->mask, &pub->iface[0]);
+
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,(__location__ " Failed to add public address\n"));
+ return -1;
+ }
+
+ return 0;
}
/*
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 52eed0a..589533b 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -791,39 +791,6 @@ static int control_get_tickles(struct ctdb_context *ctdb, int argc, const char *
return 0;
}
-/* send a release ip to all nodes */
-static int control_send_release(struct ctdb_context *ctdb, uint32_t pnn,
-ctdb_sock_addr *addr)
-{
- int ret;
- struct ctdb_public_ip pip;
- TDB_DATA data;
- struct ctdb_node_map *nodemap=NULL;
-
- ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap);
- if (ret != 0) {
- DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
- return ret;
- }
-
- /* send a moveip message to the recovery master */
- pip.pnn = pnn;
- pip.addr = *addr;
- data.dsize = sizeof(pip);
- data.dptr = (unsigned char *)&pip;
-
-
- /* send release ip to all nodes */
- if (ctdb_client_async_control(ctdb, CTDB_CONTROL_RELEASE_IP,
- list_of_active_nodes(ctdb, nodemap, ctdb, true),
- TIMELIMIT(), false, data,
- NULL, NULL, NULL) != 0) {
- DEBUG(DEBUG_ERR, (__location__ " Unable to send 'ReleaseIP' to all nodes.\n"));
- return -1;
- }
-
- return 0;
-}
/*
move/failover an ip address to a specific node
@@ -832,49 +799,39 @@ static int control_moveip(struct ctdb_context *ctdb, int argc, const char **argv
{
uint32_t pnn;
ctdb_sock_addr addr;
- uint32_t value;
struct ctdb_all_public_ips *ips;
+ struct ctdb_public_ip ip;
+ uint32_t *nodes;
int i, ret;
+ TDB_DATA data;
+ struct ctdb_node_map *nodemap=NULL;
+ TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
if (argc < 2) {
usage();
+ talloc_free(tmp_ctx);
+ return -1;
}
if (parse_ip(argv[0], NULL, 0, &addr) == 0) {
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
+ talloc_free(tmp_ctx);
return -1;
}
if (sscanf(argv[1], "%u", &pnn) != 1) {
DEBUG(DEBUG_ERR, ("Badly formed pnn\n"));
+ talloc_free(tmp_ctx);
return -1;
}
- ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, "DeterministicIPs", &value);
- if (ret == -1) {
- DEBUG(DEBUG_ERR, ("Unable to get tunable variable 'DeterministicIPs' from local node\n"));
- return -1;
- }
- if (value != 0) {
- DEBUG(DEBUG_ERR, ("The tunable 'DeterministicIPs' is set. You can only move ip addresses when this feature is disabled\n"));
- return -1;
- }
-
- ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, "NoIPFailback", &value);
- if (ret == -1) {
- DEBUG(DEBUG_ERR, ("Unable to get tunable variable 'NoIPFailback' from local node\n"));
- return -1;
- }
- if (value == 0) {
- DEBUG(DEBUG_ERR, ("The tunable 'NoIPFailback' is NOT set. You can only move ip addresses when this feature is enabled\n"));
- return -1;
- }
/* read the public ip list from the node */
ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), pnn, ctdb, &ips);
if (ret != 0) {
DEBUG(DEBUG_ERR, ("Unable to get public ip list from node %u\n", pnn));
+ talloc_free(tmp_ctx);
return -1;
}
@@ -886,20 +843,49 @@ static int control_moveip(struct ctdb_context *ctdb, int argc, const char **argv
if (i==ips->num) {
DEBUG(DEBUG_ERR, ("Node %u can not host ip address '%s'\n",
pnn, ctdb_addr_to_str(&addr)));
+ talloc_free(tmp_ctx);
return -1;
}
if (ips->ips[i].pnn == pnn) {
DEBUG(DEBUG_ERR, ("Host %u is already hosting '%s'\n",
pnn, ctdb_addr_to_str(&ips->ips[i].addr)));
+ talloc_free(tmp_ctx);
+ return -1;
+ }
+
+ ip.pnn = pnn;
+ 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, TIMELIMIT(),
+ false, data,
+ NULL, NULL,
+ NULL);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,("Failed to release IP on nodes\n"));
+ talloc_free(tmp_ctx);
return -1;
}
- ret = control_send_release(ctdb, pnn, &ips->ips[i].addr);
+ ret = ctdb_ctrl_takeover_ip(ctdb, TIMELIMIT(), pnn, &ip);
if (ret != 0) {
- DEBUG(DEBUG_ERR, ("Failed to send 'change ip' to all nodes\n"));;
+ DEBUG(DEBUG_ERR,("Failed to take over IP on node %d\n", pnn));
+ talloc_free(tmp_ctx);
return -1;
}
+ talloc_free(tmp_ctx);
return 0;
}
@@ -1092,6 +1078,15 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
}
+ /* check if some other node is already serving this ip, if not,
+ * we will claim it
+ */
+ for (i=0;i<ips->num;i++) {
+ if (ctdb_same_ip(&addr, &ips->ips[i].addr)) {
+ break;
+ }
+ }
+
len = offsetof(struct ctdb_control_ip_iface, iface) + strlen(argv[1]) + 1;
pub = talloc_size(tmp_ctx, len);
CTDB_NO_MEMORY(ctdb, pub);
@@ -1108,22 +1103,21 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
return ret;
}
-
- /* check if some other node is already serving this ip, if not,
- * we will claim it
- */
- for (i=0;i<ips->num;i++) {
- if (ctdb_same_ip(&addr, &ips->ips[i].addr)) {
- break;
- }
- }
/* no one has this ip so we claim it */
if (i == ips->num) {
- ret = control_send_release(ctdb, options.pnn, &addr);
- } else {
- ret = control_send_release(ctdb, ips->ips[i].pnn, &addr);
+ struct ctdb_public_ip ip;
+
+ ip.pnn = options.pnn;
+ ip.addr = addr;
+
+ ret = ctdb_ctrl_takeover_ip(ctdb, TIMELIMIT(), options.pnn, &ip);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,("Failed to take over IP on node %d\n", options.pnn));
+ return -1;
+ }
}
+
if (ret != 0) {
DEBUG(DEBUG_ERR, ("Failed to send 'change ip' to all nodes\n"));
return -1;
@@ -1255,9 +1249,15 @@ static int control_delip(struct ctdb_context *ctdb, int argc, const char **argv)
if (ips->ips[i].pnn == options.pnn) {
ret = find_other_host_for_public_ip(ctdb, &addr);
if (ret != -1) {
- ret = control_send_release(ctdb, ret, &addr);
+ struct ctdb_public_ip ip;
+
+ ip.pnn = ret;
+ ip.addr = addr;
+
+ ret = ctdb_ctrl_takeover_ip(ctdb, TIMELIMIT(), ret, &ip);
if (ret != 0) {
- DEBUG(DEBUG_ERR, ("Failed to migrate this ip to another node. Use moveip of recover to reassign this address to a node\n"));
+ DEBUG(DEBUG_ERR,("Failed to take over IP on node %d\n", options.pnn));
+ return -1;
}
}
}
--
CTDB repository
More information about the samba-cvs
mailing list