Merge "Fix nova compute addition with limit"

This commit is contained in:
Zuul 2020-04-16 15:33:44 +00:00 committed by Gerrit Code Review
commit 2e2672e753
5 changed files with 38 additions and 17 deletions

View File

@ -1,5 +1,7 @@
---
- import_tasks: get_cell_settings.yml
when:
- inventory_hostname == groups[nova_conductor.group][0] | default(None)
- name: Create cell
vars:

View File

@ -20,4 +20,22 @@
meta: flush_handlers
- include_tasks: discover_computes.yml
when: inventory_hostname in groups[nova_cell_conductor_group]
vars:
# List of virtualised compute hypervisors in this Ansible play batch.
virt_computes_in_batch: >-
{{ groups[nova_cell_compute_group] |
intersect(ansible_play_batch) |
list }}
# List of iroinc compute hosts in this Ansible play batch.
ironic_computes_in_batch: >-
{{ (groups[nova_cell_compute_ironic_group] |
intersect(ansible_play_batch) |
list)
if nova_cell_services['nova-compute-ironic'].enabled | bool else [] }}
all_computes_in_batch: "{{ virt_computes_in_batch + ironic_computes_in_batch }}"
when:
# Run discovery when one or more compute hosts are in the Ansible batch,
# and there is a cell conductor in the inventory to delegate to.
- all_computes_in_batch | length > 0
- inventory_hostname == all_computes_in_batch[0]
- groups[nova_cell_conductor_group] | length > 0

View File

@ -9,22 +9,19 @@
# 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) |
{{ virt_computes_in_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 [] }}
{{ ironic_computes_in_batch |
map('extract', hostvars, 'ansible_hostname') |
map('regex_replace', '^(.*)$', '\1-ironic') |
list }}
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)
delegate_to: "{{ groups[nova_cell_conductor_group][0] }}"
- name: Waiting for nova-compute services to register themselves
become: true
@ -60,17 +57,17 @@
map(attribute='Host') |
list)
is superset(expected_compute_service_hosts)
when: inventory_hostname == groups[nova_cell_conductor_group][0] | default(None)
delegate_to: "{{ groups[nova_cell_conductor_group][0] }}"
- import_tasks: get_cell_settings.yml
delegate_to: "{{ groups[nova_cell_conductor_group][0] }}"
- 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
when: not nova_cell_settings
delegate_to: "{{ groups[nova_cell_conductor_group][0] }}"
# TODO(yoctozepto): no need to do --by-service if ironic not used
- name: Discover nova hosts
@ -78,4 +75,4 @@
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)
delegate_to: "{{ groups[nova_cell_conductor_group][0] }}"

View File

@ -18,11 +18,9 @@
changed_when: false
failed_when:
- existing_cells_list.rc != 0
when: inventory_hostname == groups[nova_conductor.group][0] | default(None)
- name: Extract current cell settings from list
vars:
nova_conductor: "{{ nova_cell_services['nova-conductor'] }}"
set_fact:
nova_cell_settings: "{{ existing_cells_list | extract_cell(nova_cell_name) }}"
when: inventory_hostname == groups[nova_conductor.group][0] | default(None)

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue with Nova when deploying new compute hosts using
``--limit``. `LP#1869371
<https://bugs.launchpad.net/kolla-ansible/+bug/1869371>`__.