[SCM] CTDB repository - branch master updated -
ctdb-1.0.59-4-g8e912ab
Ronnie Sahlberg
sahlberg at samba.org
Tue Oct 14 13:26:05 GMT 2008
The branch, master has been updated
via 8e912abc2c68f5fe7b06c600ba6fec1a6900127c (commit)
from 6b76c520f97127099bd9fbaa0fa7af1c61947fb7 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8e912abc2c68f5fe7b06c600ba6fec1a6900127c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Oct 15 00:24:44 2008 +1100
update the client side of getnodemap and getpublicips controls to
fallback to the old-style ipv4-only controls if the new-style ipv4/ipv6
control fails.
this allows a 1.0.59+ (ipv4/ipv6) ctdb daemon being recmaster to be
compatible with
pre-1.0.59 versions of ctdb that are ipv4 only.
-----------------------------------------------------------------------
Summary of changes:
client/ctdb_client.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++--
include/ctdb.h | 4 +++
2 files changed, 55 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index a4d2a2b..4018300 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -1221,7 +1221,7 @@ int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout, uint32
CTDB_CONTROL_GET_DBMAP, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed ret:%d res:%d\n", ret, res));
return -1;
}
@@ -1245,8 +1245,12 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
ret = ctdb_control(ctdb, destnode, 0,
CTDB_CONTROL_GET_NODEMAP, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
+ if (ret == 0 && res == -1 && outdata.dsize == 0) {
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed, falling back to ipv4-only control\n"));
+ return ctdb_ctrl_getnodemapv4(ctdb, timeout, destnode, mem_ctx, nodemap);
+ }
if (ret != 0 || res != 0 || outdata.dsize == 0) {
- DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed ret:%d res:%d\n", ret, res));
return -1;
}
@@ -1257,6 +1261,45 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
}
/*
+ old style ipv4-only get a list of nodes (vnn and flags ) from a remote node
+ */
+int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb,
+ struct timeval timeout, uint32_t destnode,
+ TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap)
+{
+ int ret, i, len;
+ TDB_DATA outdata;
+ struct ctdb_node_mapv4 *nodemapv4;
+ int32_t res;
+
+ ret = ctdb_control(ctdb, destnode, 0,
+ CTDB_CONTROL_GET_NODEMAPv4, 0, tdb_null,
+ mem_ctx, &outdata, &res, &timeout, NULL);
+ if (ret != 0 || res != 0 || outdata.dsize == 0) {
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodesv4 failed ret:%d res:%d\n", ret, res));
+ return -1;
+ }
+
+ nodemapv4 = (struct ctdb_node_mapv4 *)outdata.dptr;
+
+ len = offsetof(struct ctdb_node_map, nodes) + nodemapv4->num*sizeof(struct ctdb_node_and_flags);
+ (*nodemap) = talloc_zero_size(mem_ctx, len);
+ CTDB_NO_MEMORY(ctdb, (*nodemap));
+
+ (*nodemap)->num = nodemapv4->num;
+ for (i=0; i<nodemapv4->num; i++) {
+ (*nodemap)->nodes[i].pnn = nodemapv4->nodes[i].pnn;
+ (*nodemap)->nodes[i].flags = nodemapv4->nodes[i].flags;
+ (*nodemap)->nodes[i].addr.ip = nodemapv4->nodes[i].sin;
+ (*nodemap)->nodes[i].addr.sa.sa_family = AF_INET;
+ }
+
+ talloc_free(outdata.dptr);
+
+ return 0;
+}
+
+/*
drop the transport, reload the nodes file and restart the transport
*/
int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb,
@@ -2254,8 +2297,12 @@ int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
ret = ctdb_control(ctdb, destnode, 0,
CTDB_CONTROL_GET_PUBLIC_IPS, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
+ if (ret == 0 && res == -1) {
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control to get public ips failed, falling back to ipv4-only version\n"));
+ return ctdb_ctrl_get_public_ipsv4(ctdb, timeout, destnode, mem_ctx, ips);
+ }
if (ret != 0 || res != 0) {
- DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed ret:%d res:%d\n", ret, res));
return -1;
}
@@ -2286,6 +2333,7 @@ int ctdb_ctrl_get_public_ipsv4(struct ctdb_context *ctdb,
len = offsetof(struct ctdb_all_public_ips, ips) +
ipsv4->num*sizeof(struct ctdb_public_ip);
*ips = talloc_zero_size(mem_ctx, len);
+ (*ips)->num = ipsv4->num;
for (i=0; i<ipsv4->num; i++) {
(*ips)->ips[i].pnn = ipsv4->ips[i].pnn;
(*ips)->ips[i].addr.ip = ipsv4->ips[i].sin;
diff --git a/include/ctdb.h b/include/ctdb.h
index 60fa60b..fd5af20 100644
--- a/include/ctdb.h
+++ b/include/ctdb.h
@@ -303,6 +303,10 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
+int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb,
+ struct timeval timeout, uint32_t destnode,
+ TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
+
int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode);
--
CTDB repository
More information about the samba-cvs
mailing list