public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: master - rgmanager: Resolve hostnames->IPs and back when checking NFS clients Date: Wed, 24 Sep 2008 18:07:00 -0000 [thread overview] Message-ID: <20080924175655.B47A6120435@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ba3648a17ab1993c75649c23b048e7ba08b2d596 Commit: ba3648a17ab1993c75649c23b048e7ba08b2d596 Parent: 4dc361b9404a8dc6177a7bbcb1e7635f356babf7 Author: Lon Hohberger <lhh@redhat.com> AuthorDate: Tue Sep 16 10:59:47 2008 -0400 Committer: Lon Hohberger <lhh@redhat.com> CommitterDate: Wed Sep 24 13:42:08 2008 -0400 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 | 94 ++++++++++++++++++++++++++++++++-- rgmanager/src/resources/service.sh | 21 ++++++++ 2 files changed, 111 insertions(+), 4 deletions(-) diff --git a/rgmanager/src/resources/nfsclient.sh b/rgmanager/src/resources/nfsclient.sh index 0f8a1bd..7cc9399 100644 --- a/rgmanager/src/resources/nfsclient.sh +++ b/rgmanager/src/resources/nfsclient.sh @@ -109,6 +109,38 @@ meta_data() <content type="boolean"/> </parameter> + <parameter name="service_name" inherit="service%name"> + <longdesc lang="en"> + Service this NFS export belongs to. Used for caching + exports on a per-service basis. + </longdesc> + <shortdesc lang="en"> + Service Name + </shortdesc> + <content type="string"/> + </parameter> + + <parameter name="use_cache" inherit="service%nfs_client_cache"> + <longdesc lang="en"> + 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. + </longdesc> + <shortdesc lang="en"> + Enable exportfs list caching + </shortdesc> + <content type="integer"/> + </parameter> + + </parameters> <actions> @@ -308,14 +340,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 \ + + 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 -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=$? - if [ $rv -ne 0 ]; then - ocf_log info "nfsclient:$OCF_RESKEY_name is not running!" - exit $OCF_NOT_RUNNING + + [ -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 3a3e3a8..04f968d 100644 --- a/rgmanager/src/resources/service.sh +++ b/rgmanager/src/resources/service.sh @@ -108,6 +108,27 @@ meta_data() </shortdesc> <content type="boolean" default="0"/> </parameter> + + <parameter name="nfs_client_cache"> + <longdesc lang="en"> + 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. + </longdesc> + <shortdesc lang="en"> + Enable exportfs list caching + </shortdesc> + <content type="integer" default="0"/> + </parameter> + <parameter name="recovery" reconfig="1"> <longdesc lang="en">
reply other threads:[~2008-09-24 18:07 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080924175655.B47A6120435@lists.fedorahosted.org \ --to=lon@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).