summaryrefslogtreecommitdiffstats
path: root/ctdb/server/ctdb_recover.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2008-10-14 10:40:29 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2008-10-14 10:40:29 +1100
commitcb300382b0524d3cd83b28a38eef0e4154986a8f (patch)
tree386c986090a313ca0275deb7f686b2c8affb4aa7 /ctdb/server/ctdb_recover.c
parente5a3a73e64ff29eca7daeac368db32f7216a1705 (diff)
downloadsamba-cb300382b0524d3cd83b28a38eef0e4154986a8f.tar.gz
samba-cb300382b0524d3cd83b28a38eef0e4154986a8f.tar.xz
samba-cb300382b0524d3cd83b28a38eef0e4154986a8f.zip
update TAKEIP/RELEASEIP/GETPUBLICIP/GETNODEMAP controls so we retain an
older ipv4-only version of these controls. We need this so that we are backwardcompatible with old versions of ctdb and so that we can interoperate with a ipv4-only recmaster during a rolling upgrade. (This used to be ctdb commit 6b76c520f97127099bd9fbaa0fa7af1c61947fb7)
Diffstat (limited to 'ctdb/server/ctdb_recover.c')
-rw-r--r--ctdb/server/ctdb_recover.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index 54276d8a36..8d61704ab7 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -174,6 +174,41 @@ ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA ind
return 0;
}
+/*
+ get an old style ipv4-only nodemap
+*/
+int
+ctdb_control_getnodemapv4(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata)
+{
+ uint32_t i, num_nodes;
+ struct ctdb_node_mapv4 *node_map;
+
+ CHECK_CONTROL_DATA_SIZE(0);
+
+ num_nodes = ctdb->num_nodes;
+
+ outdata->dsize = offsetof(struct ctdb_node_mapv4, nodes) + num_nodes*sizeof(struct ctdb_node_and_flagsv4);
+ outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
+ if (!outdata->dptr) {
+ DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate nodemap array\n"));
+ exit(1);
+ }
+
+ node_map = (struct ctdb_node_mapv4 *)outdata->dptr;
+ node_map->num = num_nodes;
+ for (i=0; i<num_nodes; i++) {
+ if (parse_ipv4(ctdb->nodes[i]->address.address, 0, &node_map->nodes[i].sin) == 0) {
+ DEBUG(DEBUG_ERR, (__location__ " Failed to parse %s into a sockaddr\n", ctdb->nodes[i]->address.address));
+ return -1;
+ }
+
+ node_map->nodes[i].pnn = ctdb->nodes[i]->pnn;
+ node_map->nodes[i].flags = ctdb->nodes[i]->flags;
+ }
+
+ return 0;
+}
+
static void
ctdb_reload_nodes_event(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private_data)