Blame SOURCES/bz1732867-CTDB-4-add-v4.9-support.patch

b4b3ce
From 30b9f55325d2acfba27aa6859c7360e10b7201d7 Mon Sep 17 00:00:00 2001
b4b3ce
From: David Disseldorp <ddiss@suse.de>
b4b3ce
Date: Wed, 5 Jun 2019 00:41:13 +0200
b4b3ce
Subject: [PATCH 1/3] CTDB: support Samba 4.9+
b4b3ce
b4b3ce
With Samba 4.9+, all ctdbd parameters have moved to config files.
b4b3ce
Generate a new /etc/ctdb/ctdb.conf file during ctdb startup, based on RA
b4b3ce
configuration.
b4b3ce
b4b3ce
Event scripts in Samba 4.9+ are also no longer enabled/disabled based on
b4b3ce
file mode. Use the "ctdb event script enable/disable" helpers, which now
b4b3ce
work without a running ctdbd.
b4b3ce
b4b3ce
Fixes: https://github.com/ClusterLabs/resource-agents/issues/1196
b4b3ce
Signed-off-by: David Disseldorp <ddiss@suse.de>
b4b3ce
Signed-off-by: Noel Power <noel.power@suse.com>
b4b3ce
Signed-off-by: Amitay Isaacs <amitay@samba.org>
b4b3ce
---
b4b3ce
 heartbeat/CTDB.in | 214 ++++++++++++++++++++++++++++++++++++----------
