The branch, master has been updated via 6fb80cb ctdb-tests: Check that no IPs are assigned when failover is disabled via 55893bf ctdb-tests: Add an extra conf loading test case via 78aad76 ctdb-doc: Switch tunable DisableIPFailover to a config option via 9296341 ctdb-config: Switch tunable DisableIPFailover to a config option via d003a41 ctdb-config: Integrate failover options into conf-tool via 893dd62 ctdb-failover: Add failover configuration options via 8e160d3 ctdb-tests: Drop DisableIPFailover simple test via 914e9f2 ctdb-daemon: Pass DisableIPFailover tunable via environment variable via 21de59a ctdb-common: Allow boolean configuration values to have yes/no values via a9758f4 ctdb-doc: Switch tunable TDBMutexEnabled to a config option via f42486e ctdb-config: Switch tunable TDBMutexEnabled to a config option via 8ddfc26 ctdb-doc: Add support for migrating tunables to ctdb.conf options via 43adcd7 ctdb-doc: Change option "no realtime" option to "realtime scheduling" via 17068e7 ctdb-config: Change option "no realtime" option to "realtime scheduling" via 64d4a7a ctdb-doc: Handle boolean options in config migration more carefully via d4afb60 ctdb-doc: Make config migration script notice removed CTDB_BASE option via 4833572 ctdb-common: Fix aliasing issue in IPv6 checksum from 0f3f63f PEP8: line up a couple of lists
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6fb80cbffb9cb8cba6abc3fbce228811d36e8c9a Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 24 17:37:38 2018 +1000 ctdb-tests: Check that no IPs are assigned when failover is disabled BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Fri Aug 24 14:13:12 CEST 2018 on sn-devel-144 commit 55893bf8d2cc7e01b3a93d8e1fde16408244cb65 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 06:55:33 2018 +1000 ctdb-tests: Add an extra conf loading test case This shows that config file loading continues in spite of unknown keys if ignore_unknown is true. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 78aad7623e100f05a7dfc142fba7ff2b0eba1913 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 17:25:53 2018 +1000 ctdb-doc: Switch tunable DisableIPFailover to a config option BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 929634126a334e380f16c080b59d062873b4e5f9 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 13:41:22 2018 +1000 ctdb-config: Switch tunable DisableIPFailover to a config option Use the "failover:disabled" option instead. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit d003a41a9cb9ea97a7da9dbb5bd3138f82da6cf1 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 11:44:03 2018 +1000 ctdb-config: Integrate failover options into conf-tool Update and add tests accordingly. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 893dd623dfdec4d5c5da07f933069e4534fe58ae Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 11:30:39 2018 +1000 ctdb-failover: Add failover configuration options Only a "disabled" option for now. Not documented because it isn't used yet. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 8e160d331aaccd64b1a767c0bde9e310c80afe06 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 11:18:34 2018 +1000 ctdb-tests: Drop DisableIPFailover simple test This is about to become a config file option that can't be dynamically changed at run-time, so drop this test for now. This test will be added once the tunable becomes a config file option. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 914e9f22d85b9274871b7c7d5486354928080e51 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 09:36:00 2018 +1000 ctdb-daemon: Pass DisableIPFailover tunable via environment variable Preparation for obsoleting this tunable. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 21de59ab7fe53240380b9a9a5b32d5af32d34237 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 20 13:43:38 2018 +1000 ctdb-common: Allow boolean configuration values to have yes/no values This make the new configuration style more consistent with the old one. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit a9758f413d06b0d114f4e5a0e053bbc8956c60b7 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 13:51:40 2018 +1000 ctdb-doc: Switch tunable TDBMutexEnabled to a config option BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit f42486e8912eee45eb75d27b753bb74c3b37d80b Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 20 15:01:50 2018 +1000 ctdb-config: Switch tunable TDBMutexEnabled to a config option Use the "database:tdb mutexes" option instead. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 8ddfc26d79fda2fd0265f370a4c08dc584e6a6ac Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 20 19:09:45 2018 +1000 ctdb-doc: Add support for migrating tunables to ctdb.conf options This will become common, so will be useful to have support for. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 43adcd717cee689c2d0386bd2aa2878006aa9217 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 21 13:45:32 2018 +1000 ctdb-doc: Change option "no realtime" option to "realtime scheduling" BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 17068e756b9e46f7a6c77d533ef1777173bb3795 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 20 13:35:33 2018 +1000 ctdb-config: Change option "no realtime" option to "realtime scheduling" Negative options can be confusing, so switch to a positive option. This was supposed to be done months ago but was forgotten. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 64d4a7ae5ac3aed2b1b9e7ab85c372e6900826ac Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 20 13:29:52 2018 +1000 ctdb-doc: Handle boolean options in config migration more carefully Values for ctdb.conf options are now returned by get_ctdb_conf_option(). The main goal is to allow old boolean options to be replaced by new logically negated options. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit d4afb60a24b932a0b7a0c2f27526f41d0bf38fc2 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 20 13:38:25 2018 +1000 ctdb-doc: Make config migration script notice removed CTDB_BASE option This should never have been a user-level option, but some people used it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 48335725deecdbdb24a9176cf31e9611c9deda49 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 13 12:18:51 2018 +1000 ctdb-common: Fix aliasing issue in IPv6 checksum Since commit 9c51b278b1700cd5f3e2addc19b7c711cc2ea10b the compiler has been able to inline the affected call to uint16_checksum(). Given that the data (phdr) is being accessed by an incompatible pointer (data) there is an aliasing problem when the call is inlined. This results in incorrect behaviour with -O2/-O3 when compiling with at least GCC 6, 7, and 8. Fix this by making the types compatible. Also fixes CID 1437604 (Reliance on integer endianness). This is a false positive because the uint16_checksum doesn't depend on the order of the input uint16_t items. https://bugzilla.samba.org/show_bug.cgi?id=13588 Pair-programmed-with: Amitay Isaacs <ami...@gmail.com> Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: ctdb/common/conf.c | 4 +- ctdb/common/conf_tool.c | 2 + ctdb/common/system_socket.c | 12 ++- ctdb/common/tunable.c | 4 +- ctdb/database/database_conf.c | 21 +++++ ctdb/database/database_conf.h | 3 +- ctdb/doc/ctdb-tunables.7.xml | 28 ------ ctdb/doc/ctdb.1.xml | 2 - ctdb/doc/ctdb.conf.5.xml | 52 ++++++++++- ctdb/doc/examples/config_migrate.sh | 104 +++++++++++++++------ ctdb/doc/examples/config_migrate.test_input | 7 +- .../database_conf.h => failover/failover_conf.c} | 43 ++++++--- .../event_conf.h => failover/failover_conf.h} | 16 ++-- ctdb/server/ctdb_config.c | 18 +++- ctdb/server/ctdb_config.h | 6 +- ctdb/server/ctdb_ltdb_server.c | 7 +- ctdb/server/ctdb_recoverd.c | 14 ++- ctdb/server/ctdb_takeover.c | 10 +- ctdb/server/ctdb_takeover_helper.c | 4 +- ctdb/server/ctdbd.c | 2 +- ctdb/server/legacy_conf.c | 4 +- ctdb/server/legacy_conf.h | 2 +- ctdb/tests/cunit/config_test_001.sh | 25 ++++- ctdb/tests/cunit/config_test_006.sh | 4 +- ctdb/tests/cunit/config_test_007.sh | 24 +++++ ctdb/tests/eventscripts/00.ctdb.setup.002.sh | 2 - ctdb/tests/eventscripts/scripts/00.ctdb.sh | 1 - ctdb/tests/simple/19_ip_takeover_noop.sh | 36 ++++--- ctdb/tests/simple/scripts/local_daemons.bash | 5 + ctdb/tests/takeover_helper/016.sh | 4 +- ctdb/tests/tool/ctdb.listvars.001.sh | 2 - ctdb/wscript | 6 ++ 32 files changed, 340 insertions(+), 134 deletions(-) copy ctdb/{database/database_conf.h => failover/failover_conf.c} (53%) copy ctdb/{event/event_conf.h => failover/failover_conf.h} (68%) create mode 100755 ctdb/tests/cunit/config_test_007.sh Changeset truncated at 500 lines: diff --git a/ctdb/common/conf.c b/ctdb/common/conf.c index 74af7f8..669ac23 100644 --- a/ctdb/common/conf.c +++ b/ctdb/common/conf.c @@ -122,12 +122,12 @@ static int string_to_integer(const char *str, int *int_val) static int string_to_boolean(const char *str, bool *bool_val) { - if (strcasecmp(str, "true") == 0) { + if (strcasecmp(str, "true") == 0 || strcasecmp(str, "yes") == 0) { *bool_val = true; return 0; } - if (strcasecmp(str, "false") == 0) { + if (strcasecmp(str, "false") == 0 || strcasecmp(str, "no") == 0) { *bool_val = false; return 0; } diff --git a/ctdb/common/conf_tool.c b/ctdb/common/conf_tool.c index 329b204..e6020c5 100644 --- a/ctdb/common/conf_tool.c +++ b/ctdb/common/conf_tool.c @@ -32,6 +32,7 @@ #include "cluster/cluster_conf.h" #include "database/database_conf.h" #include "event/event_conf.h" +#include "failover/failover_conf.h" #include "server/legacy_conf.h" #include "common/conf_tool.h" @@ -243,6 +244,7 @@ int conf_tool_run(struct conf_tool_context *ctx, int *result) cluster_conf_init(ctx->conf); database_conf_init(ctx->conf); event_conf_init(ctx->conf); + failover_conf_init(ctx->conf); legacy_conf_init(ctx->conf); if (! conf_valid(ctx->conf)) { diff --git a/ctdb/common/system_socket.c b/ctdb/common/system_socket.c index 22776f7..4a7a8c8 100644 --- a/ctdb/common/system_socket.c +++ b/ctdb/common/system_socket.c @@ -135,16 +135,20 @@ static uint16_t ip_checksum(uint16_t *data, size_t n, struct ip *ip) static uint16_t ip6_checksum(uint16_t *data, size_t n, struct ip6_hdr *ip6) { - uint32_t phdr[2]; + uint16_t phdr[3]; uint32_t sum = 0; uint16_t sum2; + uint32_t len; sum += uint16_checksum((uint16_t *)(void *)&ip6->ip6_src, 16); sum += uint16_checksum((uint16_t *)(void *)&ip6->ip6_dst, 16); - phdr[0] = htonl(n); - phdr[1] = htonl(ip6->ip6_nxt); - sum += uint16_checksum((uint16_t *)phdr, 8); + len = htonl(n); + phdr[0] = len & UINT16_MAX; + phdr[1] = (len >> 16) & UINT16_MAX; + /* ip6_nxt is only 8 bits, so fits comfortably into a uint16_t */ + phdr[2] = htons(ip6->ip6_nxt); + sum += uint16_checksum(phdr, sizeof(phdr)); sum += uint16_checksum(data, n); diff --git a/ctdb/common/tunable.c b/ctdb/common/tunable.c index 4c1714c..f516d8c 100644 --- a/ctdb/common/tunable.c +++ b/ctdb/common/tunable.c @@ -83,7 +83,7 @@ static struct { offsetof(struct ctdb_tunable_list, reclock_ping_period) }, { "NoIPFailback", 0, false, offsetof(struct ctdb_tunable_list, no_ip_failback) }, - { "DisableIPFailover", 0, false, + { "DisableIPFailover", 0, true, offsetof(struct ctdb_tunable_list, disable_ip_failover) }, { "VerboseMemoryNames", 0, false, offsetof(struct ctdb_tunable_list, verbose_memory_names) }, @@ -145,7 +145,7 @@ static struct { offsetof(struct ctdb_tunable_list, no_ip_host_on_all_disabled) }, { "Samba3AvoidDeadlocks", 0, true, offsetof(struct ctdb_tunable_list, samba3_hack) }, - { "TDBMutexEnabled", 1, false, + { "TDBMutexEnabled", 1, true, offsetof(struct ctdb_tunable_list, mutex_enabled) }, { "LockProcessesPerDB", 200, false, offsetof(struct ctdb_tunable_list, lock_processes_per_db) }, diff --git a/ctdb/database/database_conf.c b/ctdb/database/database_conf.c index 0333ce0..6bdb372 100644 --- a/ctdb/database/database_conf.c +++ b/ctdb/database/database_conf.c @@ -54,6 +54,22 @@ static bool check_static_string_change(const char *key, return true; } +static bool check_static_boolean_change(const char *key, + bool old_value, + bool new_value, + enum conf_update_mode mode) +{ + if (mode == CONF_MODE_RELOAD || CONF_MODE_API) { + if (old_value != new_value) { + D_WARNING("Ignoring update of [%s] -> %s\n", + DATABASE_CONF_SECTION, + key); + } + } + + return true; +} + static bool database_conf_validate_lock_debug_script(const char *key, const char *old_script, const char *new_script, @@ -141,4 +157,9 @@ void database_conf_init(struct conf_context *conf) DATABASE_CONF_LOCK_DEBUG_SCRIPT, NULL, database_conf_validate_lock_debug_script); + conf_define_boolean(conf, + DATABASE_CONF_SECTION, + DATABASE_CONF_TDB_MUTEXES, + true, + check_static_boolean_change); } diff --git a/ctdb/database/database_conf.h b/ctdb/database/database_conf.h index 4891b00..6fa579c 100644 --- a/ctdb/database/database_conf.h +++ b/ctdb/database/database_conf.h @@ -27,7 +27,8 @@ #define DATABASE_CONF_VOLATILE_DB_DIR "volatile database directory" #define DATABASE_CONF_PERSISTENT_DB_DIR "persistent database directory" #define DATABASE_CONF_STATE_DB_DIR "state database directory" -#define DATABASE_CONF_LOCK_DEBUG_SCRIPT "lock debug script" +#define DATABASE_CONF_LOCK_DEBUG_SCRIPT "lock debug script" +#define DATABASE_CONF_TDB_MUTEXES "tdb mutexes" void database_conf_init(struct conf_context *conf); diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml index a925ca5..71cb0e3 100644 --- a/ctdb/doc/ctdb-tunables.7.xml +++ b/ctdb/doc/ctdb-tunables.7.xml @@ -178,23 +178,6 @@ MonitorInterval=20 </refsect2> <refsect2> - <title>DisableIPFailover</title> - <para>Default: 0</para> - <para> - When set to non-zero, ctdb will not perform failover or - failback. Even if a node fails while holding public IPs, ctdb - will not recover the IPs or assign them to another node. - </para> - <para> - When this tunable is enabled, ctdb will no longer attempt - to recover the cluster by failing IP addresses over to other - nodes. This leads to a service outage until the administrator - has manually performed IP failover to replacement nodes using the - 'ctdb moveip' command. - </para> - </refsect2> - - <refsect2> <title>ElectionTimeout</title> <para>Default: 3</para> <para> @@ -661,17 +644,6 @@ MonitorInterval=20 </refsect2> <refsect2> - <title>TDBMutexEnabled</title> - <para>Default: 1</para> - <para> - This parameter enables TDB_MUTEX_LOCKING feature on volatile - databases if the robust mutexes are supported. This optimizes the - record locking using robust mutexes and is much more efficient - that using posix locks. - </para> - </refsect2> - - <refsect2> <title>TickleUpdateInterval</title> <para>Default: 20</para> <para> diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index 5c3ce41..355547a 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -800,7 +800,6 @@ DatabaseMaxDead = 5 RerecoveryTimeout = 10 EnableBans = 1 NoIPFailback = 0 -DisableIPFailover = 0 VerboseMemoryNames = 0 RecdPingTimeout = 60 RecdFailCount = 10 @@ -828,7 +827,6 @@ DBRecordCountWarn = 100000 DBRecordSizeWarn = 10000000 DBSizeWarn = 100000000 PullDBPreallocation = 10485760 -TDBMutexEnabled = 1 LockProcessesPerDB = 200 RecBufferSizeLimit = 1000000 QueueBufferSize = 1024 diff --git a/ctdb/doc/ctdb.conf.5.xml b/ctdb/doc/ctdb.conf.5.xml index bcb67b3..01c09bf 100644 --- a/ctdb/doc/ctdb.conf.5.xml +++ b/ctdb/doc/ctdb.conf.5.xml @@ -305,6 +305,23 @@ </varlistentry> <varlistentry> + <term>tdb mutexes = true|false</term> + <listitem> + <para> + This parameter enables TDB_MUTEX_LOCKING feature on + volatile databases if the robust mutexes are + supported. This optimizes the record locking using robust + mutexes and is much more efficient that using posix locks. + </para> + <para> + If robust mutexes are unreliable on the platform being + used then they can be disabled by setting this to + <literal>false</literal>. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term>lock debug script = <parameter>FILENAME</parameter></term> <listitem> <para> @@ -376,6 +393,35 @@ <refsect1> <title> + FAILOVER CONFIGURATION + </title> + + <para> + Options in this section affect CTDB failover. They are + valid within the <emphasis>failover</emphasis> section of file, + indicated by <literal>[failover]</literal>. + </para> + + <variablelist> + + <varlistentry> + <term>disabled = true|false</term> + <listitem> + <para> + If set to <literal>true</literal> then public IP failover + is disabled. + </para> + <para> + Default: <literal>false</literal> + </para> + </listitem> + </varlistentry> + + </variablelist> + </refsect1> + + <refsect1> + <title> LEGACY CONFIGURATION </title> @@ -436,17 +482,17 @@ </varlistentry> <varlistentry> - <term>no realtime = true|false</term> + <term>realtime scheduling = true|false</term> <listitem> <para> Usually CTDB runs with real-time priority. This helps it to perform effectively on a busy system, such as when there are thousands of Samba clients. If you are running CTDB on a platform that does not support real-time - priority, you can set this to <literal>true</literal>. + priority, you can set this to <literal>false</literal>. </para> <para> - Default: <literal>false</literal> + Default: <literal>true</literal> </para> </listitem> </varlistentry> diff --git a/ctdb/doc/examples/config_migrate.sh b/ctdb/doc/examples/config_migrate.sh index 8eefd03..8479aeb 100755 --- a/ctdb/doc/examples/config_migrate.sh +++ b/ctdb/doc/examples/config_migrate.sh @@ -109,33 +109,44 @@ out_file_remove_if_empty () # script # -# Convert a ctdbd.conf opt+val into a ctdb.conf section+opt +# Convert a ctdbd.conf opt+val into a ctdb.conf section+opt+val # # If opt is matched and val is empty then output is printed, allowing # this function to be reused to check if opt is valid. +# +# Note that for boolean options, the expected value and the new value +# form part of the data. get_ctdb_conf_option () { _opt="$1" _val="$2" awk -v opt="${_opt}" -v val="${_val}" \ - '$3 == opt { if (!$4 || !val || val ==$4) { print $1, $2 } }' <<EOF -cluster node-address CTDB_NODE_ADDRESS -cluster recovery-lock CTDB_RECOVERY_LOCK -cluster transport CTDB_TRANSPORT -database lock-debug-script CTDB_DEBUG_LOCKS -database persistent-database-directory CTDB_DBDIR_PERSISTENT -database state-database-directory CTDB_DBDIR_STATE -database volatile-database-directory CTDB_DBDIR -event debug-script CTDB_DEBUG_HUNG_SCRIPT -legacy lmaster-capability CTDB_CAPABILITY_LMASTER no -legacy no-realtime CTDB_NOSETSCHED yes -legacy recmaster-capability CTDB_CAPABILITY_RECMASTER no -legacy script-log-level CTDB_SCRIPT_LOG_LEVEL -legacy start-as-disabled CTDB_START_AS_DISABLED yes -legacy start-as-stopped CTDB_START_AS_STOPPED yes -logging location CTDB_LOGGING -logging log-level CTDB_DEBUGLEVEL + '$3 == opt { + if (!$4 || !val || val == $4) { + if ($5) { + print $1, $2, $5 + } else { + print $1, $2, val + } + } + }' <<EOF +cluster node-address CTDB_NODE_ADDRESS +cluster recovery-lock CTDB_RECOVERY_LOCK +cluster transport CTDB_TRANSPORT +database lock-debug-script CTDB_DEBUG_LOCKS +database persistent-database-directory CTDB_DBDIR_PERSISTENT +database state-database-directory CTDB_DBDIR_STATE +database volatile-database-directory CTDB_DBDIR +event debug-script CTDB_DEBUG_HUNG_SCRIPT +legacy lmaster-capability CTDB_CAPABILITY_LMASTER no false +legacy realtime-scheduling CTDB_NOSETSCHED yes false +legacy recmaster-capability CTDB_CAPABILITY_RECMASTER no false +legacy script-log-level CTDB_SCRIPT_LOG_LEVEL +legacy start-as-disabled CTDB_START_AS_DISABLED yes true +legacy start-as-stopped CTDB_START_AS_STOPPED yes true +logging location CTDB_LOGGING +logging log-level CTDB_DEBUGLEVEL EOF } @@ -149,12 +160,48 @@ check_ctdb_conf_option () [ -n "$_out" ] } +# Convert a ctdbd.conf tunable option into a ctdb.conf section+opt +# +# The difference between this and get_ctdb_conf_option() is that only +# the tunable part of the option is passed as opt and it is matched +# case-insensitively. +get_ctdb_conf_tunable_option () +{ + _opt="$1" + _val="$2" + + awk -v opt="${_opt}" -v val="${_val}" \ + 'tolower($3) == tolower(opt) { + if (!$4 || !val || (val == 0 ? 0 : 1) == $4) { + if ($5) { + print $1, $2, $5 + } else { + print $1, $2, val + } + } + }' <<EOF +database tdb-mutexes TDBMutexEnabled 0 false +failover disabled DisableIPFailover 1 true +EOF + +} + +# Check if a tunable will convert to a ctdb.conf option +check_ctdb_conf_tunable_option () +{ + _opt="$1" + + _out=$(get_ctdb_conf_tunable_option "$_opt" "") + [ -n "$_out" ] +} + # Check if an option has been removed check_removed_option () { _option="$1" grep -Fqx "$_option" <<EOF +CTDB_BASE CTDB_PIDFILE CTDB_SOCKET CTDB_EVENT_SCRIPT_DIR @@ -496,23 +543,25 @@ build_ctdb_conf () list_options | while read -r _opt _val ; do - _out=$(get_ctdb_conf_option "$_opt" "$_val") + case "$_opt" in + CTDB_SET_*) + _opt="${_opt#CTDB_SET_}" + _out=$(get_ctdb_conf_tunable_option "$_opt" "$_val") + ;; + *) + _out=$(get_ctdb_conf_option "$_opt" "$_val") + esac if [ -z "$_out" ] ; then continue fi - # ctdb.conf needs true/false, not yes/no - case "$_val" in - yes) _val="true" ;; - no) _val="false" ;; - esac - # $_out is section and key, replace dashes with spaces # Intentional word splitting # shellcheck disable=SC2086 set -- $_out _section=$(echo "$1" | sed -e 's|-| |g') _key=$(echo "$2" | sed -e 's|-| |g') + _newval="$3" if ! grep -Fqx "[${_section}]" "$_out_file" ; then # Add blank line if file is not empty @@ -525,7 +574,7 @@ build_ctdb_conf () # Must escape leading TAB or sed eats it sed -i -e "/\\[${_section}\\]/a\ -\\ ${_key} = ${_val} +\\ ${_key} = ${_newval} " "$_out_file" done @@ -556,6 +605,9 @@ build_ctdb_tunables () list_tunables | while read -r _var _val ; do + if check_ctdb_conf_tunable_option "$_var" ; then + continue + fi if ! check_valid_tunable "$_var" ; then continue fi diff --git a/ctdb/doc/examples/config_migrate.test_input b/ctdb/doc/examples/config_migrate.test_input index 593ca4c..e823fd4 100644 --- a/ctdb/doc/examples/config_migrate.test_input +++ b/ctdb/doc/examples/config_migrate.test_input @@ -1,3 +1,5 @@ +CTDB_BASE="/etc/ctdb" + CTDB_RECOVERY_LOCK="/some/place/on/shared/storage" CTDB_NODES="/etc/ctdb/nodes" @@ -24,6 +26,8 @@ CTDB_START_AS_STOPPED="yes" CTDB_CAPABILITY_RECMASTER="no" CTDB_CAPABILITY_LMASTER="yes" +CTDB_NOSETSCHED="yes" + CTDB_FOO="bar" CTDB_NATGW_PUBLIC_IP=10.1.1.121/24 @@ -32,9 +36,10 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.1.1.254 CTDB_NATGW_PRIVATE_NETWORK=192.168.1.0/24 CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes -CTDB_SET_TDBMutexEnabled=1 +CTDB_SET_TDBMutexEnabled=0 CTDB_SET_IPALLOCALGORITHM=0 CTDB_SET_noiphostonalldisabled=0 +CTDB_SET_DisableIpFailover=1 CTDB_SET_foobar=0 CTDB_SUPPRESS_COREFILE="yes" diff --git a/ctdb/database/database_conf.h b/ctdb/failover/failover_conf.c similarity index 53% copy from ctdb/database/database_conf.h copy to ctdb/failover/failover_conf.c index 4891b00..0f199cb 100644 --- a/ctdb/database/database_conf.h +++ b/ctdb/failover/failover_conf.c @@ -17,18 +17,37 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. -- Samba Shared Repository