Add validation task in docker services [Heat]

Docker services are missing the pre-upgrade validation task
in the upgrade_tasks section which verifies if the service
is running before going on with the upgrade.

Change-Id: I04c6e8c9c1cd0b427465fbab7df99823e7bcd02c
Partial-Bug: #1704389
This commit is contained in:
Jose Luis Franco Arza 2017-08-07 10:44:01 +02:00
parent 9bd858ebdf
commit 43f241f698
3 changed files with 61 additions and 29 deletions

View File

@ -132,24 +132,35 @@ outputs:
- /var/log/containers/httpd/heat-api-cfn
upgrade_tasks:
- name: Check if heat_api_cfn is deployed
command: systemctl is-enabled openstack-heat-api-cfn
command: systemctl is-enabled --quiet openstack-heat-api-cfn
tags: common
ignore_errors: True
register: heat_api_cfn_enabled
- name: check for heat_api_cfn running under apache (post upgrade)
tags: step2
- name: Check for heat_api_cfn running under apache
tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cfn_wsgi"
register: heat_api_cfn_apache
ignore_errors: true
changed_when: false
check_mode: no
- name: Stop heat_api_cfn service (running under httpd)
tags: step2
service: name=httpd state=stopped
when: heat_api_cfn_apache.rc == 0
ignore_errors: True
register: httpd_enabled
- name: "PreUpgrade step0,validation: Check service openstack-heat-api-cfn is running"
command: systemctl is-active --quiet openstack-heat-api-cfn
when: heat_api_cfn_enabled.rc == 0 and httpd_enabled.rc != 0
tags: step0,validation
- name: Stop and disable heat_api_cfn service (pre-upgrade not under httpd)
tags: step2
service: name=openstack-heat-api-cfn state=stopped enabled=no
when: heat_api_cfn_enabled.rc == 0
when: heat_api_cfn_enabled.rc == 0 and httpd_enabled.rc != 0
- name: Check if httpd service is running
command: systemctl is-active --quiet httpd
tags: common
ignore_errors: True
register: httpd_running
- name: "PreUpgrade step0,validation: Check if heat_api_cfn_wsgi is running"
tags: step0,validation
shell: systemctl status 'httpd' | grep -q heat_api_cfn_wsgi
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
- name: Stop heat_api_cfn service (running under httpd)
tags: step2
service: name=httpd state=stopped
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
metadata_settings:
get_attr: [HeatBase, role_data, metadata_settings]

View File

@ -160,30 +160,41 @@ outputs:
- /var/log/containers/heat
- /var/log/containers/httpd/heat-api
upgrade_tasks:
- name: Check is heat_api is deployed
command: systemctl is-enabled openstack-heat-api
- name: Check if heat_api is deployed
command: systemctl is-enabled --quiet openstack-heat-api
tags: common
ignore_errors: True
register: heat_api_enabled
- name: Check for heat_api running under apache
tags: common
shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_wsgi"
ignore_errors: True
register: httpd_enabled
- name: "PreUpgrade step0,validation: Check service openstack-heat-api is running"
command: systemctl is-active --quiet openstack-heat-api
when: heat_api_enabled.rc == 0 and httpd_enabled.rc != 0
tags: step0,validation
- name: Stop and disable heat_api service (pre-upgrade not under httpd)
tags: step2
service: name=openstack-heat-api state=stopped enabled=no
when: heat_api_enabled.rc == 0 and httpd_enabled.rc != 0
- name: Check if httpd is running
tags: common
command: systemctl is-active --quiet httpd
ignore_errors: True
register: httpd_running
- name: "PreUpgrade step0,validation: Check if heat_api_wsgi is running"
shell: systemctl status 'httpd' | grep -q heat_api_wsgi
tags: step0,validation
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
- name: Stop heat_api service (running under httpd)
tags: step2
service: name=httpd state=stopped
when: httpd_enabled.rc == 0 and httpd_running.rc == 0
- name: remove old heat cron jobs
tags: step2
file:
path: /var/spool/cron/heat
state: absent
- name: check for heat_api running under apache (post upgrade)
tags: step2
shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_wsgi"
register: heat_api_apache
ignore_errors: true
changed_when: false
check_mode: no
- name: Stop heat_api service (running under httpd)
tags: step2
service: name=httpd state=stopped
when: heat_api_apache.rc == 0
- name: Stop and disable heat_api service (pre-upgrade not under httpd)
tags: step2
service: name=openstack-heat-api state=stopped enabled=no
when: heat_api_enabled.rc == 0
metadata_settings:
get_attr: [HeatBase, role_data, metadata_settings]

View File

@ -135,6 +135,16 @@ outputs:
path: /var/log/containers/heat
state: directory
upgrade_tasks:
- name: Check if heat_engine is deployed
command: systemctl is-enabled --quiet openstack-heat-engine
tags: common
ignore_errors: True
register: heat_engine_enabled
- name: "PreUpgrade step0,validation: Check service openstack-heat-engine is running"
command: systemctl is-active --quiet openstack-heat-engine
when: heat_engine_enabled.rc == 0
tags: step0,validation
- name: Stop and disable heat_engine service
tags: step2
when: heat_engine_enabled.rc == 0
service: name=openstack-heat-engine state=stopped enabled=no