aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-04 15:03:31 +0000
committerGerrit Code Review <review@openstack.org>2016-03-04 15:03:31 +0000
commit356af486255d5846ef743f8704a21b5e31bd9d4a (patch)
tree4c97eb53d8c5a9407f7e4b66d87c0d1b48d4507c
parent7ab6def355a9ed1cd43af9b7b135c9fa722c4703 (diff)
parent1c331739270096d6d821fb82e26d9c60924fa00f (diff)
downloadkolla-356af486255d5846ef743f8704a21b5e31bd9d4a.tar.gz
kolla-356af486255d5846ef743f8704a21b5e31bd9d4a.zip
Merge "Reconfigure nova service"
-rw-r--r--ansible/roles/nova/tasks/do_reconfigure.yml212
-rw-r--r--ansible/roles/nova/tasks/reconfigure.yml10
2 files changed, 222 insertions, 0 deletions
diff --git a/ansible/roles/nova/tasks/do_reconfigure.yml b/ansible/roles/nova/tasks/do_reconfigure.yml
new file mode 100644
index 000000000..edc48c414
--- /dev/null
+++ b/ansible/roles/nova/tasks/do_reconfigure.yml
@@ -0,0 +1,212 @@
+---
+- name: Ensuring the nova libvirt, conductor, api, consoleauth and scheduler containers are up
+ kolla_docker:
+ name: "{{ item.name }}"
+ action: "get_container_state"
+ register: container_state
+ failed_when: container_state.Running == false
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: nova_libvirt, group: compute }
+ - { name: nova_conductor, group: nova-conductor }
+ - { name: nova_api, group: nova-api }
+ - { name: nova_consoleauth, group: nova-consoleauth }
+ - { name: nova_scheduler, group: nova-scheduler }
+
+- name: Ensuring the nova_compute container is up
+ kolla_docker:
+ name: "nova_compute"
+ action: "get_container_state"
+ register: container_state
+ failed_when: container_state.Running == false
+ when:
+ - inventory_hostname in groups['compute']
+ - not enable_nova_fake | bool
+
+- name: Ensuring the nova_compute_ironic container is up
+ kolla_docker:
+ name: "nova_compute_ironic"
+ action: "get_container_state"
+ register: container_state
+ failed_when: container_state.Running == false
+ when:
+ - inventory_hostname in groups['nova-compute-ironic']
+ - enable_ironic | bool
+
+- name: Ensuring the nova_novncproxy container is up
+ kolla_docker:
+ name: "nova_novncproxy"
+ action: "get_container_state"
+ register: container_state
+ failed_when: container_state.Running == false
+ when:
+ - inventory_hostname in groups['nova-novncproxy']
+ - nova_console == 'novnc'
+
+- name: Ensuring the nova_spicehtml5proxy container is up
+ kolla_docker:
+ name: "nova_spicehtml5proxy"
+ action: "get_container_state"
+ register: container_state
+ failed_when: container_state.Running == false
+ when:
+ - inventory_hostname in groups['nova-spicehtml5proxy']
+ - nova_console == 'spice'
+
+- include: config.yml
+
+- name: Check the configs for nova libvirt, conductor, api, consoleauth and scheduler containers
+ command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
+ changed_when: false
+ failed_when: false
+ register: check_results
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: nova_libvirt, group: compute }
+ - { name: nova_conductor, group: nova-conductor }
+ - { name: nova_api, group: nova-api }
+ - { name: nova_consoleauth, group: nova-consoleauth }
+ - { name: nova_scheduler, group: nova-scheduler }
+
+- name: Check the configs in the nova_compute container
+ command: docker exec nova_compute /usr/local/bin/kolla_set_configs --check
+ changed_when: false
+ failed_when: false
+ when:
+ - inventory_hostname in groups['compute']
+ - not enable_nova_fake | bool
+
+- name: Check the configs in the nova_compute_ironic container
+ command: docker exec nova_compute_ironic /usr/local/bin/kolla_set_configs --check
+ changed_when: false
+ failed_when: false
+ when:
+ - inventory_hostname in groups['nova-compute-ironic']
+ - enable_ironic | bool
+
+- name: Check the configs in the nova_novncproxy container
+ command: docker exec nova_novncproxy /usr/local/bin/kolla_set_configs --check
+ changed_when: false
+ failed_when: false
+ when:
+ - inventory_hostname in groups['nova-novncproxy']
+ - nova_console == 'novnc'
+
+- name: Check the configs in the nova_spicehtml5proxy container
+ command: docker exec nova_spicehtml5proxy /usr/local/bin/kolla_set_configs --check
+ changed_when: false
+ failed_when: false
+ when:
+ - inventory_hostname in groups['nova-spicehtml5proxy']
+ - nova_console == 'spice'
+
+# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS'
+# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE',
+# just remove the container and start again
+- name: Containers config strategy for nova libvirt, conductor, api, consoleauth and scheduler containers
+ kolla_docker:
+ name: "{{ item.name }}"
+ action: "get_container_env"
+ register: container_envs
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: nova_libvirt, group: compute }
+ - { name: nova_conductor, group: nova-conductor }
+ - { name: nova_api, group: nova-api }
+ - { name: nova_consoleauth, group: nova-consoleauth }
+ - { name: nova_scheduler, group: nova-scheduler }
+
+- name: Remove the nova libvirt, conductor, api, consoleauth and scheduler containers
+ kolla_docker:
+ name: "{{ item[0]['name'] }}"
+ action: "remove_container"
+ register: remove_containers
+ when:
+ - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
+ - item[2]['rc'] == 1
+ - inventory_hostname in groups[item[0]['group']]
+ with_together:
+ - [{ name: nova_libvirt, group: compute },
+ { name: nova_conductor, group: nova-conductor },
+ { name: nova_api, group: nova-api },
+ { name: nova_consoleauth, group: nova-consoleauth },
+ { name: nova_scheduler, group: nova-scheduler }]
+ - container_envs.results
+ - check_results.results
+
+- include: start.yml
+ when: remove_containers.changed
+
+- name: Restart the nova libvirt, conductor, api, consoleauth and scheduler containers
+ kolla_docker:
+ name: "{{ item[0]['name'] }}"
+ action: "restart_container"
+ when:
+ - config_strategy == 'COPY_ALWAYS'
+ - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
+ - item[2]['rc'] == 1
+ - inventory_hostname in groups[item[0]['group']]
+ with_together:
+ - [{ name: nova_libvirt, group: compute },
+ { name: nova_conductor, group: nova-conductor },
+ { name: nova_api, group: nova-api },
+ { name: nova_consoleauth, group: nova-consoleauth },
+ { name: nova_scheduler, group: nova-scheduler }]
+ - container_envs.results
+ - check_results.results
+
+- name: Restart the nova_compute container
+ kolla_docker:
+ name: "nova_compute"
+ action: "restart_container"
+ when:
+ - config_strategy == 'COPY_ALWAYS'
+ - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
+ - item[1]['rc'] == 1
+ - inventory_hostname in groups['compute']
+ - not enable_nova_fake | bool
+ with_together:
+ - container_envs.results
+ - check_results.results
+
+- name: Restart the nova_compute_ironic container
+ kolla_docker:
+ name: "nova_compute_ironic"
+ action: "restart_container"
+ when:
+ - config_strategy == 'COPY_ALWAYS'
+ - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
+ - item[1]['rc'] == 1
+ - inventory_hostname in groups['nova-compute-ironic']
+ - enable_ironic | bool
+ with_together:
+ - container_envs.results
+ - check_results.results
+
+- name: Restart the nova_novncproxy container
+ kolla_docker:
+ name: "nova_novncproxy"
+ action: "restart_container"
+ when:
+ - config_strategy == 'COPY_ALWAYS'
+ - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
+ - item[1]['rc'] == 1
+ - inventory_hostname in groups['nova-novncproxy']
+ - nova_console == 'novnc'
+ with_together:
+ - container_envs.results
+ - check_results.results
+
+- name: Restart the nova_spicehtml5proxy container
+ kolla_docker:
+ name: "nova_spicehtml5proxy"
+ action: "restart_container"
+ when:
+ - config_strategy == 'COPY_ALWAYS'
+ - item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
+ - item[1]['rc'] == 1
+ - inventory_hostname in groups['nova-spicehtml5proxy']
+ - nova_console == 'spice'
+ with_together:
+ - container_envs.results
+ - check_results.results
diff --git a/ansible/roles/nova/tasks/reconfigure.yml b/ansible/roles/nova/tasks/reconfigure.yml
index ed97d539c..5c4cf7d3e 100644
--- a/ansible/roles/nova/tasks/reconfigure.yml
+++ b/ansible/roles/nova/tasks/reconfigure.yml
@@ -1 +1,11 @@
---
+- include: do_reconfigure.yml
+ serial: "30%"
+ when: inventory_hostname in groups['compute']
+ or inventory_hostname in groups['nova-conductor']
+ or inventory_hostname in groups['nova-api']
+ or inventory_hostname in groups['nova-consoleauth']
+ or inventory_hostname in groups['nova-scheduler']
+ or inventory_hostname in groups['nova-compute-ironic']
+ or inventory_hostname in groups['nova-novncproxy']
+ or inventory_hostname in groups['nova-spicehtml5proxy']