Fix the nova reconfigure in the multinode env

Checking the fix condition first in the when clause rather than the
dynamic condition. Otherwise it will raise issue, especially in
multinode env.

For example use

  when:
    - nova_console == 'novnc'
    - inventory_hostname in groups['nova-novncproxy']

rather than

  when:
    - inventory_hostname in groups['nova-novncproxy']
    - nova_console == 'novnc'

Because the nova-novncproxy groups may do not exist.

Change-Id: I1e76ee239908a17a4c2ffd9a18c570fbc485172e
Closes-Bug: #1563643
This commit is contained in:
Jeffrey Zhang 2016-03-30 16:57:42 +08:00
parent 981d8206ab
commit 792e2c1f26

View File

@ -74,8 +74,8 @@
failed_when: false failed_when: false
register: nova_compute_check_result register: nova_compute_check_result
when: when:
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool - not enable_nova_fake | bool
- inventory_hostname in groups['compute']
- name: Check the configs in the nova_compute_ironic container - name: Check the configs in the nova_compute_ironic container
command: docker exec nova_compute_ironic /usr/local/bin/kolla_set_configs --check command: docker exec nova_compute_ironic /usr/local/bin/kolla_set_configs --check
@ -83,8 +83,8 @@
failed_when: false failed_when: false
register: nova_compute_ironic_check_result register: nova_compute_ironic_check_result
when: when:
- inventory_hostname in groups['nova-compute-ironic']
- enable_ironic | bool - enable_ironic | bool
- inventory_hostname in groups['nova-compute-ironic']
- name: Check the configs in the nova_novncproxy container - name: Check the configs in the nova_novncproxy container
command: docker exec nova_novncproxy /usr/local/bin/kolla_set_configs --check command: docker exec nova_novncproxy /usr/local/bin/kolla_set_configs --check
@ -92,8 +92,8 @@
failed_when: false failed_when: false
register: nova_novncproxy_check_result register: nova_novncproxy_check_result
when: when:
- inventory_hostname in groups['nova-novncproxy']
- nova_console == 'novnc' - nova_console == 'novnc'
- inventory_hostname in groups['nova-novncproxy']
- name: Check the configs in the nova_spicehtml5proxy container - name: Check the configs in the nova_spicehtml5proxy container
command: docker exec nova_spicehtml5proxy /usr/local/bin/kolla_set_configs --check command: docker exec nova_spicehtml5proxy /usr/local/bin/kolla_set_configs --check
@ -101,8 +101,8 @@
failed_when: false failed_when: false
register: nova_spicehtml5proxy_check_result register: nova_spicehtml5proxy_check_result
when: when:
- inventory_hostname in groups['nova-spicehtml5proxy']
- nova_console == 'spice' - nova_console == 'spice'
- inventory_hostname in groups['nova-spicehtml5proxy']
# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS' # NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS'
# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE', # and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE',
@ -162,9 +162,9 @@
action: "remove_container" action: "remove_container"
register: remove_containers register: remove_containers
when: when:
- inventory_hostname in groups[item[0]['group']]
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[2]['rc'] == 1 - item[2]['rc'] == 1
- inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: nova_libvirt, group: compute }, - [{ name: nova_libvirt, group: compute },
{ name: nova_conductor, group: nova-conductor }, { name: nova_conductor, group: nova-conductor },
@ -180,10 +180,10 @@
action: "remove_container" action: "remove_container"
register: remove_nova_compute_container register: remove_nova_compute_container
when: when:
- not enable_nova_fake | bool
- inventory_hostname in groups['compute']
- config_strategy == 'COPY_ONCE' or nova_compute_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - config_strategy == 'COPY_ONCE' or nova_compute_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- nova_compute_check_result['rc'] == 1 - nova_compute_check_result['rc'] == 1
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool
- name: Remove nova_compute_ironic container - name: Remove nova_compute_ironic container
kolla_docker: kolla_docker:
@ -192,9 +192,9 @@
register: remove_nova_compute_ironic_container register: remove_nova_compute_ironic_container
when: when:
- enable_ironic | bool - enable_ironic | bool
- inventory_hostname in groups['nova-compute-ironic']
- config_strategy == 'COPY_ONCE' or nova_compute_ironic_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - config_strategy == 'COPY_ONCE' or nova_compute_ironic_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- nova_compute_ironic_check_result['rc'] == 1 - nova_compute_ironic_check_result['rc'] == 1
- inventory_hostname in groups['nova-compute-ironic']
- name: Remove nova_novncproxy container - name: Remove nova_novncproxy container
kolla_docker: kolla_docker:
@ -203,9 +203,9 @@
register: remove_nova_novncproxy_container register: remove_nova_novncproxy_container
when: when:
- nova_console == 'novnc' - nova_console == 'novnc'
- inventory_hostname in groups['nova-novncproxy']
- config_strategy == 'COPY_ONCE' or nova_novncproxy_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - config_strategy == 'COPY_ONCE' or nova_novncproxy_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- nova_novncproxy_check_result['rc'] == 1 - nova_novncproxy_check_result['rc'] == 1
- inventory_hostname in groups['nova-novncproxy']
- name: Remove nova_spicehtml5proxy container - name: Remove nova_spicehtml5proxy container
kolla_docker: kolla_docker:
@ -214,9 +214,9 @@
register: remove_nova_spicehtml5proxy_container register: remove_nova_spicehtml5proxy_container
when: when:
- nova_console == 'spice' - nova_console == 'spice'
- inventory_hostname in groups['nova-spicehtml5proxy']
- config_strategy == 'COPY_ONCE' or nova_spicehtml5proxy_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - config_strategy == 'COPY_ONCE' or nova_spicehtml5proxy_container_env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- nova_spicehtml5proxy_check_result['rc'] == 1 - nova_spicehtml5proxy_check_result['rc'] == 1
- inventory_hostname in groups['nova-spicehtml5proxy']
- include: start.yml - include: start.yml
when: remove_containers.changed when: remove_containers.changed
@ -252,9 +252,9 @@
action: "restart_container" action: "restart_container"
when: when:
- config_strategy == 'COPY_ALWAYS' - config_strategy == 'COPY_ALWAYS'
- inventory_hostname in groups[item[0]['group']]
- item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[2]['rc'] == 1 - item[2]['rc'] == 1
- inventory_hostname in groups[item[0]['group']]
with_together: with_together:
- [{ name: nova_libvirt, group: compute }, - [{ name: nova_libvirt, group: compute },
{ name: nova_conductor, group: nova-conductor }, { name: nova_conductor, group: nova-conductor },
@ -271,9 +271,9 @@
when: when:
- not enable_nova_fake | bool - not enable_nova_fake | bool
- config_strategy == 'COPY_ALWAYS' - config_strategy == 'COPY_ALWAYS'
- inventory_hostname in groups['compute']
- nova_compute_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - nova_compute_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- nova_compute_check_result['rc'] == 1 - nova_compute_check_result['rc'] == 1
- inventory_hostname in groups['compute']
- name: Restart the nova_compute_ironic container - name: Restart the nova_compute_ironic container
kolla_docker: kolla_docker:
@ -282,9 +282,9 @@
when: when:
- enable_ironic | bool - enable_ironic | bool
- config_strategy == 'COPY_ALWAYS' - config_strategy == 'COPY_ALWAYS'
- inventory_hostname in groups['nova-compute-ironic']
- nova_compute_ironic_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - nova_compute_ironic_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- nova_compute_ironic_check_result['rc'] == 1 - nova_compute_ironic_check_result['rc'] == 1
- inventory_hostname in groups['nova-compute-ironic']
- name: Restart the nova_novncproxy container - name: Restart the nova_novncproxy container
kolla_docker: kolla_docker:
@ -293,9 +293,9 @@
when: when:
- nova_console == 'novnc' - nova_console == 'novnc'
- config_strategy == 'COPY_ALWAYS' - config_strategy == 'COPY_ALWAYS'
- inventory_hostname in groups['nova-novncproxy']
- nova_novncproxy_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - nova_novncproxy_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- nova_novncproxy_check_result['rc'] == 1 - nova_novncproxy_check_result['rc'] == 1
- inventory_hostname in groups['nova-novncproxy']
- name: Restart the nova_spicehtml5proxy container - name: Restart the nova_spicehtml5proxy container
kolla_docker: kolla_docker:
@ -304,6 +304,6 @@
when: when:
- nova_console == 'spice' - nova_console == 'spice'
- config_strategy == 'COPY_ALWAYS' - config_strategy == 'COPY_ALWAYS'
- inventory_hostname in groups['nova-spicehtml5proxy']
- nova_spicehtml5proxy_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - nova_spicehtml5proxy_container_env['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- nova_spicehtml5proxy_check_result['rc'] == 1 - nova_spicehtml5proxy_check_result['rc'] == 1
- inventory_hostname in groups['nova-spicehtml5proxy']