[debian-lan-devel] [debian-lan] 02/03: Switch to NFSv4 everywhere.

Andreas B. Mundt andi at moszumanska.debian.org
Sat Jun 14 13:10:41 UTC 2014


This is an automated email from the git hooks/post-receive script.

andi pushed a commit to branch master
in repository debian-lan.

commit 6dd6698dab835f951149e78865dbf86f042d5245
Author: Andreas B. Mundt <andi at debian.org>
Date:   Fri Jun 13 09:52:54 2014 +0200

    Switch to NFSv4 everywhere.
    
    Use NFSv4 to export the FAI nfsroot, the FAI config space and the
    chroot for diskless clients.
---
 fai/config/files/etc/fai/fai.conf/DEBIAN    |  2 +-
 fai/config/files/etc/rc.local/FAISERVER     | 31 ++++++++++++++++++++++-------
 fai/config/scripts/DISKLESS_SERVER/10-setup |  4 +++-
 fai/config/scripts/FAISERVER/30-exports     | 11 ++++++++--
 fai/config/scripts/NFS_SERVER/10-config     |  6 +++---
 5 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/fai/config/files/etc/fai/fai.conf/DEBIAN b/fai/config/files/etc/fai/fai.conf/DEBIAN
index 69659b1..24dc89b 100644
--- a/fai/config/files/etc/fai/fai.conf/DEBIAN
+++ b/fai/config/files/etc/fai/fai.conf/DEBIAN
@@ -4,4 +4,4 @@
 LOGUSER=
 
 # URL to access the fai config space.
