mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
ctdb-scripts: Tunables are now loaded from ctdb.tunables
Using CTDB_SET_TunableVariables in the main configuration file is no longer supported. The only subtlety is an unexpected order change in one of the unit test results. This is because the old implementation implicitly sorted the tunable variables via the set command. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
1db96ce26e
commit
02fc52d69b
2
ctdb/config/ctdb.tunables
Normal file
2
ctdb/config/ctdb.tunables
Normal file
@ -0,0 +1,2 @@
|
||||
# Set some CTDB tunable variables during CTDB startup?
|
||||
# MutexEnabled=0
|
@ -21,6 +21,3 @@
|
||||
|
||||
# Default log level is NOTICE. Want less logging?
|
||||
# CTDB_DEBUGLEVEL=ERR
|
||||
|
||||
# Set some CTDB tunable variables during CTDB startup?
|
||||
# CTDB_SET_TDBMutexEnabled=0
|
||||
|
@ -105,18 +105,23 @@ EOF
|
||||
|
||||
set_ctdb_variables ()
|
||||
{
|
||||
# set any tunables from the config file
|
||||
set | sed -n '/^CTDB_SET_/s/=.*//p' |
|
||||
while read v; do
|
||||
varname="${v#CTDB_SET_}"
|
||||
value=$(eval echo "\$$v")
|
||||
if $CTDB setvar "$varname" "$value" ; then
|
||||
echo "Set $varname to $value"
|
||||
else
|
||||
echo "Invalid configuration: CTDB_SET_${varname}=${value}"
|
||||
return 1
|
||||
_f="${CTDB_BASE}/ctdb.tunables"
|
||||
if [ ! -r "$_f" ] ; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
while IFS="=" read _var _val ; do
|
||||
case "$_var" in
|
||||
\#*|"") continue ;;
|
||||
esac
|
||||
|
||||
if $CTDB setvar "$_var" "$_val" ; then
|
||||
echo "Set $_var to $_val"
|
||||
else
|
||||
echo "Invalid tunable: ${_var}=${_val}"
|
||||
return 1
|
||||
fi
|
||||
done <"$_f"
|
||||
}
|
||||
|
||||
############################################################
|
||||
|
@ -51,8 +51,7 @@ setup
|
||||
|
||||
Failure of this event will cause CTDB to terminate.
|
||||
|
||||
Example: 00.ctdb processes tunables defined in the CTDB
|
||||
configuration using CTDB_SET_<TunableName>=<TunableValue>.
|
||||
Example: 00.ctdb processes tunables defined in ctdb.tunables.
|
||||
|
||||
startup
|
||||
|
||||
|
@ -38,7 +38,25 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The tunable variables are listed alphabetically.
|
||||
Tunables can be set at startup from the
|
||||
<filename>/usr/local/etc/ctdb/ctdb.tunables</filename>
|
||||
configuration file.
|
||||
|
||||
<literallayout>
|
||||
<replaceable>TUNABLE</replaceable>=<replaceable>VALUE</replaceable>
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For example:
|
||||
|
||||
<screen format="linespecific">
|
||||
MonitorInterval=20
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The available tunable variables are listed alphabetically below.
|
||||
</para>
|
||||
|
||||
<refsect2>
|
||||
@ -743,6 +761,14 @@
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>FILES></title>
|
||||
|
||||
<simplelist>
|
||||
<member><filename>/usr/local/etc/ctdb/ctdb.tunables</filename></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>SEE ALSO</title>
|
||||
<para>
|
||||
|
@ -1428,31 +1428,6 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>
|
||||
TUNABLES CONFIGURATION
|
||||
</title>
|
||||
|
||||
<para>
|
||||
CTDB tunables (see
|
||||
<citerefentry><refentrytitle>ctdbd-tunables</refentrytitle>
|
||||
<manvolnum>7</manvolnum></citerefentry>) can be set from the
|
||||
configuration file. They are set as follows:
|
||||
|
||||
<literallayout>
|
||||
CTDB_SET_<replaceable>TUNABLE</replaceable>=<replaceable>VALUE</replaceable>
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For example:
|
||||
|
||||
<screen format="linespecific">
|
||||
CTDB_SET_MonitorInterval=20
|
||||
</screen>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>
|
||||
DEBUG AND TEST
|
||||
|
@ -114,6 +114,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d
|
||||
DESTDIR=$RPM_BUILD_ROOT ./buildtools/bin/waf install
|
||||
|
||||
install -m644 config/ctdbd.conf $RPM_BUILD_ROOT%{_sysconfdir}/ctdb
|
||||
install -m644 config/ctdb.tunables $RPM_BUILD_ROOT%{_sysconfdir}/ctdb
|
||||
|
||||
# Add a pointer to modern location for configuration file. Allow with
|
||||
# "noreplace" in the files section, this stops RPM moving aside a
|
||||
@ -154,6 +155,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root)
|
||||
|
||||
%config(noreplace) %{_sysconfdir}/ctdb/ctdbd.conf
|
||||
%config(noreplace) %{_sysconfdir}/ctdb/ctdb.tunables
|
||||
%config(noreplace) %{_sysconfdir}/ctdb/notify.sh
|
||||
%config(noreplace) %{_sysconfdir}/ctdb/debug-hung-script.sh
|
||||
%config(noreplace) %{_sysconfdir}/ctdb/ctdb-crash-cleanup.sh
|
||||
|
@ -14,7 +14,7 @@ EOF
|
||||
required_result 1 <<EOF
|
||||
Set MonitorInterval to 5
|
||||
Unable to set tunable variable 'UnknownMagic'
|
||||
Invalid configuration: CTDB_SET_UnknownMagic=0
|
||||
Invalid tunable: UnknownMagic=0
|
||||
Aborting setup due to invalid configuration - fix typos, remove unknown tunables
|
||||
EOF
|
||||
|
||||
|
@ -12,9 +12,9 @@ EventScriptUnhealthyOnTimeout=0
|
||||
EOF
|
||||
|
||||
required_result 0 <<EOF
|
||||
Set MonitorInterval to 5
|
||||
Setting obsolete tunable variable 'EventScriptUnhealthyOnTimeout'
|
||||
Set EventScriptUnhealthyOnTimeout to 0
|
||||
Set MonitorInterval to 5
|
||||
EOF
|
||||
|
||||
simple_test
|
||||
|
@ -1,5 +1 @@
|
||||
CTDB_DEBUGLEVEL=ERR
|
||||
|
||||
if [ -n "$FAKE_CTDB_EXTRA_CONFIG" -a -r "$FAKE_CTDB_EXTRA_CONFIG" ] ; then
|
||||
. "$FAKE_CTDB_EXTRA_CONFIG"
|
||||
fi
|
||||
|
@ -18,16 +18,7 @@ setup ()
|
||||
|
||||
setup_tunable_config ()
|
||||
{
|
||||
_t="${EVENTSCRIPTS_TESTS_VAR_DIR}/fake-tunable-config.sh"
|
||||
export FAKE_CTDB_EXTRA_CONFIG="$_t"
|
||||
rm -f "$FAKE_CTDB_EXTRA_CONFIG"
|
||||
|
||||
while read line ; do
|
||||
case "$line" in
|
||||
\#*|"") : ;;
|
||||
*) echo "CTDB_SET_${line}"
|
||||
esac
|
||||
done >"$FAKE_CTDB_EXTRA_CONFIG"
|
||||
cat >"${CTDB_BASE}/ctdb.tunables"
|
||||
}
|
||||
|
||||
result_filter ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user