Bug 691814

Summary: nfsclient exports doens't work.
Product: Red Hat Enterprise Linux 6 Reporter: Lon Hohberger <lhh>
Component: resource-agentsAssignee: Lon Hohberger <lhh>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: agk, cluster-maint, djansa, dyn_ares, edamato, fdinitto, lhh, mjuricek
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: resource-agents-3.9.1-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 592624 Environment:
Last Closed: 2011-12-06 12:02:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 592624    
Bug Blocks:    
Attachments:
Description Flags
Test none

Description Lon Hohberger 2011-03-29 14:27:39 UTC
+++ This bug was initially created as a clone of Bug #592624 +++

Description of problem:

The monitoring of the nfsexports to nfsclinents goes in to an endless loop. See attached syslog.

When using inheritance in the cluster.conf it looks like /usr/share/cluster/nfsclient.sh can't monitor the export properly.

Problem #1: /var/lib/nfs/etab doesn't have a slash '/' at the end of the export path. Yet $OCF_RESKEY_path contains the end slash '/'. When checking if the export is present in:

  cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -q \
                "^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target_tmp}"
        rv=$?
It doesn't match you try to match:


/nfsexport/lv_app               bamse.niceriver.net

with 

^/nfsexport/lv_app/[\t ]*.*bamse.niceriver.net

No so the monitor is exiting with 1 and the whole thing error out.


Problem #2: Ip doesn't work in the target well you try to make it work here.

declare OCF_RESKEY_target_tmp=$(clufindhostname -i "$OCF_RESKEY_target")

but the fact is that the /var/lib/nfs/etab actually contain the IP address so then it's a no go again due to a miss match..


Anyways here is a version that will work :).. for both IP and hostnames as well as with or without ending '/' -- yes could be more brain behind the regexp but I just made it simple.. 


        declare OCF_RESKEY_target_tmp=$(clufindhostname -i "$OCF_RESKEY_target")
        if [ $? -ne 0 ]; then
                [ "$OCF_RESKEY_use_cache" = "1" ] || rm -f $tmpfn
                ocf_log err "nfsclient:$OCF_RESKEY_name is missing!"
                exit 1
        fi

        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -q \
                "^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target_tmp}"
        rv=$?

        if [ $rv -eq 0 ]; then
                [ "$OCF_RESKEY_use_cache" = "1" ] || rm -f $tmpfn
                exit 0
        fi

        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -q \
                "^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target}"
        rv=$?

        if [ $rv -eq 0 ]; then
                [ "$OCF_RESKEY_use_cache" = "1" ] || rm -f $tmpfn
                exit 0
        fi

        OCF_RESKEY_path_tmp=$(echo $OCF_RESKEY_path | sed -e 's@/$@@')

        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -q \
                "^${OCF_RESKEY_path_tmp}[\t ]*.*${OCF_RESKEY_target_tmp}"
        rv=$?

        if [ $rv -eq 0 ]; then
                [ "$OCF_RESKEY_use_cache" = "1" ] || rm -f $tmpfn
                exit 0
        fi

        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -q \
                "^${OCF_RESKEY_path_tmp}[\t ]*.*${OCF_RESKEY_target}"
        rv=$?

        [ "$OCF_RESKEY_use_cache" = "1" ] || rm -f $tmpfn
        if [ $rv -eq 0 ]; then
                exit 0
        fi


        ocf_log err "nfsclient:$OCF_RESKEY_name is missing! at end"
        exit 1
        ;;

--- Additional comment from lhh on 2011-03-28 16:44:48 EDT ---

Created attachment 488253 [details]
Fixes problem #1.

--- Additional comment from lhh on 2011-03-28 16:45:58 EDT ---

Problem #2 is fixed by the fix for bug 592613

Comment 1 Nate Straz 2011-05-24 13:47:05 UTC
Missing unit test results from devel.

Comment 8 Lon Hohberger 2011-06-29 13:59:19 UTC
Created attachment 510473 [details]
Test

Comment 11 errata-xmlrpc 2011-12-06 12:02:45 UTC
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.

http://rhn.redhat.com/errata/RHSA-2011-1580.html