[Pkg-samba-maint] [Git][samba-team/samba][master] 9 commits: d/p/fix-nfs-service-name-to-nfs-kernel-server.patch: updated to use

Michael Tokarev (@mjt) gitlab at salsa.debian.org
Fri Jul 1 09:07:14 BST 2022



Michael Tokarev pushed to branch master at Debian Samba Team / samba


Commits:
4872ee66 by Andreas Hasenack at 2022-06-01T10:35:45-03:00
d/p/fix-nfs-service-name-to-nfs-kernel-server.patch: updated to use
nfsconf(8) if it's available, instead of parsing the old config files in
/etc/default/nfs-*

- - - - -
b5b24e40 by Andreas Hasenack at 2022-06-01T10:36:30-03:00
d/ctdb.example/nfs-kernel-server/nfs.conf: /etc/nfs.conf to be used by
the enable-nfs.sh example script

- - - - -
5baa2156 by Andreas Hasenack at 2022-06-01T10:36:54-03:00
d/ctdb.example/nfs-kernel-server/ctdb.example.quota: quota config file
to be used by the example enable-nfs.sh script

- - - - -
a93da493 by Andreas Hasenack at 2022-06-01T10:37:03-03:00
d/ctdb.example/nfs-kernel-server/nfs-{common,kernel-server}: obsolete,
replaced by nfs.conf

- - - - -
6a4c5431 by Andreas Hasenack at 2022-06-01T10:37:18-03:00
d/ctdb.example/nfs-kernel-server/enable-nfs.sh: handle new nfs.conf and
other changes in the new nfs server packages

- - - - -
1402b469 by Andreas Hasenack at 2022-06-01T10:37:28-03:00
rename ctdb example files nfs.conf and quota to match what the
enable-nfs.sh script expects

- - - - -
a5fcbd35 by Andreas Hasenack at 2022-06-01T10:37:40-03:00
enable-nfs.sh ctdb example: use debian's filename for the static port
sysctl configuration

- - - - -
2bc992dc by Andreas Hasenack at 2022-06-01T16:29:56-03:00
enable-nfs.sh: in ctdb 4.16, the "recovery lock" config option was
renamed to "cluster lock"

- - - - -
13eb6050 by Michael Tokarev at 2022-07-01T08:07:00+00:00
Merge branch 'salsa-nfs-ctdb-changes' into 'master'

Update CTDB and NFS scripts for new nfs server layout

See merge request samba-team/samba!58
- - - - -


6 changed files:

- debian/ctdb.example/nfs-kernel-server/enable-nfs.sh
- − debian/ctdb.example/nfs-kernel-server/nfs-common
- − debian/ctdb.example/nfs-kernel-server/nfs-kernel-server
- + debian/ctdb.example/nfs-kernel-server/nfs.conf
- + debian/ctdb.example/nfs-kernel-server/quota
- debian/patches/fix-nfs-service-name-to-nfs-kernel-server.patch


Changes:

=====================================
debian/ctdb.example/nfs-kernel-server/enable-nfs.sh
=====================================
@@ -19,6 +19,14 @@ backupfile() {
     [ -f $1 ] && cp $1 $1.prvctdb || true
 }
 
+renamefiles() {
+    for f; do
+        [ -f "$f" ] || continue
+        echo "Renaming $f to $f.prvctdb"
+        mv "$f" "$f".prvctdb
+    done
+}
+
 checkservice() {
     (systemctl list-unit-files | grep -q $1.service) || die "service $1 not found"
 }
@@ -46,20 +54,6 @@ appendfile() {
     cat $base/$origfile >> $replfile
 }
 