-FAI_CONFIG_SRC=nfs://faiserver/srv/fai/config
+FAI_CONFIG_SRC=nfs://faiserver/config
diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER
index a8238b5..eb1eff8 100755
--- a/fai/config/files/etc/rc.local/FAISERVER
+++ b/fai/config/files/etc/rc.local/FAISERVER
@@ -30,13 +30,30 @@ setup_nfsroot () {
     trap "rc=$?; rm -rf $NFSROOT; exit $rc" ERR SIGHUP SIGINT SIGTERM
     fai-setup -e -v
     trap - ERR SIGHUP SIGINT SIGTERM
+    WS_TEMPLATE=$TFTPROOT/pxelinux.cfg/workstation.tmpl
+    if [ ! -e $WS_TEMPLATE ]; then
+        KERNEL=`basename $(ls $TFTPROOT/vmlinuz*)`
+        INITRD=`basename $(ls $TFTPROOT/initrd.img*)`
+
+        echo "Creating template with $KERNEL and $INITRD."
+        cat > $WS_TEMPLATE <<EOF
+# template for workstation
+default Debian-LAN workstation
+
+label Debian-LAN workstation
+kernel $KERNEL
+append initrd=$INITRD ip=dhcp root=nfs4:/$(basename $NFSROOT) aufs FAI_FLAGS=verbose,sshd,createvt FAI_CONFIG_SRC=nfs://faiserver/config FAI_ACTION=install
+EOF
+    else
+        echo "The template $WS_TEMPLATE exists already!"
+    fi
     ## Create pxelinux boot configuration for workstationXX.
     ## The seq range is sed from the corresponding variable
     ## when fcopy'd:
     echo -n "Creating pxelinux boot configurations: "
     NUM=0
     for IPADDR in `seq WS_RANGE` ; do
-        fai-chboot -IFvu $FAI_CONFIG_SRC PREFIX.$IPADDR &>> /var/log/fai/fai-chboot.log
+        fai-chboot -vc workstation.tmpl PREFIX.$IPADDR &>> /var/log/fai/fai-chboot.log
         echo -n "."
         NUM=$(($NUM+1))
     done
@@ -58,22 +75,22 @@ setup_diskless () {
     fai -vNu diskless dirinstall $DLROOT
     trap - ERR SIGHUP SIGINT SIGTERM
 
-    TEMPLATE=$TFTPROOT/pxelinux.cfg/diskless.tmpl
-    if [ ! -e $TEMPLATE ]; then
+    DL_TEMPLATE=$TFTPROOT/pxelinux.cfg/diskless.tmpl
+    if [ ! -e $DL_TEMPLATE ]; then
         KERNEL=`basename $(ls $TFTPROOT/vmlinuz*)`
         INITRD=`basename $(ls $TFTPROOT/initrd.img*)`
 
         echo "Creating template with $KERNEL and $INITRD."
-        cat > $TEMPLATE <<EOF
+        cat > $DL_TEMPLATE <<EOF
 # template for diskless
 default Debian-LAN/FAI Live System
 
 label Debian-LAN/FAI Live System
 kernel $KERNEL
-append initrd=$INITRD ip=dhcp root=/dev/nfs nfsroot=$DLROOT aufs
+append initrd=$INITRD ip=dhcp root=nfs4:/$(basename $DLROOT) aufs
 EOF
     else
-        echo "The template $TEMPLATE exists already!"
+        echo "The template $DL_TEMPLATE exists already!"
     fi
 
     ## Create pxelinux boot configuration for disklessXX.
@@ -106,7 +123,7 @@ setup_PXEinstaller () {
 
 label Debian-LAN/FAI Roaming Machine
 kernel $KERNEL
-append initrd=$INITRD ip=dhcp root=/dev/nfs nfsroot=/srv/fai/nfsroot aufs FAI_FLAGS=verbose,sshd,createvt FAI_CONFIG_SRC=nfs://faiserver/srv/fai/config FAI_ACTION=install
+append initrd=$INITRD ip=dhcp root=nfs4:/nfsroot aufs FAI_FLAGS=verbose,sshd,createvt FAI_CONFIG_SRC=$FAI_CONFIG_SRC FAI_ACTION=install
 
 menu title Boot menu
 menu background debian-installer/i386/boot-screens/splash.png
diff --git a/fai/config/scripts/DISKLESS_SERVER/10-setup b/fai/config/scripts/DISKLESS_SERVER/10-setup
index fc51208..580c0da 100755
--- a/fai/config/scripts/DISKLESS_SERVER/10-setup
+++ b/fai/config/scripts/DISKLESS_SERVER/10-setup
@@ -6,4 +6,6 @@
 fcopy /usr/local/sbin/nbdswapd
 fcopy /etc/nbd-server/conf.d/swap.conf
 
-ainsl /etc/exports "/opt              ${SUBNETMASK}(async,ro,no_subtree_check,no_root_squash)"
+mkdir -p ${target}/srv/nfs4/live
+ainsl /etc/exports "/srv/nfs4/live     ${SUBNETMASK}(ro,no_subtree_check,no_root_squash)"
+ainsl /etc/fstab   "/opt/live          /srv/nfs4/live       none    bind    0       0"
diff --git a/fai/config/scripts/FAISERVER/30-exports b/fai/config/scripts/FAISERVER/30-exports
index 49bd989..799fbb0 100755
--- a/fai/config/scripts/FAISERVER/30-exports
+++ b/fai/config/scripts/FAISERVER/30-exports
@@ -2,5 +2,12 @@
 
 set -e
 
-ainsl /etc/exports "/srv/fai/nfsroot  ${SUBNETMASK}(async,ro,no_subtree_check,no_root_squash)"
-ainsl /etc/exports "/srv/fai/config   ${FAINETMASK}(async,ro,no_subtree_check,no_root_squash)"
+ainsl /etc/exports "/srv/nfs4          ${SUBNETMASK}(sec=krb5p:krb5i:krb5:sys,rw,fsid=0,crossmnt,no_subtree_check)"
+
+mkdir -p ${target}/srv/nfs4/nfsroot
+ainsl /etc/exports "/srv/nfs4/nfsroot  ${SUBNETMASK}(ro,no_subtree_check,no_root_squash)"
+ainsl /etc/fstab   "/srv/fai/nfsroot   /srv/nfs4/nfsroot    none    bind    0       0"
+
+mkdir -p ${target}/srv/nfs4/config
+ainsl /etc/exports "/srv/nfs4/config   ${FAINETMASK}(ro,no_subtree_check,no_root_squash)"
+ainsl /etc/fstab   "/srv/fai/config    /srv/nfs4/config     none    bind    0       0"
diff --git a/fai/config/scripts/NFS_SERVER/10-config b/fai/config/scripts/NFS_SERVER/10-config
index 09fcbf4..fd9f2e0 100755
--- a/fai/config/scripts/NFS_SERVER/10-config
+++ b/fai/config/scripts/NFS_SERVER/10-config
@@ -26,13 +26,13 @@ editfiles:
 
 	{ ${target}/etc/exports
 	  ## kerberized NFS4:
-	  AppendIfNoSuchLine "/srv/nfs4         ${SUBNETMASK}(sec=krb5p:krb5i,rw,fsid=0,crossmnt,no_subtree_check)"
-	  AppendIfNoSuchLine "/srv/nfs4/home0   ${SUBNETMASK}(sec=krb5p:krb5i,rw,no_subtree_check)"
+	  AppendIfNoSuchLine "/srv/nfs4          ${SUBNETMASK}(sec=krb5p:krb5i:krb5:sys,rw,fsid=0,crossmnt,no_subtree_check)"
+	  AppendIfNoSuchLine "/srv/nfs4/home0    ${SUBNETMASK}(sec=krb5p:krb5i,rw,no_subtree_check)"
 	}
 
 	{ ${target}/etc/fstab
           ## Bind the shared directory to the exported tree:
-	  AppendIfNoSuchLine "/lan/mainserver/home0    /srv/nfs4/home0	none	bind	0	0"
+	  AppendIfNoSuchLine "/lan/mainserver/home0  /srv/nfs4/home0	none	bind	0	0"
 	}
 
 	{ ${target}/etc/default/nfs-kernel-server

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/debian-lan.git



More information about the debian-lan-devel mailing list