kolla-ansible/ansible/roles/nova-cell/tasks/get_cell_settings.yml
Mark Goddard 3af28d2151 Fix nova compute addition with limit
Deploy a small cloud. Add one host to the compute group in the
inventory, and scale out:

$ kolla-ansible deploy --limit <new compute host>

The command succeeds, but creating an instance fails with the following:

    Host 'compute0' is not mapped to any cell

This happens because we only discover computes on the first host in the
cell's nova conductor group. If that host is not in the specified limit,
the discovery will not happen.

This change fixes the issue by running compute discovery when any ironic
or virtualised compute hosts are in the play batch, and delegating it to
a conductor.

Change-Id: Ie984806240d147add825ffa8446ae6ff55ca4814
Closes-Bug: #1869371
2020-04-14 19:36:49 +00:00

27 lines
869 B
YAML

---
- name: Get a list of existing cells
vars:
nova_conductor: "{{ nova_cell_services['nova-conductor'] }}"
become: true
kolla_docker:
action: "start_container"
command: bash -c 'sudo -E kolla_set_configs && nova-manage cell_v2 list_cells --verbose'
common_options: "{{ docker_common_options }}"
detach: False
image: "{{ nova_conductor.image }}"
labels:
BOOTSTRAP:
name: "nova_list_cells"
restart_policy: no
volumes: "{{ nova_cell_bootstrap_default_volumes + nova_cell_bootstrap_extra_volumes }}"
register: existing_cells_list
changed_when: false
failed_when:
- existing_cells_list.rc != 0
- 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) }}"