• R/O
  • SSH

pm_extras: Commit

※リポジトリは、https://github.com/linux-ha-japan/pm_extras-1.0 へ移行しました。

Pacemaker用拡張リソースエージェント・プラグインパッケージ。

Heartbeat-2.* 用 hb-extras パッケージ(*)の Pacemaker 1.0対応版
(*) http://sourceforge.jp/projects/linux-ha/releases/?package_id=10538


Commit MetaInfo

Revision09ef1ff0c1a35ed0174c6dc632ba3d41ac6725c3 (tree)
Time2011-06-01 09:29:54
Author <hideoyamauchi@hg.s...>

Log Message

ontrol an error at the time of the crm file update.

Change Summary

Incremental Difference

diff -r 3182f2a4b5eb -r 09ef1ff0c1a3 resources/NVclient
--- a/resources/NVclient Wed May 25 13:26:47 2011 +0900
+++ b/resources/NVclient Wed Jun 01 09:29:54 2011 +0900
@@ -4,7 +4,7 @@
44 #
55 # Description: Manages NetVault client as an OCF resource in
66 # an Active-Passive High Availability setup.
7-# Version: 1.4 (2009/11/30)
7+# Version: 1.5 (2011/05/27)
88 # Author: Takayuki Tanaka
99 # License: GNU General Public License (GPL)
1010 # Copyright (c) 2007 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
@@ -22,51 +22,47 @@
2222 ##########################################################################
2323 # Initialization:
2424
25-. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
26-#. /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs
25+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat}
26+. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs
2727
2828 USAGE="usage: $0 {start|stop|monitor|meta-data}";
2929 RESOURCE_LOCKFILES="/var/lock/subsys/netvault"
3030
31-# Save Parameter
32-NV_HOME=${OCF_RESKEY_nv_home}
33-#NV_HOME=/usr/netvault
34-IGN_ERR_FLG=${OCF_RESKEY_ignore_error}
35-#IGN_ERR_FLG="off"
36-
31+OCF_RESKEY_ignore_error_default=off
32+: ${OCF_RESKEY_nv_home=`head -n 1 /etc/.nv6_home`}
33+: ${OCF_RESKEY_ignore_error=${OCF_RESKEY_ignore_error_default}}
3734
3835 #
3936 # Get meta-data Method
4037 #
4138 meta_data() {
42- findnvhome
4339 cat <<END
4440 <?xml version="1.0"?>
4541 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
4642 <resource-agent name="NVclient">
47-<version>1.4</version>
43+<version>1.5</version>
4844
4945 <longdesc lang="en">
50-Resource script for NetVault client. It manages a Standardres instance as an HA resource.
46+Resource Agent script for NetVault client. It manages a NetVault client instance as a HA resource.
5147 </longdesc>
5248 <shortdesc lang="en">NetVault client resource agent</shortdesc>
5349
5450 <parameters>
55-<parameter name="nv_home" unique="1" required="1">
51+<parameter name="nv_home" unique="1">
5652 <longdesc lang="en">
5753 The NetVault home directory (NV_HOME).
58-If not specified, then the SID along with its home should be listed in
59-For example, "/usr/netvault"
54+It should be on the shared disk in the typical NetVault cluster configuration.
55+Refer to /etc/.nv6_home to make sure your configuration.
6056 </longdesc>
6157 <shortdesc lang="en">home directory name</shortdesc>
62-<content type="string" default="${NV_HOME}" />
58+<content type="string" default="`head -n 1 /etc/.nv6_home`" />
6359 </parameter>
6460 <parameter name="ignore_error" unique="1">
6561 <longdesc lang="en">
6662 In case ignore error that this value is "on". Default is "off".
6763 </longdesc>
6864 <shortdesc lang="en">ignore error flag</shortdesc>
69-<content type="string" default="off" />
65+<content type="string" default="${OCF_RESKEY_ignore_error_default}" />
7066 </parameter>
7167 </parameters>
7268
@@ -90,8 +86,10 @@
9086 isRunning(){
9187 # process count
9288 RET=0
93- # the process is checked twice
94- for (( i = 0; i < 2; i++ )); do
89+
90+ # Retry the process check for the case of nvcmgr/nvnmgr process is
91+ # restarted by the main nvpmgr process.
92+ for i in 1 2 ; do
9593 RET=`ps -ef | grep -E 'nvpmgr|nvcmgr|nvnmgr' | grep -v grep | wc -l`
9694 # exist netvault process
9795 if [ $RET = 3 ]; then
@@ -100,7 +98,7 @@
10098 break
10199 fi
102100 fi
103- sleep 0.5
101+ sleep 1
104102 done
105103 return $RET
106104 }
@@ -139,7 +137,7 @@
139137 #
140138 netvault_status(){
141139 # call standard status command in netvault command
142- RETMSG=`${NV_HOME}/bin/nvpmgr status 2>&1`
140+ RETMSG=`${OCF_RESKEY_nv_home}/bin/nvpmgr status 2>&1`
143141 # check errors command output
144142 RET=$?
145143 if [ $RET -eq 0 ]; then
@@ -211,7 +209,7 @@
211209 return ${OCF_SUCCESS}
212210 elif [ $RET -eq 0 ]; then
213211 # netvault cleaning and start command
214- ${NV_HOME}/bin/nvpmgr startup
212+ ${OCF_RESKEY_nv_home}/bin/nvpmgr startup
215213 # check errors command output
216214 RET=$?
217215 if [ $RET -ne 0 ]; then
@@ -244,7 +242,7 @@
244242 netvault_pkill
245243 else
246244 # netvault stop
247- ${NV_HOME}/bin/nvpmgr shutdown
245+ ${OCF_RESKEY_nv_home}/bin/nvpmgr shutdown
248246 fi
249247
250248 # stop waiting
@@ -272,7 +270,7 @@
272270 rm -rf $RESOURCE_LOCKFILES
273271 outputLog navi "NetVault client stopped."
274272 return ${OCF_SUCCESS}
275- elif [ "${IGN_ERR_FLG}" = "on" ]; then
273+ elif [ "${OCF_RESKEY_ignore_error}" = "on" ]; then
276274 rm -rf $RESOURCE_LOCKFILES
277275 outputLog navi "NetVault client still hasn't stopped yet. Ignore Error."
278276 return ${OCF_SUCCESS}
@@ -282,25 +280,11 @@
282280
283281
284282 #
285-# get NV_HOME from /etc/.nv6_home if not set
286-#
287-findnvhome() {
288- if [ ! -d "${NV_HOME}" ]; then
289- NV_HOME=`head -n 1 /etc/.nv6_home`
290- fi
291- if [ ! -d "$NV_HOME" ]; then
292- MSG="Cannot locate NetVault home directory."
293- outputLog err ${OCF_ERR_GENERIC} $MSG
294- fi
295-}
296-
297-
298-#
299283 # Change Status Method
300284 #
301285 change_status(){
302286 RET_STATUS=$?
303- if [ "${IGN_ERR_FLG}" = "on" ]; then
287+ if [ "${OCF_RESKEY_ignore_error}" = "on" ]; then
304288 RET_STATUS=${OCF_SUCCESS}
305289 fi
306290 return ${RET_STATUS}
Show on old repository browser