docker support
Change-Id: I30ae4e8820c86ce2432cac7d0f39e1b9fab7a727
diff --git a/nova/controller.sls b/nova/controller.sls
index 90c721f..1cde73a 100644
--- a/nova/controller.sls
+++ b/nova/controller.sls
@@ -63,6 +63,8 @@
- require:
- pkg: nova_controller_packages
+{%- if not grains.get('noservices', False) %}
+
nova_controller_syncdb:
cmd.run:
- names:
@@ -84,3 +86,16 @@
- file: /etc/nova/api-paste.ini
{%- endif %}
+
+{%- if grains.get('virtual_subtype', None) == "Docker" %}
+
+nova_entrypoint:
+ file.managed:
+ - name: /entrypoint.sh
+ - template: jinja
+ - source: salt://nova/files/entrypoint.sh
+ - mode: 755
+
+{%- endif %}
+
+{%- endif %}
diff --git a/nova/files/entrypoint.sh b/nova/files/entrypoint.sh
new file mode 100644
index 0000000..35c88fc
--- /dev/null
+++ b/nova/files/entrypoint.sh
@@ -0,0 +1,37 @@
+{%- from "nova/map.jinja" import controller with context -%}
+#!/bin/bash -e
+
+cat /srv/salt/pillar/nova-controller.sls | envsubst > /tmp/nova-controller.sls
+mv /tmp/nova-controller.sls /srv/salt/pillar/nova-controller.sls
+
+salt-call --local --retcode-passthrough state.highstate
+
+{% for service in controller.services %}
+service {{ service }} stop || true
+{% endfor %}
+
+if [ "$1" == "api" ]; then
+ echo "starting nova-api"
+ su nova --shell=/bin/sh -c '/usr/bin/nova-api --config-file=/etc/nova/nova.conf'
+elif [ "$1" == "scheduler" ]; then
+ echo "starting nova-scheduler"
+ su nova --shell=/bin/sh -c '/usr/bin/nova-scheduler --config-file=/etc/nova/nova.conf'
+elif [ "$1" == "conductor" ]; then
+ echo "starting nova-conductor"
+ su nova --shell=/bin/sh -c '/usr/bin/nova-conductor --config-file=/etc/nova/nova.conf'
+elif [ "$1" == "consoleauth" ]; then
+ echo "starting nova-consoleauth"
+ su nova --shell=/bin/sh -c '/usr/bin/nova-consoleauth --config-file=/etc/nova/nova.conf'
+elif [ "$1" == "cert" ]; then
+ echo "starting nova-cert"
+ su nova --shell=/bin/sh -c '/usr/bin/nova-cert --config-file=/etc/nova/nova.conf'
+elif [ "$1" == "novncproxy" ]; then
+ echo "starting nova-novncproxy"
+ su nova --shell=/bin/sh -c '/usr/bin/nova-novncproxy --config-file=/etc/nova/nova.conf'
+else
+ echo "No parameter submitted, don't know what to start" 1>&2
+fi
+
+{#-
+vim: syntax=jinja
+-#}
\ No newline at end of file
diff --git a/nova/map.jinja b/nova/map.jinja
index d8d7f36..96f8976 100644
--- a/nova/map.jinja
+++ b/nova/map.jinja
@@ -7,7 +7,7 @@
{% set controller = salt['grains.filter_by']({
'Debian': {
- 'pkgs': ['nova-novncproxy', 'novnc', 'nova-api', 'nova-ajax-console-proxy', 'nova-cert', 'nova-conductor', 'nova-consoleauth', 'nova-doc', 'nova-scheduler', 'python-novaclient', 'python-memcache'],
+ 'pkgs': ['nova-novncproxy', 'novnc', 'nova-api', 'nova-ajax-console-proxy', 'nova-cert', 'nova-conductor', 'nova-consoleauth', 'nova-doc', 'nova-scheduler', 'python-novaclient', 'python-memcache', 'gettext-base'],
'services': ['nova-api', 'nova-cert', 'nova-consoleauth', 'nova-scheduler', 'nova-conductor', 'nova-novncproxy'],
'debug': false,
},
@@ -20,7 +20,7 @@
{% set compute = salt['grains.filter_by']({
'Debian': {
- 'pkgs': ['nova-compute-kvm', 'python-novaclient', 'pm-utils', 'sysfsutils', 'sg3-utils', 'libvirt-bin', 'python-memcache', 'qemu-kvm','python-guestfs'],
+ 'pkgs': ['nova-compute-kvm', 'python-novaclient', 'pm-utils', 'sysfsutils', 'sg3-utils', 'libvirt-bin', 'python-memcache', 'qemu-kvm','python-guestfs', 'gettext-base'],
'services': ['nova-compute'],
'libvirt_config': 'libvirtd.conf',
'libvirt_service': 'libvirtd',