Skip to content

Commit

Permalink
Release version 0.12.
Browse files Browse the repository at this point in the history
 - Remove IP address parameter from trigger RA.
 - Trigger grace from notify action.
  • Loading branch information
jarrpa committed Sep 25, 2016
1 parent 8bd49b0 commit 56eaa9f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 33 deletions.
74 changes: 43 additions & 31 deletions src/ganesha_trigger
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,14 @@ ganesha nfs daemon.
</longdesc>
<shortdesc lang="en">ganesha TAKE_IP trigger</shortdesc>
<parameters>
<parameter name="ip" unique="0" required="1">
<longdesc lang="en">
The IP address to issue triggers for.
</longdesc>
<shortdesc lang="en">IP address</shortdesc>
<content type="string" default="" />
</parameter>
</parameters>
<parameters/>
<actions>
<action name="start" timeout="40" />
<action name="stop" timeout="40" />
<action name="status" depth="0" timeout="20" interval="10" />
<action name="monitor" depth="0" timeout="20" interval="10" />
<action name="notify" timeout="20" />
<action name="meta-data" timeout="20" />
<action name="validate-all" timeout="20" />
</actions>
Expand All @@ -75,31 +66,53 @@ END
#######################################################################
CMD=`basename $0`

usage() {
trigger_usage() {
cat <<END
usage: $CMD {start|stop|status|monitor|validate-all|meta-data}
Expects to have a fully populated OCF RA-compliant environment set.
END
}

start() {
trigger_start() {
ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" start
return $OCF_SUCCESS
}

dbus-send --print-reply --system --dest=org.ganesha.nfsd \
/org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \
string:${OCF_RESKEY_ip}
rc=$?
if [ $rc -ne 0 ]; then
ocf-log warn "FAILED: dbus-send --print-reply --system "\
grace() {
rc=1
# Loop until success or timeout
while [ rc != 0 ]; do
dbus-send --print-reply --system --dest=org.ganesha.nfsd \
/org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \
string:${1}
rc=$?
if [ $rc -ne 0 ]; then
ocf_log warn "FAILED: dbus-send --print-reply --system "\
"--dest=org.ganesha.nfsd /org/ganesha/nfsd/admin "\
"org.ganesha.nfsd.admin.grace string:${OCF_RESKEY_ip}"
fi
"org.ganesha.nfsd.admin.grace string:${1}"
sleep 1;
fi
done
}

return $rc
trigger_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
pre-start)
grace "5:$OCF_RESKEY_CRM_meta_notify_start_uname"
;;
post-stop)
grace "2:$OCF_RESKEY_CRM_meta_notify_stop_uname"
;;
esac

return $OCF_SUCCESS
}

stop() {
trigger_stop() {
ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" stop
return $OCF_SUCCESS
}
Expand All @@ -114,16 +127,15 @@ usage|help) usage
;;
esac

if [ -z "$OCF_RESKEY_ip" ]; then
ocf_log err "Please set OCF_RESKEY_ip"
exit $OCF_ERR_CONFIGURED
fi

case $__OCF_ACTION in
status|monitor|validate-all) exit $OCF_SUCCESS;;
start) start;;
stop) stop;;
*) usage
start) trigger_start;;
stop) trigger_stop;;
notify) trigger_notify;;
usage|help) trigger_usage
exit $OCF_SUCCESS
;;
*) trigger_usage
exit $OCF_ERR_UNIMPLEMENTED
;;
esac
Expand Down
2 changes: 0 additions & 2 deletions src/storhaug
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,6 @@ create_virt_ip()
pcs -f ${cibfile} constraint location vip${ipcount} rule resource-discovery=exclusive score=0 role eq storage

pcs -f ${cibfile} resource create vip${ipcount}_trigger ocf:heartbeat:ganesha_trigger \
params \
ip=${ip} \
meta resource-stickiness="0"

pcs -f ${cibfile} constraint colocation add vip${ipcount}_trigger with vip${ipcount} INFINITY
Expand Down

0 comments on commit 56eaa9f

Please sign in to comment.