From 6504900f1f52927adab3489b8d04b6644ceaee7d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 08:06:51 +0000 Subject: r23806: update Samba4 with the latest ctdb code. This doesn't get the ctdb code fully working in Samba4, it just gets it building and not breaking non-clustered use of Samba. It will take a bit longer to update some of the calling ctdb_cluster.c code to make it work correctly in Samba4. Note also that Samba4 now only links to the client portion of ctdb. For the moment I am leaving the ctdbd as a separate daemon, which you install separately from http://ctdb.samba.org/. (This used to be commit b196077cbb55cbecad87065133c2d67198e31066) --- source4/cluster/ctdb/ctdb_cluster.c | 75 ++----------------------------------- 1 file changed, 3 insertions(+), 72 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index caade047d5..b7aa52a7eb 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -112,7 +112,7 @@ struct ctdb_handler_state { /* dispatch incoming ctdb messages */ -static void ctdb_message_handler(struct ctdb_context *ctdb, uint32_t srvid, +static void ctdb_message_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA data, void *private) { struct ctdb_handler_state *s = talloc_get_type(private, @@ -196,22 +196,10 @@ static struct cluster_ops cluster_ctdb_ops = { /* initialise ctdb */ void cluster_ctdb_init(struct event_context *ev, const char *model) { - const char *nlist; - const char *address; - const char *transport; struct cluster_state *state; - int ret, lacount, i; - const char *db_list[] = { "brlock", "opendb" }; - nlist = lp_parm_string(-1, "ctdb", "nlist"); - if (nlist == NULL) return; - - address = lp_parm_string(-1, "ctdb", "address"); - if (address == NULL) return; - - transport = lp_parm_string(-1, "ctdb", "transport"); - if (transport == NULL) { - transport = "tcp"; + if (!lp_parm_bool(-1, "ctdb", "enable", False)) { + return; } state = talloc(ev, struct cluster_state); @@ -224,51 +212,6 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) cluster_ctdb_ops.private = state; - ret = ctdb_set_transport(state->ctdb, transport); - if (ret == -1) { - DEBUG(0,("ctdb_set_transport failed - %s\n", - ctdb_errstr(state->ctdb))); - goto failed; - } - - if (lp_parm_bool(-1, "ctdb", "selfconnect", False)) { - DEBUG(0,("Enabling ctdb selfconnect\n")); - ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT); - } - - lacount = lp_parm_int(-1, "ctdb", "maxlacount", -1); - if (lacount != -1) { - ctdb_set_max_lacount(state->ctdb, lacount); - } - - /* tell ctdb what address to listen on */ - ret = ctdb_set_address(state->ctdb, address); - if (ret == -1) { - DEBUG(0,("ctdb_set_address failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; - } - - ret = ctdb_set_tdb_dir(state->ctdb, lp_lockdir()); - if (ret == -1) { - DEBUG(0,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; - } - - /* tell ctdb what nodes are available */ - ret = ctdb_set_nlist(state->ctdb, nlist); - if (ret == -1) { - DEBUG(0,("ctdb_set_nlist failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; - } - - /* attach all the databases we will need */ - for (i=0;ictdb, db_list[i], TDB_INTERNAL, - O_RDWR|O_CREAT|O_TRUNC, 0666); - if (ctdb_db == NULL) goto failed; - } - cluster_set_ops(&cluster_ctdb_ops); /* nasty hack for now ... */ @@ -277,21 +220,9 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) brl_ctdb_init_ops(); } - /* start the protocol running */ - ret = ctdb_start(state->ctdb); - if (ret == -1) { - DEBUG(0,("ctdb_start failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; - } - - /* wait until all nodes are connected (should not be needed - outside of test code) */ - ctdb_connect_wait(state->ctdb); - return; failed: DEBUG(0,("cluster_ctdb_init failed\n")); talloc_free(state); } - -- cgit