[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Thu May 17 05:04:02 UTC 2018


The branch, master has been updated
       via  87284da ctdb: Drop configuration file ctdbd.conf
       via  b184761 ctdb-tests: Switch local daemons to use new style configuration file
       via  1aa17eb ctdb-config: Add default ctdb.conf file
       via  bd58f7a ctdb-docs: Add example configuration files
       via  409b0b7 ctdb-docs: Add ctdb.conf(5) cross references and documentation tweaks
       via  72ba7ea ctdb-docs: Add ctdb.conf(5)
       via  60811d6 ctdb-tests: Clean up tests to not expose script options
       via  9b09943 ctdb-scripts: Fetch recovery lock option from config file in 01.reclock
       via  2bc6be1 ctdb-scripts: Fetch database options from config file in scripts
       via  16aa9e7 ctdb-scripts: Add function ctdb_get_db_options()
       via  ad82b8a ctdb-tests: Add ctdb-config wrapper stub for event script tests
       via  7c33f5e ctdb-tests: Add setup of ctdb.conf recovery lock setting
       via  ff3d0e7 ctdb-tests: Add setup of ctdb.conf database directory settings
       via  25f05ce ctdb-tests: Add new variable CTDB_SCRIPTS_HELPER_BINDIR
       via  78fbbfa ctdb-daemon: Drop most ctdbd command-line options
       via  4e06610 ctdb-scripts: Translate old style options into new configuration file
       via  61e288a ctdb-daemon: Integrate configuration file handling
       via  239f189 ctdb-daemon: Implement ctdb configuration file loading
       via  b42dbad ctdb-tools: Add legacy config options to config tool
       via  d91b9b3 ctdb-daemon: Define ctdbd legacy configuration file options
       via  65d9d1e ctdb-tools: Add database config options to config tool
       via  52d2701 ctdb-database: Define database configuration file options
       via  dbdd49d ctdb-tools: Add cluster config options to config tool
       via  cf17a48 ctdb-cluster: Define cluster configuration file options
       via  5eec5e7 ctdb-tools: Add event daemon config options to config tool
       via  8831f67 ctdb-event: Add event daemon config file options
       via  920f834 ctdb-daemon: Drop ctdbd --max-persistent-check-errors option
       via  61efed5 ctdb-scripts: Drop CTDB_MAX_PERSISTENT_CHECK_ERRORS option
       via  9193a10 ctdb-daemon: Do not create database directories
       via  344e6ee ctdb-tests: Create database directories for local daemons
       via  31747da ctdb-build: Create database directories during installation
      from  c83dad5 s4:torture: Do not leak file descriptor in smb2 oplock test

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 87284da7a28172b40504eb50510a8b57da6692a6
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 15:55:11 2018 +1000

    ctdb: Drop configuration file ctdbd.conf
    
    Drop function loadconfig(), replacing uses with "load_system_config
    ctdb".  Drop translation of old-style configuration to new
    configuration file.  Drop export of debugging variables.  Drop
    documentation and configuration examples.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Thu May 17 07:03:04 CEST 2018 on sn-devel-144

commit b184761829dc291cbed696084c271316dca79607
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 13 19:25:56 2018 +1000

    ctdb-tests: Switch local daemons to use new style configuration file
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 1aa17eb44774686967b55d3bd19c54646669999b
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 19:58:23 2018 +1000

    ctdb-config: Add default ctdb.conf file
    
    Install it in RPM.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit bd58f7af40f6456555897a87d5946ab60800edb9
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun May 13 15:42:31 2018 +1000

    ctdb-docs: Add example configuration files
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 409b0b797ef345d270f1b0f55bb8691088245c20
Author: Martin Schwenke <martin at meltin.net>
Date:   Sat Apr 21 18:12:53 2018 +1000

    ctdb-docs: Add ctdb.conf(5) cross references and documentation tweaks
    
    Minor updates to other manual pages for compatibility.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 72ba7ea887f2fe88521dd653ae618ea6738535e4
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun May 13 15:41:38 2018 +1000

    ctdb-docs: Add ctdb.conf(5)
    
    This documents the new Samba-style configuration file.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 60811d62e5cd37a7aece7d9c63c9434069e76365
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 2 18:38:41 2018 +1000

    ctdb-tests: Clean up tests to not expose script options
    
    The tests still use the script options but the event scripts no longer
    see them exported from the test infrastructure.  Testing now depends
    on the event scripts successfully fetching the options from the
    configuration file.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 9b099431fd02c9a8c3a5bfc52fa42d6d891bef59
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 12:20:34 2018 +1000

    ctdb-scripts: Fetch recovery lock option from config file in 01.reclock
    
    Put it in a function so it is easy to move to common code just in case
    it is needed somewhere else.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2bc6be1e4f77245441950719757893ac28a984c7
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 12:15:26 2018 +1000

    ctdb-scripts: Fetch database options from config file in scripts
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 16aa9e7a303e13440d702ae444842af349db961c
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 12:12:44 2018 +1000

    ctdb-scripts: Add function ctdb_get_db_options()
    
    This pulls database options from the configuration file, caches then
    and makes the values available in scripts.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit ad82b8abc3a7ee9b72ae51b383ae012e2b8a4bcf
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 2 18:06:05 2018 +1000

    ctdb-tests: Add ctdb-config wrapper stub for event script tests
    
    Create a shim helper around that simply invokes ctdb-config via its
    real location.
    
    This is needed because the event script tests set CTDB_HELPER_BINDIR
    to the stubs directory because all other helpers used by event script
    testing are currently stubs.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 7c33f5ec2da3e2995995ffccfa2db4f44e486b26
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 2 18:05:28 2018 +1000

    ctdb-tests: Add setup of ctdb.conf recovery lock setting
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit ff3d0e70b69d47e62478b3f5a6b8bc3957a01444
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 2 12:37:21 2018 +1000

    ctdb-tests: Add setup of ctdb.conf database directory settings
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 25f05ced2f70f30bdf2791ddf97efbae75868fd4
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 2 18:03:20 2018 +1000

    ctdb-tests: Add new variable CTDB_SCRIPTS_HELPER_BINDIR
    
    This will always find a binary helper, as opposed to a script helper,
    which currently lives under tools/ in the source tree.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 78fbbfa4d3892d66c4dc2f02bb2b3200cfcd5159
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Apr 16 14:23:00 2018 +1000

    ctdb-daemon: Drop most ctdbd command-line options
    
    All except -i/--interactive.  This remaining popt option is now neatly
    wrapped to fit in 80 columns.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 4e06610f8c9d8036492028ee0dc74cd8bef0d9e5
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Apr 16 13:20:36 2018 +1000

    ctdb-scripts: Translate old style options into new configuration file
    
    This allows the relevant command-line options to be removed from the
    daemon while still leaving the old ctdbd.conf options file in place.
    It is a temporary measure to enable testing in an old testing
    environment.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 61e288ad70b7bbf16726d703596507137e0417d2
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 13 19:18:27 2018 +1000

    ctdb-daemon: Integrate configuration file handling
    
    Testing is now broken because command-line options are no longer
    respected.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 239f189b10160c0c176e6e0ebef089c8d544f213
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Apr 18 20:21:07 2018 +1000

    ctdb-daemon: Implement ctdb configuration file loading
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit b42dbadbef1f57e5c59edb1ee094434243c892ba
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri May 11 22:49:46 2018 +1000

    ctdb-tools: Add legacy config options to config tool
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit d91b9b309ca270dbd60798902fcb45d2e3bb461a
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Apr 11 20:36:45 2018 +1000

    ctdb-daemon: Define ctdbd legacy configuration file options
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 65d9d1e743ff1598b66738b64dc18bcc27d9c981
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri May 11 22:42:42 2018 +1000

    ctdb-tools: Add database config options to config tool
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 52d27012796474a3ce024a14d10d8c7eceff057c
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 17:10:51 2018 +1000

    ctdb-database: Define database configuration file options
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit dbdd49da23c78fa12af39f29277f38827b5a6942
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri May 11 22:26:16 2018 +1000

    ctdb-tools: Add cluster config options to config tool
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit cf17a48d29a991b7dc7d582e538f11b5a0ac8166
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 17:11:59 2018 +1000

    ctdb-cluster: Define cluster configuration file options
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5eec5e7c1f0dbafbeb627c0ef53944ad9f2d355c
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Apr 17 12:38:30 2018 +1000

    ctdb-tools: Add event daemon config options to config tool
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 8831f6740e0892d296eaba91805f9d437ecbdb9a
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Apr 23 14:02:43 2018 +1000

    ctdb-event: Add event daemon config file options
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 920f83457861c5f0566e9fb664efe7c715dee09a
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 15 18:51:29 2018 +1000

    ctdb-daemon: Drop ctdbd --max-persistent-check-errors option
    
    Leave the code with an internal default of 0.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 61efed5a7e19825d49130b4e6785cfb29c557a32
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 15 18:47:29 2018 +1000

    ctdb-scripts: Drop CTDB_MAX_PERSISTENT_CHECK_ERRORS option
    
    This must harken back to the days of yore when corrupt persistent
    databases were an issue.  We haven't seen this used.  If CTDB fails to
    start due to a corrupt persistent database then this database can be
    removed by hand.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 9193a10f05562c756912d59882eac1cea44bb5d9
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 15 18:46:21 2018 +1000

    ctdb-daemon: Do not create database directories
    
    These should be created at installation or, if non-standard, by the
    administrator.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 344e6eecb29a00bcdb3d18c62ac99d0b2a405257
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 15 18:45:10 2018 +1000

    ctdb-tests: Create database directories for local daemons
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 31747da5ff69eb3442db6ed9949c49776317ddce
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon May 14 15:41:35 2018 +1000

    ctdb-build: Create database directories during installation
    
    Create and package.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/cluster/cluster_conf.c                        | 124 +++++
 ctdb/cluster/cluster_conf.h                        |  33 ++
 ctdb/common/conf_tool.c                            |   8 +
 ctdb/config/ctdb.conf                              |  17 +
 ctdb/config/ctdbd.conf                             |  20 -
 ctdb/config/ctdbd_wrapper                          |  64 +--
 ctdb/config/debug_locks.sh                         |   8 +-
 ctdb/config/events.d/00.ctdb                       |   5 +-
 ctdb/config/events.d/01.reclock                    |  18 +
 ctdb/config/events.d/05.system                     |   3 +
 ctdb/config/functions                              |  49 +-
 ctdb/database/database_conf.c                      | 144 +++++
 ctdb/database/database_conf.h                      |  34 ++
 ctdb/doc/ctdb-etcd.7.xml                           |   8 +-
 ctdb/doc/ctdb-script.options.5.xml                 |  16 +-
 ctdb/doc/ctdb-tunables.7.xml                       |   2 +-
 ctdb/doc/ctdb.7.xml                                |  30 +-
 ctdb/doc/ctdb.conf.5.xml                           | 593 +++++++++++++++++++++
 ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml        |   8 +-
 ctdb/doc/ctdbd.1.xml                               | 330 +-----------
 ctdb/doc/ctdbd.conf.5.xml                          | 433 ---------------
 ctdb/doc/ctdbd_wrapper.1.xml                       |  10 -
 ctdb/doc/examples/11.natgw.options                 |  25 +
 ctdb/doc/examples/91.lvs.options                   |  12 +
 ctdb/doc/examples/README                           |   9 +-
 ctdb/doc/examples/{cluster.conf => ctdb.conf}      |  32 +-
 ctdb/doc/examples/lvs.conf                         |  88 ---
 ctdb/doc/examples/natgw.conf                       | 104 ----
 ctdb/event/event_conf.c                            |  85 +++
 ctdb/event/event_conf.h                            |  31 ++
 ctdb/packaging/RPM/ctdb.spec.in                    |   7 +-
 ctdb/server/ctdb_config.c                          | 161 ++++++
 ctdb/server/ctdb_config.h                          |  53 ++
 ctdb/server/ctdbd.c                                | 139 +++--
 ctdb/server/legacy_conf.c                          |  85 +++
 ctdb/server/legacy_conf.h                          |  36 ++
 ctdb/tests/cunit/config_test_001.sh                |  27 +
 .../{config_test_001.sh => config_test_003.sh}     |  44 +-
 ctdb/tests/cunit/config_test_004.sh                |  74 +++
 ctdb/tests/cunit/config_test_005.sh                |  91 ++++
 ctdb/tests/cunit/config_test_006.sh                |  61 +++
 ctdb/tests/eventscripts/scripts/01.reclock.sh      |   7 +-
 ctdb/tests/eventscripts/scripts/local.sh           |  12 +-
 ctdb/tests/eventscripts/stubs/ctdb-config          |   2 +
 ctdb/tests/scripts/script_install_paths.sh         |  10 +-
 ctdb/tests/simple/scripts/local_daemons.bash       |  25 +-
 ctdb/utils/etcd/ctdb_etcd_lock                     |   6 +-
 ctdb/wscript                                       |  34 +-
 48 files changed, 1971 insertions(+), 1246 deletions(-)
 create mode 100644 ctdb/cluster/cluster_conf.c
 create mode 100644 ctdb/cluster/cluster_conf.h
 create mode 100644 ctdb/config/ctdb.conf
 delete mode 100644 ctdb/config/ctdbd.conf
 create mode 100644 ctdb/database/database_conf.c
 create mode 100644 ctdb/database/database_conf.h
 create mode 100644 ctdb/doc/ctdb.conf.5.xml
 delete mode 100644 ctdb/doc/ctdbd.conf.5.xml
 create mode 100644 ctdb/doc/examples/11.natgw.options
 create mode 100644 ctdb/doc/examples/91.lvs.options
 rename ctdb/doc/examples/{cluster.conf => ctdb.conf} (84%)
 delete mode 100644 ctdb/doc/examples/lvs.conf
 delete mode 100644 ctdb/doc/examples/natgw.conf
 create mode 100644 ctdb/event/event_conf.c
 create mode 100644 ctdb/event/event_conf.h
 create mode 100644 ctdb/server/ctdb_config.c
 create mode 100644 ctdb/server/ctdb_config.h
 create mode 100644 ctdb/server/legacy_conf.c
 create mode 100644 ctdb/server/legacy_conf.h
 copy ctdb/tests/cunit/{config_test_001.sh => config_test_003.sh} (50%)
 create mode 100755 ctdb/tests/cunit/config_test_004.sh
 create mode 100755 ctdb/tests/cunit/config_test_005.sh
 create mode 100755 ctdb/tests/cunit/config_test_006.sh
 create mode 100755 ctdb/tests/eventscripts/stubs/ctdb-config


Changeset truncated at 500 lines:

diff --git a/ctdb/cluster/cluster_conf.c b/ctdb/cluster/cluster_conf.c
new file mode 100644
index 0000000..540732d
--- /dev/null
+++ b/ctdb/cluster/cluster_conf.c
@@ -0,0 +1,124 @@
+/*
+   CTDB cluster config handling
+
+   Copyright (C) Martin Schwenke  2018
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "system/network.h"
+
+#include "lib/util/debug.h"
+
+#include "common/conf.h"
+
+#include "cluster_conf.h"
+
+#define CLUSTER_TRANSPORT_DEFAULT "tcp"
+
+/*
+ * Ideally this wants to be a void function but it also used directly
+ * as a validation function
+ */
+static bool check_static_string_change(const char *key,
+				       const char *old_value,
+				       const char *new_value,
+				       enum conf_update_mode mode)
+{
+	if (mode == CONF_MODE_RELOAD) {
+		if (strcmp(old_value, new_value) != 0) {
+			D_WARNING("Ignoring update of [%s] -> %s\n",
+				  CLUSTER_CONF_SECTION,
+				  key);
+		}
+	}
+
+	return true;
+}
+
+static bool validate_transport(const char *key,
+			       const char *old_transport,
+			       const char *new_transport,
+			       enum conf_update_mode mode)
+{
+	/* Don't allow "ib" for now.  It is broken! */
+	if (strcmp(new_transport, CLUSTER_TRANSPORT_DEFAULT) != 0) {
+		D_ERR("Invalid value for [cluster] -> transport = %s\n",
+		      new_transport);
+		return false;
+	}
+
+	/* This sometimes warns but always returns true */
+	return check_static_string_change(key,
+					  old_transport,
+					  new_transport,
+					  mode);
+}
+
+static bool validate_node_address(const char *key,
+				  const char *old_node_address,
+				  const char *new_node_address,
+				  enum conf_update_mode mode)
+{
+	struct in_addr addr4;
+	struct in6_addr addr6;
+	int ret;
+
+	if (new_node_address == NULL) {
+		goto good;
+	}
+
+	ret = inet_pton(AF_INET, new_node_address, &addr4);
+	if (ret == 1) {
+		goto good;
+	}
+
+	ret = inet_pton(AF_INET6, new_node_address, &addr6);
+	if (ret == 1) {
+		goto good;
+	}
+
+	D_ERR("Invalid value for [cluster] -> node address = %s\n",
+	      new_node_address);
+	return false;
+
+good:
+	/* This sometimes warns but always returns true */
+	return check_static_string_change(key,
+					  old_node_address,
+					  new_node_address,
+					  mode);
+}
+
+void cluster_conf_init(struct conf_context *conf)
+{
+	conf_define_section(conf, CLUSTER_CONF_SECTION, NULL);
+
+	conf_define_string(conf,
+			   CLUSTER_CONF_SECTION,
+			   CLUSTER_CONF_TRANSPORT,
+			   CLUSTER_TRANSPORT_DEFAULT,
+			   validate_transport);
+	conf_define_string(conf,
+			   CLUSTER_CONF_SECTION,
+			   CLUSTER_CONF_NODE_ADDRESS,
+			   NULL,
+			   validate_node_address);
+	conf_define_string(conf,
+			   CLUSTER_CONF_SECTION,
+			   CLUSTER_CONF_RECOVERY_LOCK,
+			   NULL,
+			   check_static_string_change);
+}
diff --git a/ctdb/cluster/cluster_conf.h b/ctdb/cluster/cluster_conf.h
new file mode 100644
index 0000000..6b797ef
--- /dev/null
+++ b/ctdb/cluster/cluster_conf.h
@@ -0,0 +1,33 @@
+/*
+   CTDB cluster config handling
+
+   Copyright (C) Martin Schwenke  2018
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __CTDB_CLUSTER_CONF_H__
+#define __CTDB_CLUSTER_CONF_H__
+
+#include "common/conf.h"
+
+#define CLUSTER_CONF_SECTION "cluster"
+
+#define CLUSTER_CONF_TRANSPORT       "transport"
+#define CLUSTER_CONF_NODE_ADDRESS    "node address"
+#define CLUSTER_CONF_RECOVERY_LOCK   "recovery lock"
+
+void cluster_conf_init(struct conf_context *conf);
+
+#endif /* __CTDB_CLUSTER_CONF_H__ */
diff --git a/ctdb/common/conf_tool.c b/ctdb/common/conf_tool.c
index 1ee4b02..329b204 100644
--- a/ctdb/common/conf_tool.c
+++ b/ctdb/common/conf_tool.c
@@ -29,6 +29,10 @@
 #include "common/path.h"
 
 #include "common/logging_conf.h"
+#include "cluster/cluster_conf.h"
+#include "database/database_conf.h"
+#include "event/event_conf.h"
+#include "server/legacy_conf.h"
 
 #include "common/conf_tool.h"
 
@@ -236,6 +240,10 @@ int conf_tool_run(struct conf_tool_context *ctx, int *result)
 
 	/* Call functions to initialize config sections/variables */
 	logging_conf_init(ctx->conf, NULL);
+	cluster_conf_init(ctx->conf);
+	database_conf_init(ctx->conf);
+	event_conf_init(ctx->conf);
+	legacy_conf_init(ctx->conf);
 
 	if (! conf_valid(ctx->conf)) {
 		D_ERR("Failed to define configuration options\n");
diff --git a/ctdb/config/ctdb.conf b/ctdb/config/ctdb.conf
new file mode 100644
index 0000000..a9e6f69
--- /dev/null
+++ b/ctdb/config/ctdb.conf
@@ -0,0 +1,17 @@
+# See ctdb.conf(5) for documentation
+#
+# See ctdb-script.options(5) for documentation about event script
+# options
+
+[logging]
+	# Enable logging to syslog
+	# location = syslog
+
+	# Default log level
+	# log level = NOTICE
+
+[cluster]
+	# Shared recovery lock file to avoid split brain.  No default.
+	# Do NOT run CTDB without a recovery lock file unless you know exactly
+	# what you are doing.
+	# recovery lock = /shared/recovery.lock
diff --git a/ctdb/config/ctdbd.conf b/ctdb/config/ctdbd.conf
deleted file mode 100644
index 57cb349..0000000
--- a/ctdb/config/ctdbd.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-# Options to ctdbd, read by ctdbd_wrapper(1)
-#
-# See ctdbd.conf(5) for more information about CTDB configuration variables.
-
-# Shared recovery lock file to avoid split brain.  No default.
-#
-# Do NOT run CTDB without a recovery lock file unless you know exactly
-# what you are doing.
-# CTDB_RECOVERY_LOCK=/some/place/on/shared/storage
-
-# What services should CTDB manage?  Default is none.
-# CTDB_MANAGES_SAMBA=yes
-# CTDB_MANAGES_WINBIND=yes
-# CTDB_MANAGES_NFS=yes
-
-# Default is to use the log file below instead of syslog.
-# CTDB_LOGGING=file:/var/log/log.ctdb
-
-# Default log level is NOTICE.  Want less logging?
-# CTDB_DEBUGLEVEL=ERR
diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper
index e8f0a23..34827ea 100755
--- a/ctdb/config/ctdbd_wrapper
+++ b/ctdb/config/ctdbd_wrapper
@@ -20,75 +20,15 @@ fi
 
 . "${CTDB_BASE}/functions"
 
-loadconfig
+load_system_config "ctdb"
 
 ctdbd="${CTDBD:-/usr/local/sbin/ctdbd}"
 
 ############################################################
 
-# Only the nested function references its arguments
-# shellcheck disable=SC2120
-build_ctdb_options ()
-{
-    ctdb_options=""
-
-    maybe_set ()
-    {
-	# If the given variable isn't set then do nothing
-	[ -n "$2" ] || return
-	# If a required value for the variable and it doesn't match,
-	# then do nothing
-	[ -z "$3" -o "$3" = "$2" ] || return
-
-	val="'$2'"
-	case "$1" in
-	    --*) sep="=" ;;
-	    -*)  sep=" " ;;
-	esac
-	# For these options we're only passing a value-less flag.
-	if [ -n "$3" ] ; then
-	    val=""
-	    sep=""
-	fi
-
-	ctdb_options="${ctdb_options}${ctdb_options:+ }${1}${sep}${val}"
-    }
-
-    # build up ctdb_options variable from optional parameters
-    maybe_set "--reclock"                "$CTDB_RECOVERY_LOCK"
-    maybe_set "--logging"                "$CTDB_LOGGING"
-    maybe_set "--listen"                 "$CTDB_NODE_ADDRESS"
-    maybe_set "--dbdir"                  "$CTDB_DBDIR"
-    maybe_set "--dbdir-persistent"       "$CTDB_DBDIR_PERSISTENT"
-    maybe_set "--dbdir-state"            "$CTDB_DBDIR_STATE"
-    maybe_set "--transport"              "$CTDB_TRANSPORT"
-    maybe_set "-d"                       "$CTDB_DEBUGLEVEL"
-    maybe_set "--start-as-disabled"      "$CTDB_START_AS_DISABLED"    "yes"
-    maybe_set "--start-as-stopped "      "$CTDB_START_AS_STOPPED"     "yes"
-    maybe_set "--no-recmaster"           "$CTDB_CAPABILITY_RECMASTER" "no"
-    maybe_set "--no-lmaster"             "$CTDB_CAPABILITY_LMASTER"   "no"
-    maybe_set "--nosetsched"             "$CTDB_NOSETSCHED"           "yes"
-    maybe_set "--script-log-level"       "$CTDB_SCRIPT_LOG_LEVEL"
-    maybe_set "--max-persistent-check-errors" "$CTDB_MAX_PERSISTENT_CHECK_ERRORS"
-}
-
-export_debug_variables ()
-{
-    [ -n "$CTDB_DEBUG_HUNG_SCRIPT" ] && export CTDB_DEBUG_HUNG_SCRIPT
-    [ -n "$CTDB_DEBUG_LOCKS" ] && export CTDB_DEBUG_LOCKS
-}
-
-############################################################
-
 start()
 {
-    # build_ctdb_options() takes no arguments
-    # shellcheck disable=SC2119
-    build_ctdb_options
-
-    export_debug_variables
-
-    eval "$ctdbd" "$ctdb_options" || return 1
+    eval "$ctdbd" || return 1
 
     # Wait until ctdbd has started and is ready to respond to clients.
     _timeout="${CTDB_STARTUP_TIMEOUT:-10}"
diff --git a/ctdb/config/debug_locks.sh b/ctdb/config/debug_locks.sh
index db02f0c..0867685 100755
--- a/ctdb/config/debug_locks.sh
+++ b/ctdb/config/debug_locks.sh
@@ -12,12 +12,8 @@
 
 . "${CTDB_BASE}/functions"
 
-# Default fallback location for database directories.
-# These can be overwritten from CTDB configuration
-CTDB_DBDIR="${CTDB_VARDIR}/volatile"
-CTDB_DBDIR_PERSISTENT="${CTDB_VARDIR}/persistent"
-
-load_script_options
+# Load/cache database options from configuration file
+ctdb_get_db_options
 
 (
     flock -n 9 || exit 1
diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb
index 272dcb1..8db4a19 100755
--- a/ctdb/config/events.d/00.ctdb
+++ b/ctdb/config/events.d/00.ctdb
@@ -68,8 +68,6 @@ check_persistent_databases ()
     _dir="${CTDB_DBDIR_PERSISTENT:-${CTDB_VARDIR}/persistent}"
     [ -d "$_dir" ] || return 0
 
-    [ "${CTDB_MAX_PERSISTENT_CHECK_ERRORS:-0}" = "0" ] || return 0
-
     for _db in "$_dir/"*.tdb.*[0-9] ; do
 	[ -r "$_db" ] || continue
 	check_tdb "$_db" || \
@@ -135,6 +133,9 @@ init)
 	mkdir -p "$CTDB_SCRIPT_VARDIR" || \
 	    die "mkdir -p ${CTDB_SCRIPT_VARDIR} - failed - $?" $?
 
+	# Load/cache database options from configuration file
+	ctdb_get_db_options
+
 	if select_tdb_checker ; then
 	    check_persistent_databases || exit $?
 	    check_non_persistent_databases
diff --git a/ctdb/config/events.d/01.reclock b/ctdb/config/events.d/01.reclock
index e2e4c0d..e14d8c2 100755
--- a/ctdb/config/events.d/01.reclock
+++ b/ctdb/config/events.d/01.reclock
@@ -10,6 +10,24 @@ load_script_options
 
 ctdb_setup_state_dir "service" "reclock"
 
+ctdb_get_reclock_option ()
+{
+	_reclock_opt_file="${CTDB_SCRIPT_VARDIR}/recovery_lock.cache"
+
+	if [ -f "$_reclock_opt_file" ] ; then
+		. "$_reclock_opt_file"
+		return
+	fi
+
+	ctdb_translate_option "cluster" \
+			      "recovery lock" \
+			      "CTDB_RECOVERY_LOCK" >"$_reclock_opt_file"
+
+	. "$_reclock_opt_file"
+}
+
+ctdb_get_reclock_option
+
 # If CTDB_RECOVERY_LOCK specifies a helper then exit because this
 # script can't do anything useful.
 case "$CTDB_RECOVERY_LOCK" in
diff --git a/ctdb/config/events.d/05.system b/ctdb/config/events.d/05.system
index a902b22..e2ffeac 100755
--- a/ctdb/config/events.d/05.system
+++ b/ctdb/config/events.d/05.system
@@ -169,6 +169,9 @@ END {
 
 case "$1" in
 monitor)
+	# Load/cache database options from configuration file
+	ctdb_get_db_options
+
 	monitor_filesystem_usage
 	monitor_memory_usage
 	;;
diff --git a/ctdb/config/functions b/ctdb/config/functions
index f3d7c16..30afcde 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -44,16 +44,6 @@ load_system_config ()
 	fi
 }
 
