mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
ctdb-scripts: Use ctdb_setup_state_dir()
Replace all uses of ctdb_setup_service_state_dir() by ctdb_setup_state_dir(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
fac6d23d27
commit
eed0e3f6d7
@ -8,7 +8,7 @@
|
||||
|
||||
loadconfig
|
||||
|
||||
service_state_dir=$(ctdb_setup_service_state_dir "system-monitoring") || exit $?
|
||||
ctdb_setup_state_dir "service" "system-monitoring"
|
||||
|
||||
validate_percentage ()
|
||||
{
|
||||
@ -38,7 +38,9 @@ check_thresholds ()
|
||||
esac
|
||||
|
||||
_t=$(echo "$_thing" | sed -e 's@/@SLASH_@g' -e 's@ @_@g')
|
||||
_cache="${service_state_dir}/cache_${_t}"
|
||||
# script_state_dir set by ctdb_setup_state_dir()
|
||||
# shellcheck disable=SC2154
|
||||
_cache="${script_state_dir}/cache_${_t}"
|
||||
if validate_percentage "$_unhealthy_threshold" "$_thing" ; then
|
||||
if [ "$_usage" -ge "$_unhealthy_threshold" ] ; then
|
||||
echo "ERROR: ${_thing} utilization ${_usage}% >= threshold ${_unhealthy_threshold}%"
|
||||
@ -70,7 +72,7 @@ check_thresholds ()
|
||||
|
||||
set_monitor_filsystem_usage_defaults ()
|
||||
{
|
||||
_fs_defaults_cache="${service_state_dir}/cache_monitor_filsystem_usage_defaults"
|
||||
_fs_defaults_cache="${script_state_dir}/cache_filsystem_usage_defaults"
|
||||
|
||||
if [ ! -r "$_fs_defaults_cache" ] ; then
|
||||
# Determine filesystem for each database directory, generate
|
||||
|
@ -6,12 +6,11 @@
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
# service_name is used by various functions
|
||||
# shellcheck disable=SC2034
|
||||
service_name="nfs"
|
||||
|
||||
loadconfig
|
||||
service_state_dir=$(ctdb_setup_service_state_dir) || exit $?
|
||||
|
||||
ctdb_setup_state_dir "service" "$service_name"
|
||||
|
||||
######################################################################
|
||||
|
||||
@ -25,7 +24,9 @@ nfs_callout_pre ()
|
||||
|
||||
######################################################################
|
||||
|
||||
nfs_callout_init "$service_state_dir"
|
||||
# script_state_dir set by ctdb_setup_state_dir()
|
||||
# shellcheck disable=SC2154
|
||||
nfs_callout_init "$script_state_dir"
|
||||
|
||||
is_ctdb_managed_service || exit 0
|
||||
|
||||
|
@ -10,20 +10,20 @@
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
# service_name is used by various functions
|
||||
# shellcheck disable=SC2034
|
||||
service_name=natgw
|
||||
service_name="natgw"
|
||||
|
||||
loadconfig
|
||||
|
||||
[ -n "$CTDB_NATGW_NODES" ] || exit 0
|
||||
export CTDB_NATGW_NODES
|
||||
|
||||
service_state_dir=$(ctdb_setup_service_state_dir) || exit $?
|
||||
ctdb_setup_state_dir "failover" "$service_name"
|
||||
|
||||
natgw_cfg_new="${service_state_dir}/cfg_new"
|
||||
natgw_cfg_old="${service_state_dir}/cfg_old"
|
||||
natgw_master_old="${service_state_dir}/master_old"
|
||||
# script_state_dir set by ctdb_setup_state_dir()
|
||||
# shellcheck disable=SC2154
|
||||
natgw_cfg_new="${script_state_dir}/cfg_new"
|
||||
natgw_cfg_old="${script_state_dir}/cfg_old"
|
||||
natgw_master_old="${script_state_dir}/master_old"
|
||||
|
||||
ctdb_natgw_slave_only ()
|
||||
{
|
||||
|
@ -7,9 +7,7 @@
|
||||
|
||||
loadconfig
|
||||
|
||||
# service_name is used by various functions
|
||||
# shellcheck disable=SC2034
|
||||
service_name=per_ip_routing
|
||||
service_name="per_ip_routing"
|
||||
|
||||
# Do nothing if unconfigured
|
||||
[ -n "$CTDB_PER_IP_ROUTING_CONF" ] || exit 0
|
||||
@ -36,7 +34,7 @@ if ! have_link_local_config && [ ! -r "$CTDB_PER_IP_ROUTING_CONF" ] ; then
|
||||
die "error: CTDB_PER_IP_ROUTING_CONF=$CTDB_PER_IP_ROUTING_CONF file not found"
|
||||
fi
|
||||
|
||||
service_state_dir=$(ctdb_setup_service_state_dir) || exit $?
|
||||
ctdb_setup_state_dir "failover" "$service_name"
|
||||
|
||||
######################################################################
|
||||
|
||||
@ -105,7 +103,9 @@ ipv4_host_addr_to_net ()
|
||||
ensure_rt_tables ()
|
||||
{
|
||||
rt_tables="$CTDB_SYS_ETCDIR/iproute2/rt_tables"
|
||||
rt_tables_lock="${service_state_dir}/rt_tables_lock"
|
||||
# script_state_dir set by ctdb_setup_state_dir()
|
||||
# shellcheck disable=SC2154
|
||||
rt_tables_lock="${script_state_dir}/rt_tables_lock"
|
||||
|
||||
# This file should always exist. Even if this didn't exist on the
|
||||
# system, adding a route will have created it. What if we startup
|
||||
|
@ -11,17 +11,17 @@
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
# service_name is used by various functions
|
||||
# shellcheck disable=SC2034
|
||||
service_name="multipathd"
|
||||
|
||||
loadconfig
|
||||
|
||||
[ -n "$CTDB_MONITOR_MPDEVICES" ] || exit 0
|
||||
|
||||
service_state_dir=$(ctdb_setup_service_state_dir) || exit $?
|
||||
ctdb_setup_state_dir "service" "$service_name"
|
||||
|
||||
multipath_fail="${service_state_dir}/fail"
|
||||
# script_state_dir set by ctdb_setup_state_dir()
|
||||
# shellcheck disable=SC2154
|
||||
multipath_fail="${script_state_dir}/fail"
|
||||
|
||||
multipathd_check_background()
|
||||
{
|
||||
|
@ -24,13 +24,11 @@ case $CTDB_INIT_STYLE in
|
||||
;;
|
||||
esac
|
||||
|
||||
# service_name is used by various functions
|
||||
# shellcheck disable=SC2034
|
||||
service_name="samba"
|
||||
|
||||
loadconfig
|
||||
|
||||
service_state_dir=$(ctdb_setup_service_state_dir) || exit $?
|
||||
ctdb_setup_state_dir "service" "$service_name"
|
||||
|
||||
service_start ()
|
||||
{
|
||||
@ -75,7 +73,9 @@ service_stop ()
|
||||
# Show the testparm output using a cached smb.conf to avoid delays due
|
||||
# to registry access.
|
||||
|
||||
smbconf_cache="$service_state_dir/smb.conf.cache"
|
||||
# script_state_dir set by ctdb_setup_state_dir()
|
||||
# shellcheck disable=SC2154
|
||||
smbconf_cache="$script_state_dir/smb.conf.cache"
|
||||
|
||||
testparm_foreground_update ()
|
||||
{
|
||||
|
@ -6,12 +6,11 @@
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
# service_name is used by various functions
|
||||
# shellcheck disable=SC2034
|
||||
service_name="nfs"
|
||||
|
||||
loadconfig
|
||||
service_state_dir=$(ctdb_setup_service_state_dir) || exit $?
|
||||
|
||||
ctdb_setup_state_dir "service" "$service_name"
|
||||
|
||||
######################################################################
|
||||
|
||||
@ -250,7 +249,9 @@ nfs_update_lock_info ()
|
||||
|
||||
######################################################################
|
||||
|
||||
nfs_callout_init "$service_state_dir"
|
||||
# script_state_dir set by ctdb_setup_state_dir()
|
||||
# shellcheck disable=SC2154
|
||||
nfs_callout_init "$script_state_dir"
|
||||
|
||||
is_ctdb_managed_service || exit 0
|
||||
|
||||
|
@ -28,10 +28,14 @@ loadconfig nfs
|
||||
|
||||
############################################################
|
||||
|
||||
service_state_dir=$(ctdb_setup_service_state_dir "statd-callout") || exit $?
|
||||
ctdb_setup_state_dir "service" "nfs"
|
||||
|
||||
cd "$service_state_dir" || \
|
||||
die "Failed to change directory to \"${service_state_dir}\""
|
||||
# script_state_dir set by ctdb_setup_state_dir()
|
||||
# shellcheck disable=SC2154
|
||||
d="${script_state_dir}/statd-callout"
|
||||
|
||||
mkdir -p "$d" || die "Failed to create directory \"${d}\""
|
||||
cd "$d" || die "Failed to change directory to \"${d}\""
|
||||
|
||||
pnn=$(ctdb_get_pnn)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user