From 1b45c46d6830f50bfdbd72e4afc65a5c6fd500a0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 12:10:54 +0200 Subject: [PATCH 1/9] wafsamba: add CONFIG_RESET() Signed-off-by: Stefan Metzmacher --- buildtools/wafsamba/samba_autoconf.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index fe110bd7..e569b7f 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -495,6 +495,14 @@ def CONFIG_SET(conf, option): if v == (): return False return True + +@conf +def CONFIG_RESET(conf, option): + if option not in conf.env: + return + del conf.env[option] + +Build.BuildContext.CONFIG_RESET = CONFIG_RESET Build.BuildContext.CONFIG_SET = CONFIG_SET Build.BuildContext.CONFIG_GET = CONFIG_GET -- 1.7.9.5 From 2a82207bf0612584713d4e44f6681bac0ae521ac Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 13:33:49 +0200 Subject: [PATCH 2/9] s3:param: move lp_ctdbd_socket() to ctdbd_conn.c This allows us to use CTDB_PATH only in ctdbd_conn.c Signed-off-by: Stefan Metzmacher --- lib/param/param_functions.c | 2 +- source3/include/ctdbd_conn.h | 1 + source3/include/proto.h | 3 +-- source3/lib/ctdbd_conn.c | 12 ++++++++++++ source3/lib/dbwrap/dbwrap_open.c | 4 +--- source3/lib/msg_channel.c | 1 + source3/param/loadparm.c | 11 +---------- source3/torture/test_ctdbconn.c | 1 + 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/param/param_functions.c b/lib/param/param_functions.c index 61f0044..bf40869 100644 --- a/lib/param/param_functions.c +++ b/lib/param/param_functions.c @@ -233,7 +233,7 @@ FN_GLOBAL_BOOL(winbind_use_default_domain, bWinbindUseDefaultDomain) FN_GLOBAL_BOOL(wins_dns_proxy, bWINSdnsProxy) FN_GLOBAL_BOOL(wins_proxy, bWINSproxy) FN_GLOBAL_CONST_STRING(afs_username_map, szAfsUsernameMap) -FN_GLOBAL_CONST_STRING(ctdbd_socket, ctdbdSocket) +FN_GLOBAL_CONST_STRING(_ctdbd_socket, ctdbdSocket) FN_GLOBAL_CONST_STRING(dedicated_keytab_file, szDedicatedKeytabFile) FN_GLOBAL_CONST_STRING(dnsdomain, szRealm_lower) FN_GLOBAL_CONST_STRING(dns_forwarder, dns_forwarder) diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h index 64cb1d5..d19fe65 100644 --- a/source3/include/ctdbd_conn.h +++ b/source3/include/ctdbd_conn.h @@ -30,6 +30,7 @@ NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx, struct ctdbd_connection **pconn); uint32_t ctdbd_vnn(const struct ctdbd_connection *conn); +const char *lp_ctdbd_socket(void); NTSTATUS ctdbd_register_msg_ctx(struct ctdbd_connection *conn, struct messaging_context *msg_ctx); diff --git a/source3/include/proto.h b/source3/include/proto.h index 023fbd0..a982e1e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1227,8 +1227,7 @@ char *lp_cups_server(TALLOC_CTX *ctx); int lp_cups_encrypt(void); char *lp_iprint_server(TALLOC_CTX *ctx); int lp_cups_connection_timeout(void); -const char *lp_ctdbd_socket(void); -const char *_lp_ctdbd_socket(void); +const char *lp__ctdbd_socket(void); const char **lp_cluster_addresses(void); bool lp_clustering(void); int lp_ctdb_timeout(void); diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index f960541..d8c9551 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -192,6 +192,18 @@ uint32_t ctdbd_vnn(const struct ctdbd_connection *conn) return conn->our_vnn; } +const char *lp_ctdbd_socket(void) +{ + const char *ret; + + ret = lp__ctdbd_socket(); + if (ret != NULL) { + return ret; + } + + return CTDB_PATH; +} + /* * Get us a ctdb connection */ diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c index 515b4bf..c6e8338 100644 --- a/source3/lib/dbwrap/dbwrap_open.c +++ b/source3/lib/dbwrap/dbwrap_open.c @@ -26,9 +26,7 @@ #include "dbwrap/dbwrap_ctdb.h" #include "lib/param/param.h" #include "util_tdb.h" -#ifdef CLUSTER_SUPPORT -#include "ctdb_private.h" -#endif +#include "ctdbd_conn.h" bool db_is_local(const char *name) { diff --git a/source3/lib/msg_channel.c b/source3/lib/msg_channel.c index 537b162..af69354 100644 --- a/source3/lib/msg_channel.c +++ b/source3/lib/msg_channel.c @@ -20,6 +20,7 @@ #include "includes.h" #include "msg_channel.h" #include "ctdb_conn.h" +#include "ctdbd_conn.h" #include "lib/util/tevent_unix.h" struct msg_channel { diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index e702420..8169153 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -77,10 +77,6 @@ #include #endif -#ifdef CLUSTER_SUPPORT -#include "ctdb_private.h" -#endif - bool bLoaded = false; extern userdom_struct current_user_info; @@ -963,12 +959,7 @@ static void init_globals(bool reinit_globals) string_set(&Globals.szCupsServer, ""); string_set(&Globals.szIPrintServer, ""); -#ifdef CLUSTER_SUPPORT - string_set(&Globals.ctdbdSocket, CTDB_PATH); -#else - string_set(&Globals.ctdbdSocket, ""); -#endif - + Globals.ctdbdSocket = NULL; Globals.szClusterAddresses = NULL; Globals.clustering = false; Globals.ctdb_timeout = 0; diff --git a/source3/torture/test_ctdbconn.c b/source3/torture/test_ctdbconn.c index 149f06d..4d15e59 100644 --- a/source3/torture/test_ctdbconn.c +++ b/source3/torture/test_ctdbconn.c @@ -23,6 +23,7 @@ #ifdef CLUSTER_SUPPORT #include "ctdb_conn.h" +#include "ctdbd_conn.h" #include "lib/util/tevent_unix.h" #include "tdb.h" -- 1.7.9.5 From 4d8223e93a0c6e97f2a888dbba6a2223c39ff6ff Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 13:35:41 +0200 Subject: [PATCH 3/9] s3:ctdb_conn: only use ctdb_protocol.h or ctdb_private.h in ctdb_conn.c We don't need them in ctdb_conn.h. Signed-off-by: Stefan Metzmacher --- source3/lib/ctdb_conn.c | 8 ++++++++ source3/lib/ctdb_conn.h | 17 +---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/source3/lib/ctdb_conn.c b/source3/lib/ctdb_conn.c index 90930eb..b3105e8 100644 --- a/source3/lib/ctdb_conn.c +++ b/source3/lib/ctdb_conn.c @@ -23,6 +23,14 @@ #ifdef CLUSTER_SUPPORT +#include + +#ifdef HAVE_CTDB_PROTOCOL_H +#include +#else +#include +#endif + #include "lib/async_req/async_sock.h" struct ctdb_conn { diff --git a/source3/lib/ctdb_conn.h b/source3/lib/ctdb_conn.h index 0d648c7..21a69c7 100644 --- a/source3/lib/ctdb_conn.h +++ b/source3/lib/ctdb_conn.h @@ -20,26 +20,11 @@ #ifndef _CTDB_CONN_H #define _CTDB_CONN_H -#ifdef CLUSTER_SUPPORT - -#include - -#ifdef HAVE_CTDB_PROTOCOL_H -#include -#else -#include -#endif - -#else /* CLUSTER_SUPPORT */ - -struct ctdb_reply_control; - -#endif /* CLUSTER_SUPPORT */ - #include "tevent.h" #include "librpc/gen_ndr/messaging.h" struct ctdb_conn; +struct ctdb_reply_control; struct tevent_req *ctdb_conn_control_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, -- 1.7.9.5 From 73a112c63dca76072a80027efd4250187e640f3d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 15:30:16 +0200 Subject: [PATCH 4/9] s3:ctdbd_conn: add ctdb_serverids_exist_supported() Signed-off-by: Stefan Metzmacher --- source3/include/ctdbd_conn.h | 1 + source3/lib/ctdbd_conn.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h index d19fe65..5cf8d1f 100644 --- a/source3/include/ctdbd_conn.h +++ b/source3/include/ctdbd_conn.h @@ -50,6 +50,7 @@ bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn, bool ctdb_processes_exist(struct ctdbd_connection *conn, const struct server_id *pids, int num_pids, bool *results); +bool ctdb_serverids_exist_supported(struct ctdbd_connection *conn); bool ctdb_serverids_exist(struct ctdbd_connection *conn, const struct server_id *pids, unsigned num_pids, bool *results); diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index d8c9551..6c834f9 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -1131,6 +1131,15 @@ fail: return false; } +bool ctdb_serverids_exist_supported(struct ctdbd_connection *conn) +{ +#ifndef HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL + return false; +#else /* HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL */ + return true; +#endif /* HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL */ +} + #ifdef HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL bool ctdb_serverids_exist(struct ctdbd_connection *conn, -- 1.7.9.5 From cbe3101c0a757d990ade59468899c7ac02feab01 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 15:30:44 +0200 Subject: [PATCH 5/9] s3:ctdbd_conn: always provide ctdb_serverids_exist() Signed-off-by: Stefan Metzmacher --- source3/lib/ctdbd_conn.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 6c834f9..7ef2e7b 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -1140,12 +1140,13 @@ bool ctdb_serverids_exist_supported(struct ctdbd_connection *conn) #endif /* HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL */ } -#ifdef HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL - bool ctdb_serverids_exist(struct ctdbd_connection *conn, const struct server_id *pids, unsigned num_pids, bool *results) { +#ifndef HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL + return false; +#else /* HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL */ unsigned i, num_received; NTSTATUS status; struct ctdb_vnn_list *vnns = NULL; @@ -1291,9 +1292,8 @@ bool ctdb_serverids_exist(struct ctdbd_connection *conn, fail: TALLOC_FREE(vnns); return result; -} - #endif /* HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL */ +} /* * Get a db path -- 1.7.9.5 From 0ac6751e29feb012a74d8a53bf730b9d6b9ba163 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 15:31:17 +0200 Subject: [PATCH 6/9] s3:serverid: use ctdb_serverids_exist_supported() runtime check This is better than a compile time check for HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL. Signed-off-by: Stefan Metzmacher --- source3/lib/serverid.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index cb49520..355dfa6 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -125,11 +125,13 @@ bool serverid_register(const struct server_id id, uint32_t msg_flags) nt_errstr(status))); goto done; } -#ifdef HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL - if (lp_clustering()) { + + if (lp_clustering() && + ctdb_serverids_exist_supported(messaging_ctdbd_connection())) + { register_with_ctdbd(messaging_ctdbd_connection(), id.unique_id); } -#endif + ret = true; done: TALLOC_FREE(rec); @@ -340,8 +342,10 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results) remote_num += 1; } -#ifdef HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL - if (remote_num != 0) { +#ifdef CLUSTER_SUPPORT + if (remote_num != 0 && + ctdb_serverids_exist_supported(messaging_ctdbd_connection())) + { int old_remote_num = remote_num; remote_num = 0; -- 1.7.9.5 From f4da744e20a9431a1a38e5304ff3de8c657bb3a5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 11:52:23 +0200 Subject: [PATCH 7/9] s3:wscript: create a libsamba3-ctdb-client.so This collects the ctdb version dependent files, which allows vendors to provide multiple versions of libctdb_wrapper.so each compiled against different ctdb versions. Signed-off-by: Stefan Metzmacher --- source3/wscript_build | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/source3/wscript_build b/source3/wscript_build index 40d03b2..504680b 100755 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -292,21 +292,32 @@ bld.SAMBA3_SUBSYSTEM('samba3util', lib/sock_exec.c''', deps='ndr samba-security NDR_SECURITY samba-util util_tdb ccan-hash') +bld.SAMBA3_LIBRARY('samba3-ctdb-client', + source=''' + lib/dbwrap/dbwrap_ctdb.c + lib/messages_ctdbd.c + lib/ctdb_packet.c + lib/ctdbd_conn.c + lib/ctdb_conn.c + torture/test_ctdbconn.c + ''', + deps=''' + talloc + tevent + tdb + ''', + allow_undefined_symbols=True, + private_library=True) bld.SAMBA3_SUBSYSTEM('TDB_LIB', source='''lib/dbwrap/dbwrap_open.c - lib/dbwrap/dbwrap_ctdb.c lib/dbwrap/dbwrap_watch.c lib/g_lock.c''', - deps='dbwrap') + deps='dbwrap samba3-ctdb-client') bld.SAMBA3_SUBSYSTEM('samba3core', source='''lib/messages.c lib/messages_local.c - lib/messages_ctdbd.c - lib/ctdb_packet.c - lib/ctdbd_conn.c - lib/ctdb_conn.c lib/msg_channel.c lib/id_cache.c lib/talloc_dict.c @@ -1230,7 +1241,6 @@ bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3, torture/test_authinfo_structs.c torture/test_smbsock_any_connect.c torture/test_cleanup.c - torture/test_ctdbconn.c torture/test_msg.c torture/test_notify.c lib/tevent_barrier.c @@ -1251,6 +1261,7 @@ bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3, LOCKING NDR_OPEN_FILES idmap + samba3-ctdb-client ''', install=False) -- 1.7.9.5 From 1747bcf6eadd34e506b93df7c7b5a49a436f1019 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 12:11:49 +0200 Subject: [PATCH 8/9] s3:wscript: don't add ctdb include dir globally Signed-off-by: Stefan Metzmacher --- source3/wscript | 14 +++++++++----- source3/wscript_build | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source3/wscript b/source3/wscript index 271314d..5e85518 100644 --- a/source3/wscript +++ b/source3/wscript @@ -1407,8 +1407,9 @@ main() { else: - if Options.options.ctdb_dir: - conf.ADD_EXTRA_INCLUDES(Options.options.ctdb_dir + '/include') + have_cluster_support = True + ctdb_broken = "" + CTDB_CFLAGS = "" srcdir = os.path.realpath(conf.srcdir) if 'EXTRA_INCLUDES' in conf.env: @@ -1416,15 +1417,16 @@ main() { else: includes = '' + if Options.options.ctdb_dir: + CTDB_CFLAGS = '-I' + Options.options.ctdb_dir + '/include' + includes = includes + ' ' + Options.options.ctdb_dir + '/include' + if not conf.env.USING_SYSTEM_TDB: includes = includes + ' ' + srcdir + '/lib/tdb/include' if not conf.env.USING_SYSTEM_TALLOC: includes = includes + ' ' + srcdir + '/lib/talloc' - have_cluster_support = True - ctdb_broken = "" - conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" @@ -1660,6 +1662,7 @@ main() { if have_cluster_support: Logs.info("building with cluster support") conf.DEFINE('CLUSTER_SUPPORT', 1); + conf.env['CTDB_CFLAGS'] = CTDB_CFLAGS else: if Options.options.with_cluster_support == False: Logs.info("building without cluster support (--without-cluster-support)") @@ -1668,6 +1671,7 @@ main() { conf.fatal("Cluster support not found, but --with-cluster-support was specified") else: Logs.info("building without cluster support: " + ctdb_broken) + conf.env['CTDB_CFLAGS'] = '' conf.undefine('CLUSTER_SUPPORT') diff --git a/source3/wscript_build b/source3/wscript_build index 504680b..4ee887e 100755 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -306,6 +306,7 @@ bld.SAMBA3_LIBRARY('samba3-ctdb-client', tevent tdb ''', + cflags=bld.CONFIG_GET("CTDB_CFLAGS"), allow_undefined_symbols=True, private_library=True) -- 1.7.9.5 From 506e0a3ee38d1cc4a2d275f9cf559a2dbd10f1a1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Oct 2013 12:56:02 +0200 Subject: [PATCH 9/9] s3:wscript: only fill in CTDB_CFLAGS instead of config.h Only files in 'samba3-ctdb-client' will see HAVE_CTDB* defines. Signed-off-by: Stefan Metzmacher --- source3/wscript | 85 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 32 deletions(-) diff --git a/source3/wscript b/source3/wscript index 5e85518..1b76947 100644 --- a/source3/wscript +++ b/source3/wscript @@ -1427,7 +1427,7 @@ main() { if not conf.env.USING_SYSTEM_TALLOC: includes = includes + ' ' + srcdir + '/lib/talloc' - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1442,17 +1442,19 @@ main() { return 0; } ''', - 'HAVE_CTDB_H', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for header ctdb.h') - - if not conf.CONFIG_SET('HAVE_CTDB_H'): + if ok: + CTDB_CFLAGS += ' -DHAVE_CTDB_H=1' + else: have_cluster_support = False ctdb_broken = "ctdb.h is required for cluster support" + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') if have_cluster_support: - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1468,17 +1470,19 @@ main() { return 0; } ''', - 'HAVE_CTDB_PRIVATE_H', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for header ctdb_private.h') - - if not conf.CONFIG_SET('HAVE_CTDB_PRIVATE_H'): + if ok: + CTDB_CFLAGS += ' -DHAVE_CTDB_PRIVATE_H=1' + else: have_cluster_support = False ctdb_broken = "ctdb_private.h is required for cluster support" + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') if have_cluster_support: - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1494,13 +1498,16 @@ main() { return 0; } ''', - 'HAVE_CTDB_PROTOCOL_H', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for header ctdb_protocol.h') + if ok: + CTDB_CFLAGS += ' -DHAVE_CTDB_PROTOCOL_H=1' + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') if have_cluster_support: - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1516,17 +1523,19 @@ main() { return 0; } ''', - 'HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for transaction support (TRANS3_COMMIT control)') - - if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL'): + if ok: + CTDB_CFLAGS += ' -DHAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL=1' + else: have_cluster_support = False ctdb_broken = "ctdb transaction support missing or too old" + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') if have_cluster_support: - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1542,20 +1551,22 @@ main() { return 0; } ''', - 'HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for SCHEDULE_FOR_DELETION control') - - if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL'): + if ok: + CTDB_CFLAGS += ' -DHAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL=1' + else: if not Options.options.enable_old_ctdb: have_cluster_support = False ctdb_broken = "SCHEDULE_FOR_DELETION control missing" else: Logs.warn("ignoring missing SCHEDULE_FOR_DELETION control (--enable-old-ctdb)") + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') if have_cluster_support: - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1570,20 +1581,22 @@ main() { return 0; } ''', - 'HAVE_CTDB_WANT_READONLY_DECL', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for CTDB readonly records support') - - if not conf.CONFIG_SET('HAVE_CTDB_WANT_READONLY_DECL'): + if ok: + CTDB_CFLAGS += ' -DHAVE_CTDB_WANT_READONLY_DECL=1' + else: if not Options.options.enable_old_ctdb: have_cluster_support = False ctdb_broken = "support for CTDB readonly records missing" else: Logs.warn("ignoring missing READONLY support (--enable-old-ctdb)") + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') if have_cluster_support: - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1599,17 +1612,19 @@ main() { return 0; } ''', - 'HAVE_STRUCT_CTDB_CONTROL_TCP', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for ctdb ipv4 support') - - if not conf.CONFIG_SET('HAVE_STRUCT_CTDB_CONTROL_TCP'): + if ok: + CTDB_CFLAGS += ' -DHAVE_STRUCT_CTDB_CONTROL_TCP=1' + else: have_cluster_support = False ctdb_broken = "missing struct ctdb_control_tcp" + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') if have_cluster_support: - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1625,13 +1640,16 @@ main() { return 0; } ''', - 'HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for ctdb ipv6 support') + if ok: + CTDB_CFLAGS += ' -DHAVE_STRUCT_CTDB_CONTROL_TCP_ADDR=1' + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') if have_cluster_support: - conf.CHECK_CODE(''' + ok = conf.CHECK_CODE(''' #define NO_CONFIG_H #include "replace.h" #include "system/wait.h" @@ -1647,18 +1665,21 @@ main() { return 0; } ''', - 'HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL', + 'HAVE_CTDB_CHECK_CODE', addmain=False, includes=includes, msg='Checking for CHECK_SRVIDS control') - - if not conf.CONFIG_SET('HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL'): + if ok: + CTDB_CFLAGS += ' -DHAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL=1' + else: if not Options.options.enable_old_ctdb: have_cluster_support = False ctdb_broken = "CHECK_SRVIDS control missing" else: Logs.warn("ignoring missing CHECK_SRVIDS control (--enable-old-ctdb)") + conf.CONFIG_RESET('HAVE_CTDB_CHECK_CODE') + conf.undefine('HAVE_CTDB_CHECK_CODE') if have_cluster_support: Logs.info("building with cluster support") conf.DEFINE('CLUSTER_SUPPORT', 1); -- 1.7.9.5