b4b3ce
 1 file changed, 167 insertions(+), 47 deletions(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/CTDB.in b/heartbeat/CTDB.in
b4b3ce
index 4dd646896..79a2f97e7 100755
b4b3ce
--- a/heartbeat/CTDB.in
b4b3ce
+++ b/heartbeat/CTDB.in
b4b3ce
@@ -143,6 +143,10 @@ OCF_RESKEY_smb_fileid_algorithm_default=""
b4b3ce
 
b4b3ce
 #######################################################################
b4b3ce
 
b4b3ce
+ctdb_version() {
b4b3ce
+	$OCF_RESKEY_ctdb_binary version | awk '{print $NF}' | sed "s/[-\.]\?[[:alpha:]].*//"
b4b3ce
+}
b4b3ce
+
b4b3ce
 meta_data() {
b4b3ce
 	cat <
b4b3ce
 
b4b3ce
@@ -256,7 +260,7 @@ host any public ip addresses.
b4b3ce
 <longdesc lang="en">
b4b3ce
 The directory containing various CTDB configuration files.
b4b3ce
 The "nodes" and "notify.sh" scripts are expected to be
b4b3ce
-in this directory, as is the "events.d" subdirectory.
b4b3ce
+in this directory.
b4b3ce
 </longdesc>
b4b3ce
 <shortdesc lang="en">CTDB config file directory</shortdesc>
b4b3ce
 <content type="string" default="/etc/ctdb" />
b4b3ce
@@ -282,8 +286,10 @@ Full path to the CTDB cluster daemon binary.
b4b3ce
 <longdesc lang="en">
b4b3ce
 Full path to the domain socket that ctdbd will create, used for
b4b3ce
 local clients to attach and communicate with the ctdb daemon.
b4b3ce
+With CTDB 4.9.0 and later the socket path is hardcoded at build
b4b3ce
+time, so this parameter is ignored.
b4b3ce
 </longdesc>
b4b3ce
-<shortdesc lang="en">CTDB socket location</shortdesc>
b4b3ce
+<shortdesc lang="en">CTDB socket location (ignored with CTDB 4.9+)</shortdesc>
b4b3ce
 <content type="string" default="${OCF_RESKEY_ctdb_socket}" />
b4b3ce
 </parameter>
b4b3ce
 
b4b3ce
@@ -421,16 +427,28 @@ invoke_ctdb() {
b4b3ce
 		timeout=$((OCF_RESKEY_CRM_meta_timeout/1000))
b4b3ce
 		timelimit=$((OCF_RESKEY_CRM_meta_timeout/1000))
b4b3ce
 	fi
b4b3ce
-	$OCF_RESKEY_ctdb_binary --socket="$OCF_RESKEY_ctdb_socket" \
b4b3ce
-		-t $timeout -T $timelimit \
b4b3ce
-		"$@"
b4b3ce
+
b4b3ce
+	local vers=$(ctdb_version)
b4b3ce
+	ocf_version_cmp "$vers" "4.9.0"
b4b3ce
+
b4b3ce
+	# if version < 4.9.0 specify '--socket' otherwise it's
b4b3ce
+	# a compiled option
b4b3ce
+	if [ "$?" -eq "0" ]; then
b4b3ce
+		$OCF_RESKEY_ctdb_binary --socket="$OCF_RESKEY_ctdb_socket" \
b4b3ce
+			-t $timeout -T $timelimit \
b4b3ce
+			"$@"
b4b3ce
+	else
b4b3ce
+		$OCF_RESKEY_ctdb_binary \
b4b3ce
+			-t $timeout -T $timelimit \
b4b3ce
+			"$@"
b4b3ce
+	fi
b4b3ce
 }
b4b3ce
 
b4b3ce
 # Enable any event scripts that are explicitly required.
b4b3ce
 # Any others will ultimately be invoked or not based on how they ship
b4b3ce
 # with CTDB, but will generally have no effect, beacuase the relevant
b4b3ce
 # CTDB_MANAGES_* options won't be set in /etc/sysconfig/ctdb.
b4b3ce
-enable_event_scripts() {
b4b3ce
+enable_event_scripts_chmod() {
b4b3ce
 	local event_dir
b4b3ce
 	event_dir=$OCF_RESKEY_ctdb_config_dir/events.d
b4b3ce
 
b4b3ce
@@ -454,6 +472,36 @@ enable_event_scripts() {
b4b3ce
 	fi
b4b3ce
 }
b4b3ce
 
b4b3ce
+enable_event_scripts_symlink() {
b4b3ce
+	# event scripts are symlinked once enabled, with the link source in...
b4b3ce
+	mkdir -p "$OCF_RESKEY_ctdb_config_dir/events/legacy" 2>/dev/null
b4b3ce
+
b4b3ce
+	invoke_ctdb event script enable legacy 00.ctdb
b4b3ce
+
b4b3ce
+	if [ -f "${OCF_RESKEY_ctdb_config_dir}/public_addresses" ]; then
b4b3ce
+		invoke_ctdb event script enable legacy 10.interface
b4b3ce
+	else
b4b3ce
+		invoke_ctdb event script disable legacy 10.interface
b4b3ce
+	fi
b4b3ce
+	if [ -f "${OCF_RESKEY_ctdb_config_dir}/static-routes" ]; then
b4b3ce
+		invoke_ctdb event script enable legacy 11.routing
b4b3ce
+	else
b4b3ce
+		invoke_ctdb event script disable legacy 11.routing
b4b3ce
+	fi
b4b3ce
+
b4b3ce
+	if ocf_is_true "$OCF_RESKEY_ctdb_manages_winbind"; then
b4b3ce
+		invoke_ctdb event script enable legacy 49.winbind
b4b3ce
+	else
b4b3ce
+		invoke_ctdb event script disable legacy 49.winbind
b4b3ce
+	fi
b4b3ce
+
b4b3ce
+	if ocf_is_true "$OCF_RESKEY_ctdb_manages_samba"; then
b4b3ce
+		invoke_ctdb event script enable legacy 50.samba
b4b3ce
+	else
b4b3ce
+		invoke_ctdb event script disable legacy 50.samba
b4b3ce
+	fi
b4b3ce
+}
b4b3ce
+
b4b3ce
 # This function has no effect (currently no way to set CTDB_SET_*)
b4b3ce
 # but remains here in case we need it in future.
b4b3ce
 set_ctdb_variables() {
b4b3ce
@@ -556,6 +604,46 @@ append_ctdb_sysconfig() {
b4b3ce
 	[ -n "$2" ] && echo "$1=$2" >> "$CTDB_SYSCONFIG"
b4b3ce
 }
b4b3ce
 
b4b3ce
+generate_ctdb_config() {
b4b3ce
+	local ctdb_config="$OCF_RESKEY_ctdb_config_dir/ctdb.conf"
b4b3ce
+
b4b3ce
+	# Backup existing config if we're not already using an auto-generated one
b4b3ce
+	grep -qa '# CTDB-RA: Auto-generated' $ctdb_config || cp -p $ctdb_config ${ctdb_config}.ctdb-ra-orig
b4b3ce
+	if [ $? -ne 0 ]; then
b4b3ce
+		ocf_log warn "Unable to backup $ctdb_config to ${ctdb_config}.ctdb-ra-orig"
b4b3ce
+	fi
b4b3ce
+
b4b3ce
+	local log_option="file:$OCF_RESKEY_ctdb_logfile"
b4b3ce
+	if [ "$OCF_RESKEY_ctdb_logfile" = "syslog" ]; then
b4b3ce
+		log_option="syslog"
b4b3ce
+	fi
b4b3ce
+
b4b3ce
+	local start_as_disabled="false"
b4b3ce
+	ocf_is_true "$OCF_RESKEY_ctdb_start_as_disabled" && start_as_disabled="true"
b4b3ce
+
b4b3ce
+	local dbdir_volatile="$OCF_RESKEY_ctdb_dbdir/volatile"
b4b3ce
+	[ -d "$dbdir_volatile" ] || mkdir -p "$dbdir_volatile" 2>/dev/null
b4b3ce
+	local dbdir_persistent="$OCF_RESKEY_ctdb_dbdir/persistent"
b4b3ce
+	[ -d "$dbdir_persistent" ] || mkdir -p "$dbdir_persistent" 2>/dev/null
b4b3ce
+	local dbdir_state="$OCF_RESKEY_ctdb_dbdir/state"
b4b3ce
+	[ -d "$dbdir_state" ] || mkdir -p "$dbdir_state" 2>/dev/null
b4b3ce
+
b4b3ce
+cat >$ctdb_config <
b4b3ce
+# CTDB-RA: Auto-generated
b4b3ce
+[logging]
b4b3ce
+	location = $log_option
b4b3ce
+	log level = $OCF_RESKEY_ctdb_debuglevel
b4b3ce
+[cluster]
b4b3ce
+	recovery lock = $OCF_RESKEY_ctdb_recovery_lock
b4b3ce
+[database]
b4b3ce
+	volatile database directory = $dbdir_volatile
b4b3ce
+	persistent database directory = $dbdir_persistent
b4b3ce
+	state database directory = $dbdir_state
b4b3ce
+[legacy]
b4b3ce
+	start as disabled = $start_as_disabled
b4b3ce
+EOF
b4b3ce
+}
b4b3ce
+
b4b3ce
 # Generate a new, minimal CTDB config file that's just enough
b4b3ce
 # to get CTDB running as configured by the RA parameters.
b4b3ce
 generate_ctdb_sysconfig() {
b4b3ce
@@ -589,6 +677,58 @@ EOF
b4b3ce
 }
b4b3ce
 
b4b3ce
 
b4b3ce
+invoke_ctdbd() {
b4b3ce
+	local vers="$1"
b4b3ce
+
b4b3ce
+	ocf_version_cmp "$vers" "4.9.0"
b4b3ce
+	if [ "$?" -ne "0" ]; then
b4b3ce
+		# With 4.9+, all ctdbd binary parameters are provided as
b4b3ce
+		# config settings
b4b3ce
+		$OCF_RESKEY_ctdbd_binary
b4b3ce
+		return
b4b3ce
+	fi
b4b3ce
+
b4b3ce
+	# Use logfile by default, or syslog if asked for
b4b3ce
+	local log_option
b4b3ce
+	# --logging supported from v4.3.0 and --logfile / --syslog support
b4b3ce
+	# has been removed from newer versions
b4b3ce
+	ocf_version_cmp "$vers" "4.2.14"
b4b3ce
+	if [ "$?" -eq "2" ]; then
b4b3ce
+		log_option="--logging=file:$OCF_RESKEY_ctdb_logfile"
b4b3ce
+		if [ "$OCF_RESKEY_ctdb_logfile" = "syslog" ]; then
b4b3ce
+			log_option="--logging=syslog"
b4b3ce
+		fi
b4b3ce
+	else
b4b3ce
+		log_option="--logfile=$OCF_RESKEY_ctdb_logfile"
b4b3ce
+		if [ "$OCF_RESKEY_ctdb_logfile" = "syslog" ]; then
b4b3ce
+			log_option="--syslog"
b4b3ce
+		fi
b4b3ce
+	fi
b4b3ce
+
b4b3ce
+	# public addresses file (should not be present, but need to set for correctness if it is)
b4b3ce
+	local pub_addr_option
b4b3ce
+	pub_addr_option=""
b4b3ce
+	[ -f "${OCF_RESKEY_ctdb_config_dir}/public_addresses" ] && \
b4b3ce
+		pub_addr_option="--public-addresses=${OCF_RESKEY_ctdb_config_dir}/public_addresses"
b4b3ce
+	# start as disabled
b4b3ce
+	local start_as_disabled
b4b3ce
+	start_as_disabled="--start-as-disabled"
b4b3ce
+	ocf_is_true "$OCF_RESKEY_ctdb_start_as_disabled" || start_as_disabled=""
b4b3ce
+
b4b3ce
+	$OCF_RESKEY_ctdbd_binary \
b4b3ce
+		--reclock="$OCF_RESKEY_ctdb_recovery_lock" \
b4b3ce
+		--nlist="$OCF_RESKEY_ctdb_config_dir/nodes" \
b4b3ce
+		--socket="$OCF_RESKEY_ctdb_socket" \
b4b3ce
+		--dbdir="$OCF_RESKEY_ctdb_dbdir" \
b4b3ce
+		--dbdir-persistent="$OCF_RESKEY_ctdb_dbdir/persistent" \
b4b3ce
+		--event-script-dir="$OCF_RESKEY_ctdb_config_dir/events.d" \
b4b3ce
+		--notification-script="$OCF_RESKEY_ctdb_config_dir/notify.sh" \
b4b3ce
+		--transport=tcp \
b4b3ce
+		$start_as_disabled $log_option $pub_addr_option \
b4b3ce
+		-d "$OCF_RESKEY_ctdb_debuglevel"
b4b3ce
+}
b4b3ce
+
b4b3ce
+
b4b3ce
 ctdb_usage() {
b4b3ce
 	cat <
b4b3ce
 usage: $0 {start|stop|monitor|validate-all|meta-data}
b4b3ce
@@ -614,27 +754,26 @@ ctdb_start() {
b4b3ce
 		return $OCF_ERR_GENERIC
b4b3ce
 	fi
b4b3ce
 
b4b3ce
-	# Generate new CTDB sysconfig
b4b3ce
-	generate_ctdb_sysconfig
b4b3ce
-	enable_event_scripts
b4b3ce
+	local version=$(ctdb_version)
b4b3ce
 
b4b3ce
-	# Use logfile by default, or syslog if asked for
b4b3ce
-	local log_option
b4b3ce
-	# --logging supported from v4.3.0 and --logfile / --syslog support 
b4b3ce
-	# has been removed from newer versions
b4b3ce
-	version=$(ctdb version | awk '{print $NF}')
b4b3ce
-	ocf_version_cmp "$version" "4.2.14"
b4b3ce
-	if [ "$?" -eq "2" ]; then
b4b3ce
-		log_option="--logging=file:$OCF_RESKEY_ctdb_logfile"
b4b3ce
-		if [ "$OCF_RESKEY_ctdb_logfile" = "syslog" ]; then
b4b3ce
-			log_option="--logging=syslog"
b4b3ce
-		fi
b4b3ce
+	ocf_version_cmp "$version" "4.9.0"
b4b3ce
+	if [ "$?" -eq "0" ]; then
b4b3ce
+		# prior to 4.9, ctdbd parameters are in sysconfig or passed as
b4b3ce
+		# binary arguments
b4b3ce
+		generate_ctdb_sysconfig
b4b3ce
+
b4b3ce
+		# prior to 4.9, event script enablement without a running
b4b3ce
+		# ctdbd is done by chmoding the scripts directly
b4b3ce
+		enable_event_scripts_chmod
b4b3ce
 	else
b4b3ce
-		log_option="--logfile=$OCF_RESKEY_ctdb_logfile"
b4b3ce
-		if [ "$OCF_RESKEY_ctdb_logfile" = "syslog" ]; then
b4b3ce
-			log_option="--syslog"
b4b3ce
-		fi
b4b3ce
+		# 4.9+ moves all ctdbd parameters to ctdb.conf
b4b3ce
+		generate_ctdb_config
b4b3ce
+
b4b3ce
+		# 4.9+ event scripts can be enabled with ctdb directly, which
b4b3ce
+		# performs a symlink
b4b3ce
+		enable_event_scripts_symlink
b4b3ce
 	fi
b4b3ce
+
b4b3ce
 	if [ ! -d "$(dirname $OCF_RESKEY_ctdb_logfile)" ]; then
b4b3ce
 		# ensure the logfile's directory exists, otherwise ctdb will fail to start
b4b3ce
 		mkdir -p $(dirname $OCF_RESKEY_ctdb_logfile)
b4b3ce
@@ -643,33 +782,14 @@ ctdb_start() {
b4b3ce
 	# ensure ctdb's rundir exists, otherwise it will fail to start
b4b3ce
 	mkdir -p $OCF_RESKEY_ctdb_rundir 2>/dev/null
b4b3ce
 
b4b3ce
-	# public addresses file (should not be present, but need to set for correctness if it is)
b4b3ce
-	local pub_addr_option
b4b3ce
-	pub_addr_option=""
b4b3ce
-	[ -f "${OCF_RESKEY_ctdb_config_dir}/public_addresses" ] && \
b4b3ce
-		pub_addr_option="--public-addresses=${OCF_RESKEY_ctdb_config_dir}/public_addresses"
b4b3ce
-	# start as disabled
b4b3ce
-	local start_as_disabled
b4b3ce
-	start_as_disabled="--start-as-disabled"
b4b3ce
-	ocf_is_true "$OCF_RESKEY_ctdb_start_as_disabled" || start_as_disabled=""
b4b3ce
-
b4b3ce
 	# set nofile ulimit for ctdbd process
b4b3ce
 	if [ -n "$OCF_RESKEY_ctdb_max_open_files" ]; then
b4b3ce
 		ulimit -n "$OCF_RESKEY_ctdb_max_open_files"
b4b3ce
 	fi
b4b3ce
 
b4b3ce
 	# Start her up
b4b3ce
-	"$OCF_RESKEY_ctdbd_binary" \
b4b3ce
-		--reclock="$OCF_RESKEY_ctdb_recovery_lock" \
b4b3ce
-		--nlist="$OCF_RESKEY_ctdb_config_dir/nodes" \
b4b3ce
-		--socket="$OCF_RESKEY_ctdb_socket" \
b4b3ce
-		--dbdir="$OCF_RESKEY_ctdb_dbdir" \
b4b3ce
-		--dbdir-persistent="$OCF_RESKEY_ctdb_dbdir/persistent" \
b4b3ce
-		--event-script-dir="$OCF_RESKEY_ctdb_config_dir/events.d" \
b4b3ce
-		--notification-script="$OCF_RESKEY_ctdb_config_dir/notify.sh" \
b4b3ce
-		--transport=tcp \
b4b3ce
-		$start_as_disabled $log_option $pub_addr_option \
b4b3ce
-		-d "$OCF_RESKEY_ctdb_debuglevel"
b4b3ce
+	invoke_ctdbd "$version"
b4b3ce
+
b4b3ce
 	if [ $? -ne 0 ]; then
b4b3ce
 		# cleanup smb.conf
b4b3ce
 		cleanup_smb_conf
b4b3ce
@@ -688,7 +808,7 @@ ctdb_start() {
b4b3ce
 			if [ $? -ne 0 ]; then
b4b3ce
 				# CTDB will be running, kill it before returning
b4b3ce
 				ctdb_stop
b4b3ce
-				ocf_exit_reason "Can't invoke $OCF_RESKEY_ctdb_binary --socket=$OCF_RESKEY_ctdb_socket status"
b4b3ce
+				ocf_exit_reason "Can't invoke $OCF_RESKEY_ctdb_binary status"
b4b3ce
 				return $OCF_ERR_GENERIC
b4b3ce
 			fi
b4b3ce
 			if ! echo "$status" | grep -qs 'UNHEALTHY (THIS'; then
b4b3ce
@@ -725,7 +845,7 @@ ctdb_stop() {
b4b3ce
 		[ $count -gt 10 ] && {
b4b3ce
 			ocf_log info "killing ctdbd "
b4b3ce
 			pkill -9 -f "$OCF_RESKEY_ctdbd_binary"
b4b3ce
-			pkill -9 -f "${OCF_RESKEY_ctdb_config_dir}/events.d/"
b4b3ce
+			pkill -9 -f "${OCF_RESKEY_ctdb_config_dir}/events"
b4b3ce
 		}
b4b3ce
 	done
b4b3ce
 
b4b3ce
b4b3ce
From b4753b7cb46045bb9e7ed5e3a0a20f6104264b12 Mon Sep 17 00:00:00 2001
b4b3ce
From: David Disseldorp <ddiss@suse.de>
b4b3ce
Date: Wed, 10 Jul 2019 17:11:50 +0200
b4b3ce
Subject: [PATCH 2/3] CTDB: generate script.options file for 4.9+
b4b3ce
b4b3ce
Event scripts in CTDB 4.9+ ignore sysconfig configuration and instead
b4b3ce
parse parameters in ctdb_config_dir/script.options .
b4b3ce
b4b3ce
Signed-off-by: David Disseldorp <ddiss@suse.de>
b4b3ce
---
b4b3ce
 heartbeat/CTDB.in | 35 ++++++++++++++++++++++++++++++-----
b4b3ce
 1 file changed, 30 insertions(+), 5 deletions(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/CTDB.in b/heartbeat/CTDB.in
b4b3ce
index 79a2f97e7..0906f3da9 100755
b4b3ce
--- a/heartbeat/CTDB.in
b4b3ce
+++ b/heartbeat/CTDB.in
b4b3ce
@@ -242,6 +242,7 @@ If the amount of free memory drops below this value the node will
b4b3ce
 become unhealthy and ctdb and all managed services will be shutdown.
b4b3ce
 Once this occurs, the administrator needs to find the reason for the
b4b3ce
 OOM situation, rectify it and restart ctdb with "service ctdb start".
b4b3ce
+With CTDB 4.4.0 and later this parameter is ignored.
b4b3ce
 </longdesc>
b4b3ce
 <shortdesc lang="en">Minimum amount of free memory (MB)</shortdesc>
b4b3ce
 <content type="integer" default="${OCF_RESKEY_ctdb_monitor_free_memory_default}" />
b4b3ce
@@ -600,8 +601,10 @@ cleanup_smb_conf() {
b4b3ce
 	mv "$OCF_RESKEY_smb_conf.$$" "$OCF_RESKEY_smb_conf"
b4b3ce
 }
b4b3ce
 
b4b3ce
-append_ctdb_sysconfig() {
b4b3ce
-	[ -n "$2" ] && echo "$1=$2" >> "$CTDB_SYSCONFIG"
b4b3ce
+append_conf() {
b4b3ce
+	local file_path="$1"
b4b3ce
+	shift
b4b3ce
+	[ -n "$2" ] && echo "$1=$2" >> "$file_path"
b4b3ce
 }
b4b3ce
 
b4b3ce
 generate_ctdb_config() {
b4b3ce
@@ -644,6 +647,25 @@ cat >$ctdb_config <
b4b3ce
 EOF
b4b3ce
 }
b4b3ce
 
b4b3ce
+generate_event_script_options() {
b4b3ce
+	local script_options="$OCF_RESKEY_ctdb_config_dir/script.options"
b4b3ce
+
b4b3ce
+	# Backup existing config if we're not already using an auto-generated one
b4b3ce
+	grep -qa '# CTDB-RA: Auto-generated' $script_options || cp -p $script_options ${script_options}.ctdb-ra-orig
b4b3ce
+	if [ $? -ne 0 ]; then
b4b3ce
+		ocf_log warn "Unable to backup $script_options to ${script_options}.ctdb-ra-orig"
b4b3ce
+	fi
b4b3ce
+
b4b3ce
+cat >$script_options <
b4b3ce
+# CTDB-RA: Auto-generated
b4b3ce
+CTDB_SAMBA_SKIP_SHARE_CHECK=$(ocf_is_true "$OCF_RESKEY_ctdb_samba_skip_share_check" && echo 'yes' || echo 'no')
b4b3ce
+EOF
b4b3ce
+
b4b3ce
+	append_conf "$script_options" CTDB_SERVICE_SMB $OCF_RESKEY_ctdb_service_smb
b4b3ce
+	append_conf "$script_options" CTDB_SERVICE_NMB $OCF_RESKEY_ctdb_service_nmb
b4b3ce
+	append_conf "$script_options" CTDB_SERVICE_WINBIND $OCF_RESKEY_ctdb_service_winbind
b4b3ce
+}
b4b3ce
+
b4b3ce
 # Generate a new, minimal CTDB config file that's just enough
b4b3ce
 # to get CTDB running as configured by the RA parameters.
b4b3ce
 generate_ctdb_sysconfig() {
b4b3ce
@@ -671,9 +693,9 @@ CTDB_SAMBA_SKIP_SHARE_CHECK=$(ocf_is_true "$OCF_RESKEY_ctdb_samba_skip_share_che
b4b3ce
 CTDB_MANAGES_SAMBA=$(ocf_is_true "$OCF_RESKEY_ctdb_manages_samba" && echo 'yes' || echo 'no')
b4b3ce
 CTDB_MANAGES_WINBIND=$(ocf_is_true "$OCF_RESKEY_ctdb_manages_winbind" && echo 'yes' || echo 'no')
b4b3ce
 EOF
b4b3ce
-	append_ctdb_sysconfig CTDB_SERVICE_SMB $OCF_RESKEY_ctdb_service_smb
b4b3ce
-	append_ctdb_sysconfig CTDB_SERVICE_NMB $OCF_RESKEY_ctdb_service_nmb
b4b3ce
-	append_ctdb_sysconfig CTDB_SERVICE_WINBIND $OCF_RESKEY_ctdb_service_winbind
b4b3ce
+	append_conf "$CTDB_SYSCONFIG" CTDB_SERVICE_SMB $OCF_RESKEY_ctdb_service_smb
b4b3ce
+	append_conf "$CTDB_SYSCONFIG" CTDB_SERVICE_NMB $OCF_RESKEY_ctdb_service_nmb
b4b3ce
+	append_conf "$CTDB_SYSCONFIG" CTDB_SERVICE_WINBIND $OCF_RESKEY_ctdb_service_winbind
b4b3ce
 }
b4b3ce
 
b4b3ce
 
b4b3ce
@@ -769,6 +791,9 @@ ctdb_start() {
b4b3ce
 		# 4.9+ moves all ctdbd parameters to ctdb.conf
b4b3ce
 		generate_ctdb_config
b4b3ce
 
b4b3ce
+		# 4.9+ event script options are in script.options
b4b3ce
+		generate_event_script_options
b4b3ce
+
b4b3ce
 		# 4.9+ event scripts can be enabled with ctdb directly, which
b4b3ce
 		# performs a symlink
b4b3ce
 		enable_event_scripts_symlink
b4b3ce
b4b3ce
From 0a8610711f90c4cc7a2b380a4795f463532d9520 Mon Sep 17 00:00:00 2001
b4b3ce
From: David Disseldorp <ddiss@suse.de>
b4b3ce
Date: Wed, 10 Jul 2019 17:54:01 +0200
b4b3ce
Subject: [PATCH 3/3] CTDB: drop sysconfig presence check during validate
b4b3ce
b4b3ce
There are two reasons to avoid this check:
b4b3ce
- for ctdb versions prior to 4.9.0, the sysconfig file is generated by
b4b3ce
  the resource agent start hook *after* ctdb_validate() is called.
b4b3ce
- post 4.9.0 versions don't use the sysconfig file.
b4b3ce
b4b3ce
Signed-off-by: David Disseldorp <ddiss@suse.de>
b4b3ce
---
b4b3ce
 heartbeat/CTDB.in | 5 -----
b4b3ce
 1 file changed, 5 deletions(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/CTDB.in b/heartbeat/CTDB.in
b4b3ce
index 0906f3da9..15d78902e 100755
b4b3ce
--- a/heartbeat/CTDB.in
b4b3ce
+++ b/heartbeat/CTDB.in
b4b3ce
@@ -925,11 +925,6 @@ ctdb_validate() {
b4b3ce
 		check_binary $binary
b4b3ce
 	done
b4b3ce
 
b4b3ce
-	if [ -z "$CTDB_SYSCONFIG" ]; then
b4b3ce
-		ocf_exit_reason "Can't find CTDB config file (expecting /etc/sysconfig/ctdb, /etc/default/ctdb or similar)"
b4b3ce
-		return $OCF_ERR_INSTALLED
b4b3ce
-	fi
b4b3ce
-
b4b3ce
 	if ocf_is_true "$OCF_RESKEY_ctdb_manages_samba" && [ ! -f "$OCF_RESKEY_smb_conf" ]; then
b4b3ce
 		ocf_exit_reason "Samba config file '$OCF_RESKEY_smb_conf' does not exist."
b4b3ce
 		return $OCF_ERR_INSTALLED