
This patch adds initial support for deploying multiple Nova cells. Splitting a nova-cell role out from the Nova role allows a more granular approach to deploying and configuring Nova services. A new enable_cells flag has been added that enables the support of multiple cells via the introduction of a super conductor in addition to cell-specific conductors. When this flag is not set (the default), nova is configured in the same manner as before - with a single conductor. The nova role now deploys the global services: * nova-api * nova-scheduler * nova-super-conductor (if enable_cells is true) The nova-cell role handles services specific to a cell: * nova-compute * nova-compute-ironic * nova-conductor * nova-libvirt * nova-novncproxy * nova-serialproxy * nova-spicehtml5proxy * nova-ssh This patch does not support using a single cell controller for managing more than one cell. Support for sharing a cell controller will be added in a future patch. This patch should be backwards compatible and is tested by existing CI jobs. A new CI job has been added that tests a multi-cell environment. ceph-mon has been removed from the play hosts list as it is not necessary - delegate_to does not require the host to be in the play. Documentation will be added in a separate patch. Partially Implements: blueprint support-nova-cells Co-Authored-By: Mark Goddard <mark@stackhpc.com> Change-Id: I810aad7d49db3f5a7fd9a2f0f746fd912fe03917
82 lines
3.5 KiB
YAML
82 lines
3.5 KiB
YAML
---
|
|
# We need to wait for all expected compute services to register before running
|
|
# cells v2 host discovery. This includes virtualised compute services and
|
|
# ironic compute services.
|
|
# Work with --limit by including only hosts in ansible_play_batch.
|
|
- name: Build a list of expected compute service hosts
|
|
vars:
|
|
# For virt, use ansible_nodename rather than inventory_hostname, since this
|
|
# is similar to what nova uses internally as its default for the
|
|
# [DEFAULT] host config option.
|
|
virt_compute_service_hosts: >-
|
|
{{ groups[nova_cell_compute_group] |
|
|
intersect(ansible_play_batch) |
|
|
map('extract', hostvars, 'ansible_nodename') |
|
|
list }}
|
|
# For ironic, use {{ansible_hostname}}-ironic since this is what we
|
|
# configure for [DEFAULT] host in nova.conf.
|
|
ironic_compute_service_hosts: >-
|
|
{{ (groups[nova_cell_compute_ironic_group] |
|
|
intersect(ansible_play_batch) |
|
|
map('extract', hostvars, 'ansible_hostname') |
|
|
map('regex_replace', '^(.*)$', '\1-ironic') |
|
|
list)
|
|
if nova_cell_services['nova-compute-ironic'].enabled | bool else [] }}
|
|
set_fact:
|
|
expected_compute_service_hosts: "{{ virt_compute_service_hosts + ironic_compute_service_hosts }}"
|
|
when: inventory_hostname == groups[nova_cell_conductor_group][0] | default(None)
|
|
|
|
- name: Waiting for nova-compute services to register themselves
|
|
become: true
|
|
command: >
|
|
docker exec kolla_toolbox openstack
|
|
--os-interface internal
|
|
--os-auth-url {{ keystone_admin_url }}
|
|
--os-identity-api-version 3
|
|
--os-project-domain-name {{ openstack_auth.domain_name }}
|
|
--os-tenant-name {{ openstack_auth.project_name }}
|
|
--os-username {{ openstack_auth.username }}
|
|
--os-password {{ keystone_admin_password }}
|
|
--os-user-domain-name {{ openstack_auth.domain_name }}
|
|
--os-region-name {{ openstack_region_name }}
|
|
{% if openstack_cacert != '' %}--os-cacert {{ openstack_cacert }}{% endif %}
|
|
compute service list --format json --column Host --service nova-compute
|
|
register: nova_compute_services
|
|
changed_when: false
|
|
retries: 20
|
|
delay: 10
|
|
until:
|
|
- nova_compute_services is success
|
|
# A list containing the 'Host' field of compute services that have
|
|
# registered themselves. Don't exclude compute services that are disabled
|
|
# since these could have been explicitly disabled by the operator. While we
|
|
# could exclude services that are down, the nova-manage cell_v2
|
|
# discover_hosts does not do this so let's not block on it here.
|
|
# NOTE(mgoddard): Cannot factor this out into an intermediary variable
|
|
# before ansible 2.8, due to
|
|
# https://bugs.launchpad.net/kolla-ansible/+bug/1835817.
|
|
- (nova_compute_services.stdout |
|
|
from_json |
|
|
map(attribute='Host') |
|
|
list)
|
|
is superset(expected_compute_service_hosts)
|
|
when: inventory_hostname == groups[nova_cell_conductor_group][0] | default(None)
|
|
|
|
- import_tasks: get_cell_settings.yml
|
|
|
|
- name: Fail if cell settings not found
|
|
fail:
|
|
msg: >-
|
|
Unable to find settings for {{ nova_cell_name or 'the default cell' }}.
|
|
when:
|
|
- inventory_hostname == groups[nova_cell_conductor_group][0] | default(None)
|
|
- not nova_cell_settings
|
|
|
|
# TODO(yoctozepto): no need to do --by-service if ironic not used
|
|
- name: Discover nova hosts
|
|
become: true
|
|
command: >
|
|
docker exec nova_conductor nova-manage cell_v2 discover_hosts --by-service --cell_uuid {{ nova_cell_settings.cell_uuid }}
|
|
changed_when: False
|
|
when: inventory_hostname == groups[nova_cell_conductor_group][0] | default(None)
|