The Samba-Bugzilla – Attachment 16143 Details for
Bug 14444
CTDB NFS scripts needs to use nfsconf to set some variables on systems that use nfs.conf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.13, 4.12
BZ14444.patch (text/plain), 4.27 KB, created by
Martin Schwenke
on 2020-07-28 09:48:52 UTC
(
hide
)
Description:
Patch for 4.13, 4.12
Filename:
MIME Type:
Creator:
Martin Schwenke
Created:
2020-07-28 09:48:52 UTC
Size:
4.27 KB
patch
obsolete
>From fb4d35205e0811a642075d1e76674e14585844ac Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 13 Jul 2020 10:16:33 +1000 >Subject: [PATCH 1/2] 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=14444 >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 334dd8cedda6a341e3b89c9adc8102ea5480e452) >--- > ctdb/config/statd-callout | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > >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" > >-- >2.27.0 > > >From 4ea3cf1249ec6a4750d27eb95497ae01d3fad876 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 20 Jul 2020 12:02:45 +1000 >Subject: [PATCH 2/2] 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 <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 > >(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.27.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
amitay
:
review+
Actions:
View
Attachments on
bug 14444
: 16143