Fix up nova_ctl upstart interaction

This commit is contained in:
Adam Gandelman 2011-08-04 11:10:40 -07:00
parent eb3474908d
commit 765b7d21d8
4 changed files with 22 additions and 5 deletions

View File

@ -29,6 +29,17 @@ function set_or_update {
fi
}
function nova_ctl_status {
SERVICE=$1
# workaround upstarts lack of scriptable return codes
STATUS=$(service nova-compute status | cut -d/ -f1 | awk '{ print $2 }')
case $STATUS in
"start") return 0 ;;
"stop") return 1 ;;
*) echo "ERROR: Unexpected status of service $I: $STATUS" && exit 1 ;;
esac
}
function nova_ctl {
if [[ $1 == "all" ]] ; then
CTL=$SERVICES
@ -41,10 +52,14 @@ function nova_ctl {
exit 1
fi
for i in $CTL ; do
service $i $ACTION
if [[ $? != 0 ]] ; then
ensemble-log "ERROR nova_ctl: Service $i failed to $ACTION"
fi
case $ACTION in
"start")
nova_ctl_status $i || service $i start ;;
"stop")
nova_ctl_status $i && service $i stop || return 0 ;;
"restart")
nova_ctl_status $i && service $i restart || service $i start ;;
esac
done
}

1
hooks/start Symbolic link
View File

@ -0,0 +1 @@
nova-compute-relations

1
hooks/stop Symbolic link
View File

@ -0,0 +1 @@
nova-compute-relations

View File

@ -1,6 +1,6 @@
ensemble: formula
name: nova-compute
revision: 16
revision: 17
summary: "OpenStack compute"
description: |
OpenStack Compute, codenamed Nova, is a cloud computing fabric controller. In