From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7583 invoked by alias); 5 Oct 2008 16:21:33 -0000 Received: (qmail 7575 invoked by alias); 5 Oct 2008 16:21:33 -0000 X-Spam-Status: No, hits=1.3 required=5.0 tests=AWL,BAYES_50,DNS_FROM_DOB,KAM_MX,RCVD_IN_DOB,SPF_HELO_PASS,URIBL_RHS_DOB X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on bastion.fedora.phx.redhat.com X-Spam-Level: Subject: RHEL4 - rgmanager: Resolve hostnames->IPs and back when checking NFS clients To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/RHEL4 X-Git-Reftype: branch X-Git-Oldrev: 0bb2e2b2125636f16666d11aa4c6381d1a495f47 X-Git-Newrev: 3ac923a11855a7f7df6fd8bfb0725f88cf3b2650 From: "Ryan O'Hara" Message-Id: <20081005162001.BD29E1201AA@lists.fedorahosted.org> Date: Sun, 05 Oct 2008 16:21:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q4/txt/msg00009.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=3ac923a11855a7f7df6fd8bfb0725f88cf3b2650 Commit: 3ac923a11855a7f7df6fd8bfb0725f88cf3b2650 Parent: 0bb2e2b2125636f16666d11aa4c6381d1a495f47 Author: Lon Hohberger AuthorDate: Tue Sep 16 10:59:47 2008 -0400 Committer: rohara CommitterDate: Sun Oct 5 11:17:05 2008 -0500 rgmanager: Resolve hostnames->IPs and back when checking NFS clients Also enable caching for improved performance in services with lots (hundreds) of individual mounters Bugzillas #246668 & #455324 --- rgmanager/src/resources/nfsclient.sh | 93 ++++++++++++++++++++++++++++++++- rgmanager/src/resources/service.sh | 21 ++++++++ 2 files changed, 111 insertions(+), 3 deletions(-) diff --git a/rgmanager/src/resources/nfsclient.sh b/rgmanager/src/resources/nfsclient.sh index c3302a9..70e69f1 100755 --- a/rgmanager/src/resources/nfsclient.sh +++ b/rgmanager/src/resources/nfsclient.sh @@ -131,6 +131,38 @@ meta_data() + + + Service this NFS export belongs to. Used for caching + exports on a per-service basis. + + + Service Name + + + + + + + On systems with large numbers of exports, a performance + problem in the exportfs command can cause inordinately long + status check times for services with lots of mounted + NFS clients. This occurs because exportfs does DNS queries + on all clients in the export list. + + Setting this option to '1' will enable caching of the export + list returned from the exportfs command on a per-service + basis. The cache will last for 30 seconds before expiring + instead of being generated each time an nfsclient resource + is called. + + + Enable exportfs list caching + + + + + @@ -341,13 +373,68 @@ status|monitor) # export OCF_RESKEY_target_regexp=$(echo $OCF_RESKEY_target | \ sed -e 's/*/[*]/g' -e 's/?/[?]/g' -e 's/\./\\./g') - exportfs -v | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -q \ - "^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target_regexp}" + declare tmpfn + declare time_created time_now + declare -i delta=0 + + # + # Don't let anyone read the cache files. + # + umask 066 + if [ -n "$OCF_RESKEY_service_name" ] && [ "$OCF_RESKEY_use_cache" = "1" ]; then + + # + # For large #s of exports, we need to cache the information + # + tmpfn=/tmp/nfsclient-status-cache-$OCF_RESKEY_service_name + + if [ -f "$tmpfn" ]; then + time_created=$(stat -c "%Y" $tmpfn) + time_now=$(date +"%s") + delta=$((time_now-time_created)) + fi + #echo "Cache age = $delta seconds" + else + delta=100 + # + # Create a different file if this is a separate instance + # + tmpfn=/tmp/nfsclient-status-cache-$$ + fi + + if ! [ -f "$tmpfn" ] || [ $delta -gt 30 ]; then + #echo "Create $tmpfn. Nonexistent / expired / no service name" + exportfs -v > $tmpfn + fi + + cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -iq \ + "^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target_regexp}" rv=$? - if [ $rv -ne 0 ]; then + + if [ $rv -eq 0 ]; then + [ -z "$OCF_RESKEY_service_name" ] && rm -f $tmpfn + exit 0 + fi + + declare OCF_RESKEY_target_tmp=$(clufindhostname -i "$OCF_RESKEY_target") + if [ $? -ne 0 ]; then + [ -z "$OCF_RESKEY_service_name" ] && 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=$? + + [ -z "$OCF_RESKEY_service_name" ] && rm -f $tmpfn + if [ $rv -eq 0 ]; then + exit 0 fi + + ocf_log err "nfsclient:$OCF_RESKEY_name is missing!" + exit 1 ;; recover) diff --git a/rgmanager/src/resources/service.sh b/rgmanager/src/resources/service.sh index 339657d..b7c9e08 100755 --- a/rgmanager/src/resources/service.sh +++ b/rgmanager/src/resources/service.sh @@ -127,6 +127,27 @@ meta_data() + + + + On systems with large numbers of exports, a performance + problem in the exportfs command can cause inordinately long + status check times for services with lots of mounted + NFS clients. This occurs because exportfs does DNS queries + on all clients in the export list. + + Setting this option to '1' will enable caching of the export + list returned from the exportfs command on a per-service + basis. The cache will last for 30 seconds before expiring + instead of being generated each time an nfsclient resource + is called. + + + Enable exportfs list caching + + + +