# vim: set ft=upstart et ts=2:
description "Nova compute worker"
author "Soren Hansen <soren@linux2go.dk>"

start on runlevel [2345]
stop on runlevel [!2345]

chdir /var/run

pre-start script
  mkdir -p /var/run/nova
  chown nova:root /var/run/nova/

  mkdir -p /var/lock/nova
  chown nova:root /var/lock/nova/

  modprobe nbd

  # If libvirt-bin is installed, always wait for it to start first
  if status libvirt-bin; then
    start wait-for-state WAIT_FOR=libvirt-bin WAIT_STATE=running WAITER=nova-compute
  fi
end script


script
  if [ -r /etc/default/$UPSTART_JOB ]; then
    . /etc/default/$UPSTART_JOB
  fi

  start-stop-daemon --start --chuid nova --exec /usr/bin/nova-compute -- --config-file=/etc/nova/nova.conf $NOVA_COMPUTE_OPTS
end script

