ctdb-scripts: Use nfsconf as a last resort get nfsd thread count
authorMartin Schwenke <martin@meltin.net>
Mon, 20 Jul 2020 02:02:45 +0000 (12:02 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 27 Jul 2020 07:06:57 +0000 (07:06 +0000)
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=14444
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Jul 27 07:06:58 UTC 2020 on sn-devel-184

ctdb/config/nfs-linux-kernel-callout
ctdb/tests/UNIT/eventscripts/stubs/nfsconf [new file with mode: 0755]

index 71d8ecf80740783f204a5b6abd17cedf926a0ab3..6a372d4b4fd551fc9bc2daa549645c15903359a0 100755 (executable)
@@ -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 (executable)
index 0000000..84dd9ea
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# This always fails for now, since there are no tests that expect to
+# use it.
+exit 1