-appendnfsenv() {
-
-    file=$1 ; [ -f $file ] || die "inexistent file $file";
-
-    echo appending NFS_HOSTNAME to $file...
-
-    grep -q "NFS_HOSTNAME" $file || \
-    {
-        echo
-        echo "echo NFS_HOSTNAME=\\\"\$NFS_HOSTNAME\\\"" \>\> \/run\/sysconfig\/nfs-utils
-        echo
-    } >> $file
-}
-
 execnfsenv() {
 
     file=$1 ; [ -f $file ] || due "inexistent file $file";
@@ -71,7 +65,7 @@ execnfsenv() {
 
 fixnfshostname() {
 
-    file=$1 ; [ -f $file ] || due "inexistent file $file";
+    type nfsconf > /dev/null 2>&1 || die "nfsconf(8) not found"
 
     if [ "$ghostname" == "" ]; then
         echo "What is the FQDN for the public IP address of this host ?"
@@ -79,8 +73,8 @@ fixnfshostname() {
         read ghostname
     fi
 
-    echo placing hostname $ghostname into $file...
-    sed -i "s:PLACE_HOSTNAME_HERE:$ghostname:g" $file
+    echo "Setting $ghostname in nfs.conf..."
+    nfsconf --set statd name "$ghostname"
 }
 
 # end of functions --
@@ -90,13 +84,14 @@ fixnfshostname() {
 echo """
 This script will enable CTDB NFS HA by changing the following files:
 
-(1) /etc/default/nfs-common                   ( replace )
-(2) /etc/default/nfs-kernel-server            ( replace )
+(1) /etc/nfs.conf                             ( replace )
+(2) /etc/nfs.conf.d/*.conf                    ( rename  )
 (3) /etc/services                             ( append  )
-(4) /etc/sysctl.d/99-nfs-static-ports.conf    ( create  )
-(5) /usr/lib/systemd/scripts/nfs-utils_env.sh ( modify  )
+(4) /etc/sysctl.d/98-nfs-static-ports.conf    ( create  )
+(5) /etc/default/quota                        ( replace )
 
-and disabling the following services:
+and disabling the following services, as they will be managed
+by ctdb:
 
 (1) rpcbind
 (2) nfs-kernel-server
@@ -124,10 +119,10 @@ checkservice rpcbind
 echo "requirements okay!"
 echo
 
-backupfile /etc/default/nfs-common
-backupfile /etc/default/nfs-kernel-server
+backupfile /etc/nfs.conf
+renamefiles /etc/nfs.conf.d/*.conf
 backupfile /etc/services
-backupfile /usr/lib/systemd/scripts/nfs-utils_env.sh
+backupfile /etc/default/quota
 echo
 
 set +e
@@ -150,20 +145,15 @@ echo
 
 set -e
 
-replacefile nfs-common /etc/default/nfs-common
-replacefile nfs-kernel-server /etc/default/nfs-kernel-server
-replacefile 99-nfs-static-ports.conf /etc/sysctl.d/99-nfs-static-ports.conf
+replacefile nfs.conf /etc/nfs.conf
+replacefile 98-nfs-static-ports.conf /etc/sysctl.d/98-nfs-static-ports.conf
+replacefile quota /etc/default/quota
 echo
 
 appendfile services /etc/services
 echo
 
-fixnfshostname /etc/default/nfs-common
-fixnfshostname /etc/default/nfs-kernel-server
-echo
-
-appendnfsenv /usr/lib/systemd/scripts/nfs-utils_env.sh
-execnfsenv /usr/lib/systemd/scripts/nfs-utils_env.sh
+fixnfshostname
 echo
 
 sysctlrefresh
@@ -181,10 +171,10 @@ A log file can be found at:
 
 Remember:
 
-    - to place a recovery lock in /etc/ctdb/ctdb.conf:
+    - to place a cluster lock in /etc/ctdb/ctdb.conf:
         ...
         [cluster]
-        recovery lock = /clustered.filesystem/.reclock
+        cluster lock = /clustered.filesystem/.reclock
         ...
 
 And, make sure you enable ctdb service again:


=====================================
debian/ctdb.example/nfs-kernel-server/nfs-common deleted
=====================================
@@ -1,19 +0,0 @@
-# CTDB: /etc/default/nfs-common for clustering
-
-NFS_HOSTNAME="PLACE_HOSTNAME_HERE"
-
-# rpc.statd - daemon listening for reboot notifications (locks related)
-NEED_STATD="yes"
-STATDOPTS="-n ${NFS_HOSTNAME} -p 32765 -o 32766 -H /etc/ctdb/statd-callout -T 32768 -U 32768"
-STATD_HOSTNAME="$NFS_HOSTNAME"
-
-# rpc.gssd - security context for rpc connections
-NEED_GSSD="no"
-
-# rpc.idmapd - NFSv4 <-> name mapping daemon (fallback nowadays)
-# recent kernels use nfsidmap(8) instead
-NEED_IDMAPD="no"
-
-# rpc.quota - usage quota
-RPCRQUOTADOPTS="-p 32769"
-


=====================================
debian/ctdb.example/nfs-kernel-server/nfs-kernel-server deleted
=====================================
@@ -1,16 +0,0 @@
-# CTDB: /etc/default/nfs-kernel-server for clustering
-
-NFS_HOSTNAME="PLACE_HOSTNAME_HERE"
-
-# rpc.nfsd - user level part of nfs service (kernel: nfsd module)
-RPCNFSDPRIORITY=0
-RPCNFSDCOUNT=8
-RPCNFSDOPTS="-N 4"
-
-# rpc.mountd - server side of nfs mount protocol
-RPCMOUNTDOPTS="-p 32767 --manage-gids --no-nfs-version 4"
-
-# rpc.svcgssd - userspace daemon to handle sec context for kernel rpcsec_gss
-NEED_SVCGSSD="no"
-RPCSVCGSSDOPTS=""
-


=====================================
debian/ctdb.example/nfs-kernel-server/nfs.conf
=====================================
@@ -0,0 +1,20 @@
+[general]
+pipefs-directory = /run/rpc_pipefs
+
+[lockd]
+port = 32768
+udp-port = 32768
+
+[mountd]
+manage-gids = 1
+port = 32767
+
+[nfsd]
+threads = 8
+vers4 = n
+
+[statd]
+ha-callout = /etc/ctdb/statd-callout
+name = @NFS_HOSTNAME@
+outgoing-port = 32766
+port = 32765


=====================================
debian/ctdb.example/nfs-kernel-server/quota
=====================================
@@ -0,0 +1,5 @@
+# Set to "true" if warnquota should be run in cron.daily
+run_warnquota=
+
+# Add options to rpc.rquotad here
+RPCRQUOTADOPTS="-p 32769"


=====================================
debian/patches/fix-nfs-service-name-to-nfs-kernel-server.patch
=====================================
@@ -4,13 +4,15 @@ Subject: fix nfs related service names
 Upstream defines nfs related service names based on the Linux
 distribution. This patch fixes the names for Debian and derivatives.
 
+Update by Andreas Hasenack <andreas at canonical.com> (LP: #1961840):
+Use nfsconf(8) if it's available, instead of parsing the old config
+files in /etc/default/nfs-*
+
 Bug-Debian: https://bugs.debian.org/929931
 Bug-Ubuntu: https://bugs.launchpad.net/bugs/722201
-Last-Update: 2018-08-05
-Index: samba/ctdb/config/events/legacy/06.nfs.script
-===================================================================
---- samba.orig/ctdb/config/events/legacy/06.nfs.script	2020-11-24 18:11:53.506104058 -0500
-+++ samba/ctdb/config/events/legacy/06.nfs.script	2020-11-24 18:11:53.502104093 -0500
+Last-Update: 2022-03-16
+--- a/ctdb/config/events/legacy/06.nfs.script
++++ b/ctdb/config/events/legacy/06.nfs.script
 @@ -6,7 +6,7 @@
  
  . "${CTDB_BASE}/functions"
@@ -20,11 +22,9 @@ Index: samba/ctdb/config/events/legacy/06.nfs.script
  
  load_script_options "service" "60.nfs"
  
-Index: samba/ctdb/config/events/legacy/60.nfs.script
-===================================================================
---- samba.orig/ctdb/config/events/legacy/60.nfs.script	2020-11-24 18:11:53.506104058 -0500
-+++ samba/ctdb/config/events/legacy/60.nfs.script	2020-11-24 18:11:53.502104093 -0500
-@@ -6,9 +6,9 @@
+--- a/ctdb/config/events/legacy/60.nfs.script
++++ b/ctdb/config/events/legacy/60.nfs.script
+@@ -6,9 +6,11 @@
  
  . "${CTDB_BASE}/functions"
  
@@ -32,14 +32,14 @@ Index: samba/ctdb/config/events/legacy/60.nfs.script
 +service_name="nfs-kernel-server"
  
 -load_system_config "nfs"
-+load_system_config "nfs-kernel-server"
++if ! type nfsconf > /dev/null 2>&1; then
++    load_system_config "nfs-kernel-server"
++fi
  
  load_script_options
  
-Index: samba/ctdb/config/nfs-linux-kernel-callout
-===================================================================
---- samba.orig/ctdb/config/nfs-linux-kernel-callout	2020-11-24 18:11:53.506104058 -0500
-+++ samba/ctdb/config/nfs-linux-kernel-callout	2020-11-24 18:11:53.502104093 -0500
+--- a/ctdb/config/nfs-linux-kernel-callout
++++ b/ctdb/config/nfs-linux-kernel-callout
 @@ -14,7 +14,7 @@
  
  # As above, edit the default value below.  CTDB_NFS_DISTRO_STYLE is a
@@ -49,31 +49,40 @@ Index: samba/ctdb/config/nfs-linux-kernel-callout
  
  case "$nfs_distro_style" in
  systemd-*)
-@@ -33,6 +33,14 @@
+@@ -32,7 +32,22 @@
+ 		: # Defaults only
  		;;
  	*-debian)
- 		nfs_rquotad_service="quotarpc"
-+		nfs_lock_service=""
-+		nfs_lock_service=""
-+		nfs_mountd_service=""
-+		nfs_status_service=""
+-		nfs_rquotad_service="quotarpc"
++		# XXX
++		# Undefine nfs_rquotad_services because the quotarpc service won't
++		# start unless there are specific "quota" mount options in /etc/fstab..
++		# In this way, we let ctdb start it up manually once the
++		# /etc/ctdb/nfs-checks.d/50.rquotad.check detects rpc.rquotad isn't
++		# running.
++		# Users who really don't want rpc.rquotad running should then move
++		# the 50.rquotad.check script away.
 +		nfs_rquotad_service=""
 +		nfs_service="nfs-kernel-server"
-+		nfs_config="/etc/default/nfs-kernel-server"
++		if type nfsconf >/dev/null 2>&1; then
++			nfs_config=""
++		else
++			nfs_config="/etc/default/nfs-kernel-server"
++		fi
 +		nfs_rquotad_config="/etc/default/quota"
  		;;
  	*)
  		echo "Internal error"
-Index: samba/ctdb/config/statd-callout
-===================================================================
---- samba.orig/ctdb/config/statd-callout	2020-11-24 18:11:53.506104058 -0500
-+++ samba/ctdb/config/statd-callout	2020-11-24 18:11:53.502104093 -0500
-@@ -29,7 +29,7 @@
+--- a/ctdb/config/statd-callout
++++ b/ctdb/config/statd-callout
+@@ -29,7 +29,9 @@
  }
  
  # Try different variables to find config file for NFS_HOSTNAME
 -load_system_config "nfs" "nfs-common"
-+load_system_config "nfs-kernel-server"
++if ! type nfsconf > /dev/null 2>&1; then
++    load_system_config "nfs-common" "nfs-kernel-server"
++fi
  
  # 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



View it on GitLab: https://salsa.debian.org/samba-team/samba/-/compare/394205e6dd4baf98425f87b2e5fd3ba87f7dd0a5...13eb6050d1e9176126a5b50529f9f7cea016a502

-- 
View it on GitLab: https://salsa.debian.org/samba-team/samba/-/compare/394205e6dd4baf98425f87b2e5fd3ba87f7dd0a5...13eb6050d1e9176126a5b50529f9f7cea016a502
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-samba-maint/attachments/20220701/06df1544/attachment-0001.htm>


More information about the Pkg-samba-maint mailing list