diff options
Diffstat (limited to 'extras/ganesha/ocf/ganesha_mon')
| -rw-r--r-- | extras/ganesha/ocf/ganesha_mon | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/extras/ganesha/ocf/ganesha_mon b/extras/ganesha/ocf/ganesha_mon index 65450b82209..2b4a9d6da84 100644 --- a/extras/ganesha/ocf/ganesha_mon +++ b/extras/ganesha/ocf/ganesha_mon @@ -124,18 +124,22 @@ ganesha_mon_stop() ganesha_mon_monitor() { - local short_host=$(hostname -s) - local pid_file="/var/run/ganesha.nfsd.pid" + local host=$(hostname -s) + local pid_file="/var/run/ganesha.pid" + local rhel6_pid_file="/var/run/ganesha.nfsd.pid" + local proc_pid="/proc/" # RHEL6 /etc/init.d/nfs-ganesha adds -p /var/run/ganesha.nfsd.pid # RHEL7 systemd does not. Would be nice if all distros used the # same pid file. - if [ -e /usr/lib/systemd/system/nfs-ganesha.service ]; then - pid_file="/var/run/ganesha.pid" + if [ -e ${rhel6_pid_file} ]; then + pid_file=${rhel6_pid_file} + fi + if [ -e ${pid_file} ]; then + proc_pid="${proc_pid}$(cat ${pid_file})" fi - if [ -e ${pid_file} -a \ - -d /proc/$(cat ${pid_file} ) ]; then + if [ "x${proc_pid}" != "x/proc/" -a -d ${proc_pid} ]; then attrd_updater -n ${OCF_RESKEY_ganesha_active} -v 1 if [ $? -ne 0 ]; then @@ -153,9 +157,14 @@ ganesha_mon_monitor() # track grace-active crm_attr (attr != crm_attr) # we can't just use the attr as there's no way to query # its value in RHEL6 pacemaker - crm_attribute --node=${short_host} --lifetime=forever --name=${OCF_RESKEY_grace_active} --update=1 + + crm_attribute --node=${host} --lifetime=forever --name=${OCF_RESKEY_grace_active} --update=1 2> /dev/null if [ $? -ne 0 ]; then - ocf_log info "warning: crm_attribute --node=${short_host} --lifetime=forever --name=${OCF_RESKEY_grace_active} --update=1 failed" + host=$(hostname) + crm_attribute --node=${host} --lifetime=forever --name=${OCF_RESKEY_grace_active} --update=1 2> /dev/null + if [ $? -ne 0 ]; then + ocf_log info "mon monitor warning: crm_attribute --node=${host} --lifetime=forever --name=${OCF_RESKEY_grace_active} --update=1 failed" + fi fi return ${OCF_SUCCESS} @@ -173,16 +182,26 @@ ganesha_mon_monitor() # the remaining ganesha.nfsds into grace before # initiating the VIP fail-over. - sleep ${OCF_RESKEY_grace_delay} - attrd_updater -D -n ${OCF_RESKEY_grace_active} if [ $? -ne 0 ]; then ocf_log info "warning: attrd_updater -D -n ${OCF_RESKEY_grace_active} failed" fi - crm_attribute --node=${short_host} --name=${OCF_RESKEY_grace_active} --update=0 + host=$(hostname -s) + crm_attribute --node=${host} --name=${OCF_RESKEY_grace_active} --update=0 2> /dev/null + if [ $? -ne 0 ]; then + host=$(hostname) + crm_attribute --node=${host} --name=${OCF_RESKEY_grace_active} --update=0 2> /dev/null + if [ $? -ne 0 ]; then + ocf_log info "mon monitor warning: crm_attribute --node=${host} --name=${OCF_RESKEY_grace_active} --update=0 failed" + fi + fi + + sleep ${OCF_RESKEY_grace_delay} + + attrd_updater -D -n ${OCF_RESKEY_ganesha_active} if [ $? -ne 0 ]; then - ocf_log info "warning: crm_attribute --node=${short_host} --name=${OCF_RESKEY_grace_active} --update=0 failed" + ocf_log info "warning: attrd_updater -D -n ${OCF_RESKEY_ganesha_active} failed" fi return ${OCF_SUCCESS} @@ -213,4 +232,3 @@ rc=$? # The resource agent may optionally log a debug message ocf_log debug "${OCF_RESOURCE_INSTANCE} ${__OCF_ACTION} returned $rc" exit $rc - |
