diff options
Diffstat (limited to 'extras/ganesha/ocf/ganesha_grace')
| -rw-r--r-- | extras/ganesha/ocf/ganesha_grace | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/extras/ganesha/ocf/ganesha_grace b/extras/ganesha/ocf/ganesha_grace index 7c629f5e773..825f7164597 100644 --- a/extras/ganesha/ocf/ganesha_grace +++ b/extras/ganesha/ocf/ganesha_grace @@ -94,10 +94,22 @@ esac ganesha_grace_start() { local rc=${OCF_ERR_GENERIC} - local short_host=$(hostname -s) + local host=$(hostname -s) ocf_log debug "ganesha_grace_start()" - attr=$(crm_attribute --query --node=${short_host} --name=${OCF_RESKEY_grace_active}) + # give ganesha_mon RA a chance to set the crm_attr first + # I mislike the sleep, but it's not clear that looping + # with a small sleep is necessarily better + # start has a 40sec timeout, so a 5sec sleep here is okay + sleep 5 + attr=$(crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null) + if [ $? -ne 0 ]; then + host=$(hostname) + attr=$(crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null ) + if [ $? -ne 0 ]; then + ocf_log info "grace start: crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} failed" + fi + fi # Three possibilities: # 1. There is no attribute at all and attr_updater returns @@ -135,10 +147,11 @@ ganesha_grace_stop() ganesha_grace_notify() { + # since this is a clone RA we should only ever see pre-start + # or post-stop mode="${OCF_RESKEY_CRM_meta_notify_type}-${OCF_RESKEY_CRM_meta_notify_operation}" - case "$mode" in - post-stop) - ocf_log debug "stop_uname:${OCF_RESKEY_CRM_meta_notify_stop_uname}" + case "${mode}" in + pre-start | post-stop) dbus-send --print-reply --system --dest=org.ganesha.nfsd /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace string:${OCF_RESKEY_CRM_meta_notify_stop_uname} if [ $? -ne 0 ]; then ocf_log info "dbus-send --print-reply --system --dest=org.ganesha.nfsd /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace string:${OCF_RESKEY_CRM_meta_notify_stop_uname} failed" @@ -151,12 +164,18 @@ ganesha_grace_notify() ganesha_grace_monitor() { - local rc=${OCF_ERR_GENERIC} - local short_host=$(hostname -s) + local host=$(hostname -s) ocf_log debug "monitor" - attr=$(crm_attribute --query --node=${short_host} --name=${OCF_RESKEY_grace_active}) + attr=$(crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null) + if [ $? -ne 0 ]; then + host=$(hostname) + attr=$(crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null) + if [ $? -ne 0 ]; then + ocf_log info "crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} failed" + fi + fi # if there is no attribute (yet), maybe it's because # this RA started before ganesha_mon (nfs-mon) has had @@ -167,10 +186,10 @@ ganesha_grace_monitor() fi if [[ "${attr}" = *"value=1" ]]; then - rc=${OCF_SUCCESS} + return ${OCF_SUCCESS} fi - return ${rc} + return ${OCF_NOT_RUNNING} } ganesha_grace_validate() @@ -200,4 +219,3 @@ rc=$? # The resource agent may optionally log a debug message ocf_log debug "${OCF_RESOURCE_INSTANCE} ${__OCF_ACTION} returned $rc" exit $rc - |
