diff --git a/hooks/nova-compute-common b/hooks/nova-compute-common index 9ae78dc..83752ac 100755 --- a/hooks/nova-compute-common +++ b/hooks/nova-compute-common @@ -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 } diff --git a/hooks/start b/hooks/start new file mode 120000 index 0000000..6f9ff4f --- /dev/null +++ b/hooks/start @@ -0,0 +1 @@ +nova-compute-relations \ No newline at end of file diff --git a/hooks/stop b/hooks/stop new file mode 120000 index 0000000..6f9ff4f --- /dev/null +++ b/hooks/stop @@ -0,0 +1 @@ +nova-compute-relations \ No newline at end of file diff --git a/metadata.yaml b/metadata.yaml index 58ce8c8..0868e30 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -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