The branch, master has been updated
via 642dc6ded64 ctdb-scripts: Use nfsconf as a last resort get nfsd
thread count
via 334dd8cedda ctdb-scripts: Use nfsconf as a last resort to set
NFS_HOSTNAME
from bbcab57955d WHATSNEW: Fix description of CTDB NAT gateway and LVS
changes
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -
commit 642dc6ded6426ba2fbf3ac1e5cd71aae11ca245b
Author: Martin Schwenke
Date: Mon Jul 20 12:02:45 2020 +1000
ctdb-scripts: Use nfsconf as a last resort get nfsd thread count
If nfsconf exists then use it as last resort to attempt to extract
[nfsd]:threads from /etc/nfs.conf.
Invocation of nfsconf requires "|| true" because this script uses "set
-e". Add a stub that always fails to at least test this much.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=1
Signed-off-by: Martin Schwenke
Reviewed-by: Amitay Isaacs
Autobuild-User(master): Amitay Isaacs
Autobuild-Date(master): Mon Jul 27 07:06:58 UTC 2020 on sn-devel-184
commit 334dd8cedda6a341e3b89c9adc8102ea5480e452
Author: Martin Schwenke
Date: Mon Jul 13 10:16:33 2020 +1000
ctdb-scripts: Use nfsconf as a last resort to set NFS_HOSTNAME
If nfsconf exists then use it as last resort to attempt to extract
[statd]:name from /etc/nfs.conf.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=1
Signed-off-by: Martin Schwenke
Reviewed-by: Amitay Isaacs
---
Summary of changes:
ctdb/config/nfs-linux-kernel-callout | 3 +++
ctdb/config/statd-callout | 21 +
ctdb/tests/UNIT/eventscripts/stubs/nfsconf | 5 +
3 files changed, 25 insertions(+), 4 deletions(-)
create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/nfsconf
Changeset truncated at 500 lines:
diff --git a/ctdb/config/nfs-linux-kernel-callout
b/ctdb/config/nfs-linux-kernel-callout
index 71d8ecf8074..6a372d4b4fd 100755
--- a/ctdb/config/nfs-linux-kernel-callout
+++ b/ctdb/config/nfs-linux-kernel-callout
@@ -299,6 +299,9 @@ nfs_check_thread_count ()
# assume that those using the default don't care about the number
# of threads and that they have switched on this feature in error.
_configured_threads="${RPCNFSDCOUNT:-${USE_KERNEL_NFSD_NUMBER}}"
+if [ -z "$_configured_threads" ] && type nfsconf >/dev/null 2>&1 ; then
+ _configured_threads=$(nfsconf --get nfsd threads) || true
+fi
[ -n "$_configured_threads" ] || return 0
_threads_file="${PROCFS_PATH}/fs/nfsd/threads"
diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout
index b75135bbde5..67ed2a5bc62 100755
--- a/ctdb/config/statd-callout
+++ b/ctdb/config/statd-callout
@@ -3,10 +3,18 @@
# This must run as root as CTDB tool commands need to access CTDB socket
[ "$(id -u)" -eq 0 ] || exec sudo "$0" "$@"
-# this script needs to be installed so that statd points to it with the -H
-# command line argument. The easiest way to do that is to put something like
this in
-# /etc/sysconfig/nfs:
-# STATD_HOSTNAME="myhostname -H /etc/ctdb/statd-callout"
+# statd must be configured to use this script as its high availability
call-out.
+#
+# In most Linux versions this can be done using something like the following...
+#
+# /etc/sysconfig/nfs (Red Hat) or /etc/default/nfs-common (Debian):
+# NFS_HOSTNAME=myhostname
+# STATD_HOSTNAME="${NFS_HOSTNAME} -H /etc/ctdb/statd-callout"
+#
+# Newer Red Hat Linux variants instead use /etc/nfs.conf:
+# [statd]
+# name = myhostname
+# ha-callout = /etc/ctdb/statd-callout
[ -n "$CTDB_BASE" ] || \
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; echo "$PWD")
@@ -23,6 +31,11 @@ die ()
# Try different variables to find config file for NFS_HOSTNAME
load_system_config "nfs" "nfs-common"
+# If NFS_HOSTNAME not set then try to pull it out of /etc/nfs.conf
+if [ -z "$NFS_HOSTNAME" ] && type nfsconf >/dev/null 2>&1 ; then
+ NFS_HOSTNAME=$(nfsconf --get statd name)
+fi
+
[ -n "$NFS_HOSTNAME" ] || \
die "NFS_HOSTNAME is not configured. statd-callout failed"
diff --git a/ctdb/tests/UNIT/eventscripts/stubs/nfsconf
b/ctdb/tests/UNIT/eventscripts/stubs/nfsconf
new file mode 100755
index 000..84dd9ea5f60
--- /dev/null
+++ b/ctdb/tests/UNIT/eventscripts/stubs/nfsconf
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# This always fails for now, since there are no tests that expect to
+# use it.
+exit 1
--
Samba Shared Repository