Red Hat Bugzilla – Bug 1179412
nfs options went missing in nfsserver after updating to 3.9.5-12.el6
Last modified: 2015-08-24 02:36:44 EDT
Description of problem: BZ 1091102 seems to have introduce the upstream update 8fd1a9aa26 [1] This update recreates a /etc/sysconfig/nfs from scratch, and introduce several nfsserver parameters, such as port numbers. => The downside is that /etc/sysconfig/nfs may have contained values which were wanted by users, and they are no longer applied. => Also, a side effect of this is that /etc/sysconfig/nfs is read by other services, such as rpcgssd, rpcidmapd and rpcsvcgssd. These services do not seem to be managed by nfsserver. I am unsure if they are supported in parallel of nfsserver. Version-Release number of selected component (if applicable): upstream, 6 and 7 How reproducible: 100% Steps to Reproduce: 1. Try setting the number of NFS thread Actual results: It will always be 8 Expected results: Modifiable Additional info: I could see several ways around : A) nfsserver to merge its parameters into the existing /etc/sysconfig/nfs B) an nfsserver parameter that generically sets any variables C) all /etc/sysconfig/nfs to be added as nfsserver parameter D) a mix of the above B) and C) might not be sufficient to help with the rpcgssd, rpcidmapd and rpcsvcgssd services I tried to get an exhaustive list of the missing values : RDMA_PORT RPCNFSDCOUNT -> can't be set via RPCNFSDARGS NFSD_V4_GRACE NFSD_MODULE LOCKDARG RQUOTAD -> quotas can't be disabled anymore RPCMOUNTDOPTS STATDARG RPCRQUOTADOPTS and for non-NFS services (rpcgssd, rpcidmapd and rpcsvcgssd) : RPCIDMAPDARGS SECURE_NFS RPCGSSDARGS RPCSVCGSSDARGS RDMA_PORT [1] : URL https://github.com/ClusterLabs/resource-agents/commit/8fd1a9aa26
For solution A) merging the changes into an existing sysconfig/nfs, we might want to check along these lines : diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver index cb8635f..b2da5bc 100755 --- a/heartbeat/nfsserver +++ b/heartbeat/nfsserver @@ -391,7 +391,12 @@ set_arg() # only write to the tmp /etc/sysconfig/nfs if sysconfig exists. # otherwise this distro does not support setting these options. if [ -d "/etc/sysconfig" ]; then - echo "${key}=\"${value}\"" >> $file + # replace if the value exists, append otherwise + if grep "^\s*${key}=" $file ; then + sed -i "s/\s*${key}=.*$/${key}=\"${value}\"/" $file + else + echo "${key}=\"${value}\"" >> $file + fi elif [ "$requires_sysconfig" = "true" ]; then ocf_log warn "/etc/sysconfig/nfs not found, unable to set port and nfsd args." fi @@ -404,6 +409,9 @@ set_env_args() local tmpconfig=$(mktemp ${HA_RSCTMP}/nfsserver-tmp-XXXXX) local statd_args + ## Take the $NFS_SYSCONFIG file as our skeleton + cp $NFS_SYSCONFIG $tmpconfig + # nfsd args set_arg "RPCNFSDARGS" "$OCF_RESKEY_nfsd_args" "$tmpconfig" "true"
For Solution B) adding a parameter to add generic option, the following might be a start : parameter example : generic_vars=KEY1=value1,KEY2=value2 diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver index cb8635f..4237d18 100755 --- a/heartbeat/nfsserver +++ b/heartbeat/nfsserver @@ -432,6 +432,14 @@ set_env_args() set_arg "RPCRQUOTADOPTS" "-p $OCF_RESKEY_rquotad_port" "$tmpconfig" "true" fi + # Generic variables + local IFSbk=$IFS + IFS=, + for pair in $OCF_RESKEY_generic_vars ; do + set_arg ${pair%%=*} ${pair#*=} "$tmpconfig" "true" + done + IFS=$IFSbk + # override local nfs config. preserve previous local config though. if [ -s $tmpconfig ]; then cat $NFS_SYSCONFIG | grep -e "$NFS_SYSCONFIG_AUTOGEN_TAG"
(In reply to Cedric Buissart from comment #2) > For solution A) merging the changes into an existing sysconfig/nfs, we might > want to check along these lines : > > > diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver > index cb8635f..b2da5bc 100755 > --- a/heartbeat/nfsserver > +++ b/heartbeat/nfsserver > @@ -391,7 +391,12 @@ set_arg() > # only write to the tmp /etc/sysconfig/nfs if sysconfig exists. > # otherwise this distro does not support setting these options. > if [ -d "/etc/sysconfig" ]; then > - echo "${key}=\"${value}\"" >> $file > + # replace if the value exists, append otherwise > + if grep "^\s*${key}=" $file ; then > + sed -i "s/\s*${key}=.*$/${key}=\"${value}\"/" $file > + else > + echo "${key}=\"${value}\"" >> $file > + fi > elif [ "$requires_sysconfig" = "true" ]; then > ocf_log warn "/etc/sysconfig/nfs not found, unable to set port and nfsd > args." > fi > @@ -404,6 +409,9 @@ set_env_args() > local tmpconfig=$(mktemp ${HA_RSCTMP}/nfsserver-tmp-XXXXX) > local statd_args > > + ## Take the $NFS_SYSCONFIG file as our skeleton > + cp $NFS_SYSCONFIG $tmpconfig > + > # nfsd args > set_arg "RPCNFSDARGS" "$OCF_RESKEY_nfsd_args" "$tmpconfig" "true" I'm fine with this one. Do you have a github account? Would you be interested in submitting the pull request for review here, https://github.com/ClusterLabs/resource-agents -- David
Cedric, Has any progress been made to get this patch upstream?
https://github.com/ClusterLabs/resource-agents/pull/581
I have verified that with resource-agents-3.9.5-20.el6.x86_64 the values contained in /etc/sysconfig/nfs are kept intact. [root@bucek-02 ~]# grep -v \# /etc/sysconfig/nfs LOCKD_UDPPORT=32769 before the patch resource-agents-3.9.5-19.el6.x86_64 ==================================================== [root@bucek-02 x86_64]# OCF_ROOT=/usr/lib/ocf OCF_RESKEY_lockd_tcp_port=32803 \ OCF_RESKEY_nfs_shared_infodir=/mnt/shared/nfs \ /usr/lib/ocf/resource.d/heartbeat/nfsserver start DEBUG: rpc.svcgssd is stopped rpc.mountd is stopped nfsd is stopped rpc.rquotad is stopped # AUTOGENERATED by /usr/lib/ocf/resource.d/heartbeat/nfsserver high availability resource-agent INFO: Starting NFS server ... INFO: Starting rpc.statd. DEBUG: Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS mountd: [ OK ] Starting NFS daemon: [ OK ] Starting RPC idmapd: [ OK ] INFO: executing sm-notify INFO: NFS server started [root@bucek-02 x86_64]# grep -v \# /etc/sysconfig/nfs STATDARG="--no-notify" LOCKD_TCPPORT="32803" with patched version resource-agents-3.9.5-20.el6.x86_64 ======================================================== [root@bucek-02 ~]# OCF_ROOT=/usr/lib/ocf OCF_RESKEY_lockd_tcp_port=32803 \ OCF_RESKEY_nfs_shared_infodir=/mnt/shared/nfs \ /usr/lib/ocf/resource.d/heartbeat/nfsserver start DEBUG: rpc.svcgssd is stopped rpc.mountd is stopped nfsd is stopped rpc.rquotad is stopped INFO: Starting NFS server ... INFO: rpc.statd already up DEBUG: Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS mountd: [ OK ] Starting NFS daemon: [ OK ] Starting RPC idmapd: [ OK ] INFO: executing sm-notify INFO: NFS server started [root@bucek-02 ~]# grep -v \# /etc/sysconfig/nfs LOCKD_UDPPORT=32769 STATDARG="--no-notify" LOCKD_TCPPORT="32803"
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-1280.html