-loadconfig() {
-
-	load_system_config "ctdb"
-
-	_config="${CTDB_BASE}/ctdbd.conf"
-	if [ -r "$_config" ] ; then
-		. "$_config"
-	fi
-}
-
 # load_script_options [ component script ]
 #   script is an event script name relative to a component
 #   component is currently ignored
@@ -67,8 +57,6 @@ load_script_options ()
 		die "usage: load_script_options [ component script ]"
 	fi
 
-	loadconfig
-
 	_options="${CTDB_BASE}/script.options"
 
 	if [ -r "$_options" ] ; then
@@ -244,6 +232,43 @@ ctdb_get_ip_address ()
     cat "$_ip_addr_file"
 }
 
+# Cached retrieval of database options for use by event scripts.
+#
+# If the variables are already set then they should not be overwritten
+# - this should only happen during event script testing.
+ctdb_get_db_options ()
+{
+	_db_opts_file="${CTDB_SCRIPT_VARDIR}/db_options.cache"
+
+	if [ ! -f "$_db_opts_file" ] ; then
+		{
+			ctdb_translate_option "database" \
+					      "volatile database directory" \
+					      "CTDB_DBDIR"
+			ctdb_translate_option "database" \
+					      "persistent database directory" \
+					      "CTDB_DBDIR_PERSISTENT"
+			ctdb_translate_option "database" \
+					      "state database directory" \
+					      "CTDB_DBDIR_STATE"
+		} >"$_db_opts_file"
+	fi
+
+	. "$_db_opts_file"
+}
+
+ctdb_translate_option ()
+{
+	_section="$1"
+	_opt="$2"
+	_variable="$3"
+
+	# ctdb-config already prints an error if something goes wrong
+	_t=$("${CTDB_HELPER_BINDIR}/ctdb-config" get "$_section" "$_opt") || \
+		exit $?
+	echo "${_variable}=\"${_t}\""
+}
+
 ######################################################
 # wrapper around /proc/ settings to allow them to be hooked
 # for testing
diff --git a/ctdb/database/database_conf.c b/ctdb/database/database_conf.c
new file mode 100644
index 0000000..0333ce0
--- /dev/null
+++ b/ctdb/database/database_conf.c
@@ -0,0 +1,144 @@
+/*
+   CTDB database config handling
+
+   Copyright (C) Martin Schwenke  2018
+
+   database_conf_validate_lock_debug_script() based on
+   event_conf_validatye_debug_script():
+
+     Copyright (C) Amitay Isaacs  2018


-- 
Samba Shared Repository



More information about the samba-cvs mailing list