From ecaa24765cd6fdffc2d3bc46224f5b2a18afb2fc Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 20 Jul 2020 12:02:45 +1000 Subject: [PATCH] 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. RN: Use nfsconf utility for variable values in CTDB NFS scripts BUG: https://bugzilla.samba.org/show_bug.cgi?id=14444 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 (cherry picked from commit 642dc6ded6426ba2fbf3ac1e5cd71aae11ca245b) --- ctdb/config/nfs-linux-kernel-callout | 3 +++ ctdb/tests/UNIT/eventscripts/stubs/nfsconf | 5 +++++ 2 files changed, 8 insertions(+) create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/nfsconf 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/tests/UNIT/eventscripts/stubs/nfsconf b/ctdb/tests/UNIT/eventscripts/stubs/nfsconf new file mode 100755 index 00000000000..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 -- 2.47.2