Bug 725476

Summary: Write of persistent files on NFS is broken
Product: Red Hat Enterprise Linux 6 Reporter: Vagner Farias <vfarias>
Component: initscriptsAssignee: initscripts Maintenance Team <initscripts-maint-list>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: notting
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-25 19:41:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Vagner Farias 2011-07-25 15:22:20 UTC
Description of problem:
Customer has a goal of using diskless systems, booting via NFS. In order to be able to share one root filesystem with all the servers, the idea is to user read only root filesystem, configured at /etc/sysconfig/readonly-root.

Although the configuration of stateless files and directories is working (through /etc/rwtab[.d]), it's not possible to configure persistent files. 

As far as I noticed, rc.sysconfig partially implements this:

<..>
        elif [ ! -z "$CLIENTSTATE" ]; then
                # No local storage was found.  Make a final attempt to find
                # state on an NFS server.

                mount -t nfs $CLIENTSTATE/$HOSTNAME $STATE_MOUNT -o rw,nolock
        fi
<..>

The issue seems to be that $CLIENTSTATE is not set anywhere

Version-Release number of selected component (if applicable):
initscripts-9.03.23-1.el6.x86_64 (RHEL 6.1)

How reproducible:
Always.

Steps to Reproduce:
1. Create a root filesystem, as described in http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/diskless-nfs-config.html
2. Modify PXE configuration to mount rootfs in read-only mode (/var/lib/tftpboot/pxelinux.cfg/default)
3. Edit /etc/sysconfig/readonly-root and change READONLY and TEMPORARY_STATE to "yes"
4. Create NFS export for persistent files:
  # mkdir /exports/nfs/state
  # echo -e “/exports/nfs/state\t192.168.122.0/255.255.252.0(rw,no_root_squash)” >> /etc/exports
  # exportfs -ra
5. Add CLIENTSTATE=nfsserver.domain:/exports/nfs/state to kernel cmdline at /var/lib/tftpboot/pxelinux.cfg/default
6. Boot the diskless server
  
Actual results:
Persistent data export isn't mounted.

Expected results:
Persistent data export should be mounted according to CLIENTSTATE variable.

Comment 2 Bill Nottingham 2011-07-25 19:41:26 UTC
CLIENTSTATE is supposed to be set in the image itself.

Comment 3 Vagner Farias 2011-07-25 20:30:10 UTC
According to http://fedoraproject.org/wiki/StatelessLinux/ClientConfiguration, which seems to be outdated, CLIENTSTATE should be set on kernel command line.

Anyway, the only files rc.sysinit seems to source are:

. /etc/sysconfig/network
. /etc/init.d/functions
. /etc/selinux/config
. /etc/sysconfig/autofsck
. /etc/sysconfig/readonly-root

Which file would be the correct one to set CLIENTSTATE? Probably /etc/sysconfig/readonly-root, but I'd like to be sure of it. If this is true, wouldn't be nice to add something like the following to this config file?

# NFS server to use for persistent data?
CLIENTSTATE=

If empty, it wouldn't be used.

Comment 4 Bill Nottingham 2011-07-25 21:12:39 UTC
Good idea. Done upstream at 74746399b84771b0990206c402cc8cc87ec35e2d.