From c779511511f4b232a69810ccbcf45e9baf5a0ad2 Mon Sep 17 00:00:00 2001 From: Andrey Shestakov Date: Fri, 25 Dec 2015 18:07:41 +0200 Subject: [PATCH] Add container for nova-compute-ironic Implements blueprint ironic-compute-container Change-Id: I110bf3aa94bdfd33038ed39d78bd40ea30b13e57 --- ansible/inventory/all-in-one | 3 +++ ansible/roles/ironic/tasks/register.yml | 2 +- ansible/roles/nova/defaults/main.yml | 3 +++ ansible/roles/nova/tasks/config.yml | 3 +++ ansible/roles/nova/tasks/start.yml | 24 +++++++++++++++++++ .../templates/nova-compute-ironic.json.j2 | 12 ++++++++++ ansible/roles/nova/templates/nova.conf.j2 | 14 ++++++----- docker/nova/nova-compute-ironic/Dockerfile.j2 | 16 +++++++++++++ 8 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 ansible/roles/nova/templates/nova-compute-ironic.json.j2 create mode 100644 docker/nova/nova-compute-ironic/Dockerfile.j2 diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 5c7d88e544..458ea36f24 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -99,6 +99,9 @@ nova [nova-spicehtml5proxy:children] nova +[nova-compute-ironic:children] +nova + # Neutron [neutron-server:children] neutron diff --git a/ansible/roles/ironic/tasks/register.yml b/ansible/roles/ironic/tasks/register.yml index ce44210f20..518fa3a494 100644 --- a/ansible/roles/ironic/tasks/register.yml +++ b/ansible/roles/ironic/tasks/register.yml @@ -23,7 +23,7 @@ command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m kolla_keystone_user -a "project=service - user=ironic + user={{ ironic_keystone_user }} password={{ ironic_keystone_password }} role=admin region_name={{ openstack_region_name }} diff --git a/ansible/roles/nova/defaults/main.yml b/ansible/roles/nova/defaults/main.yml index 8a9b3bc16a..812a4ea235 100644 --- a/ansible/roles/nova/defaults/main.yml +++ b/ansible/roles/nova/defaults/main.yml @@ -61,6 +61,9 @@ nova_data_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docke nova_data_tag: "{{ openstack_release }}" nova_data_image_full: "{{ nova_data_image }}:{{ nova_data_tag }}" +nova_compute_ironic_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-compute-ironic" +nova_compute_ironic_tag: "{{ openstack_release }}" +nova_compute_ironic_image_full: "{{ nova_compute_ironic_image }}:{{ nova_compute_ironic_tag }}" #################### # Openstack diff --git a/ansible/roles/nova/tasks/config.yml b/ansible/roles/nova/tasks/config.yml index 6d7a742d8a..b1685965df 100644 --- a/ansible/roles/nova/tasks/config.yml +++ b/ansible/roles/nova/tasks/config.yml @@ -25,6 +25,7 @@ with_items: - "nova-api" - "nova-compute" + - "nova-compute-ironic" - "nova-conductor" - "nova-consoleauth" - "nova-libvirt" @@ -39,6 +40,7 @@ with_items: - "nova-api" - "nova-compute" + - "nova-compute-ironic" - "nova-conductor" - "nova-consoleauth" - "nova-libvirt" @@ -61,6 +63,7 @@ with_items: - "nova-api" - "nova-compute" + - "nova-compute-ironic" - "nova-conductor" - "nova-consoleauth" - "nova-novncproxy" diff --git a/ansible/roles/nova/tasks/start.yml b/ansible/roles/nova/tasks/start.yml index 1ea4c34bfc..277b0309ec 100644 --- a/ansible/roles/nova/tasks/start.yml +++ b/ansible/roles/nova/tasks/start.yml @@ -202,3 +202,27 @@ env: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" when: inventory_hostname in groups['compute'] + +- name: Starting Nova-compute-ironic container + docker: + tty: True + net: host + pull: "{{ docker_pull_policy }}" + restart_policy: "{{ docker_restart_policy }}" + restart_policy_retry: "{{ docker_restart_policy_retry }}" + state: reloaded + registry: "{{ docker_registry }}" + username: "{{ docker_registry_username }}" + password: "{{ docker_registry_password }}" + insecure_registry: "{{ docker_insecure_registry }}" + privileged: True + name: nova_compute_ironic + image: "{{ nova_compute_ironic_image_full }}" + volumes: + - "{{ node_config_directory }}/nova-compute-ironic/:{{ container_config_directory }}/:ro" + - "/var/lib/kolla/dev/log:/dev/log" + env: + KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + when: + - inventory_hostname in groups['nova-compute-ironic'] + - enable_ironic | bool diff --git a/ansible/roles/nova/templates/nova-compute-ironic.json.j2 b/ansible/roles/nova/templates/nova-compute-ironic.json.j2 new file mode 100644 index 0000000000..c89df44094 --- /dev/null +++ b/ansible/roles/nova/templates/nova-compute-ironic.json.j2 @@ -0,0 +1,12 @@ +{ + "command": "nova-compute", + "config_files": [ + { + "source": "{{ container_config_directory }}/nova.conf", + "dest": "/etc/nova/nova.conf", + "owner": "nova", + "perm": "0600" + } + ] +} + diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2 index 781d8dba1a..1d7e95772f 100644 --- a/ansible/roles/nova/templates/nova.conf.j2 +++ b/ansible/roles/nova/templates/nova.conf.j2 @@ -33,12 +33,14 @@ linuxnet_interface_driver = nova.network.linux_net.BridgeInterfaceDriver allow_resize_to_same_host = true {% if enable_ironic | bool %} -compute_driver = nova.virt.ironic.IronicDriver scheduler_host_manager = nova.scheduler.ironic_host_manager.IronicHostManager +{% endif %} + +{% if service_name == "nova-compute-ironic" %} +compute_driver = nova.virt.ironic.IronicDriver +vnc_enabled = False ram_allocation_ratio = 1.0 reserved_host_memory_mb = 0 -compute_manager = ironic.nova.compute.manager.ClusteredComputeManager -scheduler_use_baremetal_filters = True {% else %} compute_driver = libvirt.LibvirtDriver {% endif %} @@ -72,13 +74,13 @@ html5proxy_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['i html5proxy_port = {{ nova_spicehtml5proxy_port }} {% endif %} -{% if enable_ironic | bool %} +{% if service_name == "nova-compute-ironic" %} [ironic] #(TODO) remember to update this once discoverd is replaced by inspector admin_username = {{ ironic_keystone_user }} admin_password = {{ ironic_keystone_password }} -admin_url = {{ openstack_auth.auth_url }} -admin_tenant_name = {{ openstack_auth.project_name }} +admin_url = {{ openstack_auth_v2.auth_url }} +admin_tenant_name = service api_endpoint = http://{{ kolla_internal_address }}:{{ ironic_api_port }}/v1 {% endif %} diff --git a/docker/nova/nova-compute-ironic/Dockerfile.j2 b/docker/nova/nova-compute-ironic/Dockerfile.j2 new file mode 100644 index 0000000000..5851017935 --- /dev/null +++ b/docker/nova/nova-compute-ironic/Dockerfile.j2 @@ -0,0 +1,16 @@ +FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% if install_type == 'binary' %} + {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} + +RUN yum -y install \ + openstack-nova-compute \ + && yum clean all + + {% endif %} +{% endif %} + +{{ include_footer }} + +USER nova