Make pcs resource bundle image name update tolerant of rerun

The parent review at Ic87a66753b104b9f15db70fdccbd66d88cef94df
allows us to update the name for pcs resource bundle resources
if this is changed as part of the upgrade configuration.

If the upgrade is interrupted the target pacemaker resource bundle
may not even have been created yet. This groups stop/update/start
the bundle resource and adds a new conditional to check if the
cluster resource exists before trying to update the container
image being used. Otherwise a re-run of the upgrade tasks may
fail if the cluster resource doesn't exist.

Related-Bug: 1763001
(cherry picked from commit 8530dd9ddc)
Change-Id: Ifc6f78d73bc71a5b5edfadfbfacaa3560fe7c2df
This commit is contained in:
mandreou 2018-04-20 13:39:56 +03:00 committed by Marios Andreou
parent 7235d2a58d
commit 12a10617ad
7 changed files with 239 additions and 237 deletions

View File

@ -300,36 +300,38 @@ outputs:
register: cinder_backup_current_pcmklatest_id
- name: Temporarily tag the current cinder_backup image id with the upgraded image name
shell: "docker tag {{cinder_backup_current_pcmklatest_id.stdout}} {{cinder_backup_docker_image_latest}}"
- name: Disable the cinder_backup cluster resource before container upgrade
when:
- step|int == 1
- cinder_backup_containerized|bool
- is_bootstrap_node
- name: Check openstack-cinder-backup cluster resource status
pacemaker_resource:
resource: openstack-cinder-backup
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Update the cinder_backup bundle to use the new container image name
state: show
check_mode: false
ignore_errors: true
register: cinder_backup_pcs_res
- name: Update cinder_backup pcs resource bundle for new container image
when:
- step|int == 1
- cinder_backup_containerized|bool
- is_bootstrap_node
command: "pcs resource bundle update openstack-cinder-backup container image={{cinder_backup_docker_image_latest}}"
- name: Enable the cinder_backup cluster resource
when:
- step|int == 1
- cinder_backup_containerized|bool
- is_bootstrap_node
pacemaker_resource:
resource: openstack-cinder-backup
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- cinder_backup_pcs_res|succeeded
block:
- name: Disable the cinder_backup cluster resource before container upgrade
pacemaker_resource:
resource: openstack-cinder-backup
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Update the cinder_backup bundle to use the new container image name
command: "pcs resource bundle update openstack-cinder-backup container image={{cinder_backup_docker_image_latest}}"
- name: Enable the cinder_backup cluster resource
pacemaker_resource:
resource: openstack-cinder-backup
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Retag the pacemaker image if containerized
when:
- step|int == 3

View File

@ -325,36 +325,39 @@ outputs:
register: cinder_volume_current_pcmklatest_id
- name: Temporarily tag the current cinder_volume image id with the upgraded image name
shell: "docker tag {{cinder_volume_current_pcmklatest_id.stdout}} {{cinder_volume_docker_image_latest}}"
- name: Disable the cinder_volume cluster resource before container upgrade
when:
- step|int == 1
- cinder_volume_containerized|bool
- is_bootstrap_node
- name: Check openstack-cinder-volume cluster resource status
pacemaker_resource:
resource: openstack-cinder-volume
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Update the cinder_volume bundle to use the new container image name
state: show
check_mode: false
ignore_errors: true
register: cinder_volume_pcs_res
- name: Update cinder_volume pcs resource bundle for new container image
when:
- step|int == 1
- cinder_volume_containerized|bool
- is_bootstrap_node
command: "pcs resource bundle update openstack-cinder-volume container image={{cinder_volume_docker_image_latest}}"
- name: Enable the cinder_volume cluster resource
when:
- step|int == 1
- cinder_volume_containerized|bool
- is_bootstrap_node
pacemaker_resource:
resource: openstack-cinder-volume
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- cinder_volume_pcs_res|succeeded
block:
- name: Disable the cinder_volume cluster resource before container upgrade
pacemaker_resource:
resource: openstack-cinder-volume
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: pcs resource bundle update cinder_volume for new container image name
command: "pcs resource bundle update openstack-cinder-volume container image={{cinder_volume_docker_image_latest}}"
- name: Enable the cinder_volume cluster resource
when:
pacemaker_resource:
resource: openstack-cinder-volume
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Retag the pacemaker image if containerized
when:
- step|int == 3

View File

@ -373,54 +373,53 @@ outputs:
register: galera_current_pcmklatest_id
- name: Temporarily tag the current galera image id with the upgraded image name
shell: "docker tag {{galera_current_pcmklatest_id.stdout}} {{mysql_docker_image_latest}}"
- name: Disable the galera cluster resource before container upgrade
when:
- step|int == 1
- mysql_containerized|bool
- is_bootstrap_node
- name: Check galera cluster resource status
pacemaker_resource:
resource: galera
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Move Mysql logging to /var/log/containers
state: show
check_mode: false
ignore_errors: true
register: galera_pcs_res
- name: Update galera pcs resource bundle for new container image
when:
- step|int == 1
- mysql_containerized|bool
- is_bootstrap_node
- galera_pcs_res|succeeded
block:
- name: Check Mysql logging configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='mysql-log']"
ignore_errors: true
register: mysql_logs_moved
- name: Change Mysql logging configuration in pacemaker
# rc == 6 means the configuration doesn't exist in the CIB
when: mysql_logs_moved.rc == 6
- name: Disable the galera cluster resource before container upgrade
pacemaker_resource:
resource: galera
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Move Mysql logging to /var/log/containers
block:
- name: Add a bind mount for logging in the galera bundle
command: pcs resource bundle update galera-bundle storage-map add id=mysql-log source-dir=/var/log/containers/mysql target-dir=/var/log/mysql options=rw
- name: Reconfigure Mysql log file in the galera resource agent
command: pcs resource update galera log=/var/log/mysql/mysqld.log
- name: Update the galera bundle to use the new container image name
when:
- step|int == 1
- mysql_containerized|bool
- is_bootstrap_node
command: "pcs resource bundle update galera-bundle container image={{mysql_docker_image_latest}}"
- name: Enable the galera cluster resource
when:
- step|int == 1
- mysql_containerized|bool
- is_bootstrap_node
pacemaker_resource:
resource: galera
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Check Mysql logging configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='mysql-log']"
ignore_errors: true
register: mysql_logs_moved
- name: Change Mysql logging configuration in pacemaker
# rc == 6 means the configuration doesn't exist in the CIB
when: mysql_logs_moved.rc == 6
block:
- name: Add a bind mount for logging in the galera bundle
command: pcs resource bundle update galera-bundle storage-map add id=mysql-log source-dir=/var/log/containers/mysql target-dir=/var/log/mysql options=rw
- name: Reconfigure Mysql log file in the galera resource agent
command: pcs resource update galera log=/var/log/mysql/mysqld.log
- name: Update the galera bundle to use the new container image name
command: "pcs resource bundle update galera-bundle container image={{mysql_docker_image_latest}}"
- name: Enable the galera cluster resource
pacemaker_resource:
resource: galera
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Retag the pacemaker image if containerized
when:
- step|int == 3

View File

@ -345,54 +345,52 @@ outputs:
register: redis_current_pcmklatest_id
- name: Temporarily tag the current redis image id with the upgraded image name
shell: "docker tag {{redis_current_pcmklatest_id.stdout}} {{redis_docker_image_latest}}"
- name: Disable the redis cluster resource before container upgrade
when:
- step|int == 1
- redis_containerized|bool
- is_bootstrap_node
- name: Check redis-bundle cluster resource status
pacemaker_resource:
resource: redis-bundle
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Move redis logging to /var/log/containers
state: show
check_mode: false
ignore_errors: true
register: redis_pcs_res
- name: Update redis-bundle pcs resource bundle for new container image
when:
- step|int == 1
- redis_containerized|bool
- is_bootstrap_node
- redis_pcs_res|succeeded
block:
- name: Check redis logging configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='redis-log' and @source-dir='/var/log/containers/redis']"
ignore_errors: true
register: redis_logs_moved
- name: Change redis logging configuration in pacemaker
# rc == 6 means the configuration doesn't exist in the CIB
when: redis_logs_moved.rc == 6
- name: Disable the redis cluster resource before container upgrade
pacemaker_resource:
resource: redis-bundle
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Move redis logging to /var/log/containers
block:
- name: Remove old bind mount for logging in the redis bundle
command: pcs resource bundle update redis-bundle storage-map remove redis-log
- name: Add a bind mount for logging in the redis bundle
command: pcs resource bundle update redis-bundle storage-map add id=redis-log source-dir=/var/log/containers/redis target-dir=/var/log/redis options=rw
- name: Update the redis bundle to use the new container image name
when:
- step|int == 1
- redis_containerized|bool
- is_bootstrap_node
command: "pcs resource bundle update redis-bundle container image={{redis_docker_image_latest}}"
- name: Enable the redis cluster resource
when:
- step|int == 1
- redis_containerized|bool
- is_bootstrap_node
pacemaker_resource:
resource: redis-bundle
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Check redis logging configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='redis-log' and @source-dir='/var/log/containers/redis']"
ignore_errors: true
register: redis_logs_moved
- name: Change redis logging configuration in pacemaker
# rc == 6 means the configuration doesn't exist in the CIB
when: redis_logs_moved.rc == 6
block:
- name: Remove old bind mount for logging in the redis bundle
command: pcs resource bundle update redis-bundle storage-map remove redis-log
- name: Add a bind mount for logging in the redis bundle
command: pcs resource bundle update redis-bundle storage-map add id=redis-log source-dir=/var/log/containers/redis target-dir=/var/log/redis options=rw
- name: Update the redis bundle to use the new container image name
command: "pcs resource bundle update redis-bundle container image={{redis_docker_image_latest}}"
- name: Enable the redis cluster resource
pacemaker_resource:
resource: redis-bundle
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Retag the pacemaker image if containerized
when:
- step|int == 3

View File

@ -374,61 +374,61 @@ outputs:
register: haproxy_current_pcmklatest_id
- name: Temporarily tag the current haproxy image id with the upgraded image name
shell: "docker tag {{haproxy_current_pcmklatest_id.stdout}} {{haproxy_docker_image_latest}}"
- name: Disable the haproxy cluster resource before container upgrade
when:
- step|int == 1
- haproxy_containerized|bool
- is_bootstrap_node
- name: Check haproxy-bundle cluster resource status
pacemaker_resource:
resource: haproxy-bundle
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Expose HAProxy stats socket on the host and mount TLS cert if needed
state: show
check_mode: false
ignore_errors: true
register: haproxy_pcs_res
- name: Update haproxy pcs resource bundle for new container image
when:
- step|int == 1
- haproxy_containerized|bool
- is_bootstrap_node
- haproxy_pcs_res|succeeded
block:
- name: Check haproxy stats socket configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='haproxy-var-lib']"
ignore_errors: true
register: haproxy_stats_exposed
- name: Check haproxy public certificate configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='haproxy-cert']"
ignore_errors: true
register: haproxy_cert_mounted
- name: Add a bind mount for stats socket in the haproxy bundle
command: pcs resource bundle update haproxy-bundle storage-map add id=haproxy-var-lib source-dir=/var/lib/haproxy target-dir=/var/lib/haproxy options=rw
# rc == 6 means the configuration doesn't exist in the CIB
when: haproxy_stats_exposed.rc == 6
- name: Set HAProxy public cert volume mount fact
set_fact:
haproxy_public_cert_path: {get_param: DeployedSSLCertificatePath}
haproxy_public_tls_enabled: {if: [public_tls_enabled, true, false]}
- name: Add a bind mount for public certificate in the haproxy bundle
command: pcs resource bundle update haproxy-bundle storage-map add id=haproxy-cert source-dir={{ haproxy_public_cert_path }} target-dir=/var/lib/kolla/config_files/src-tls/{{ haproxy_public_cert_path }} options=ro
when: haproxy_cert_mounted.rc == 6 and haproxy_public_tls_enabled|bool
- name: Update the haproxy bundle to use the new container image name
when:
- step|int == 1
- haproxy_containerized|bool
- is_bootstrap_node
command: "pcs resource bundle update haproxy-bundle container image={{haproxy_docker_image_latest}}"
- name: Enable the haproxy cluster resource
when:
- step|int == 1
- haproxy_containerized|bool
- is_bootstrap_node
pacemaker_resource:
resource: haproxy-bundle
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Disable the haproxy cluster resource before container upgrade
pacemaker_resource:
resource: haproxy-bundle
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Expose HAProxy stats socket on the host and mount TLS cert if needed
block:
- name: Check haproxy stats socket configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='haproxy-var-lib']"
ignore_errors: true
register: haproxy_stats_exposed
- name: Check haproxy public certificate configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='haproxy-cert']"
ignore_errors: true
register: haproxy_cert_mounted
- name: Add a bind mount for stats socket in the haproxy bundle
command: pcs resource bundle update haproxy-bundle storage-map add id=haproxy-var-lib source-dir=/var/lib/haproxy target-dir=/var/lib/haproxy options=rw
# rc == 6 means the configuration doesn't exist in the CIB
when: haproxy_stats_exposed.rc == 6
- name: Set HAProxy public cert volume mount fact
set_fact:
haproxy_public_cert_path: {get_param: DeployedSSLCertificatePath}
haproxy_public_tls_enabled: {if: [public_tls_enabled, true, false]}
- name: Add a bind mount for public certificate in the haproxy bundle
command: pcs resource bundle update haproxy-bundle storage-map add id=haproxy-cert source-dir={{ haproxy_public_cert_path }} target-dir=/var/lib/kolla/config_files/src-tls/{{ haproxy_public_cert_path }} options=ro
when:
- haproxy_cert_mounted.rc == 6
- haproxy_public_tls_enabled|bool
- name: Update the haproxy bundle to use the new container image name
command: "pcs resource bundle update haproxy-bundle container image={{haproxy_docker_image_latest}}"
- name: Enable the haproxy cluster resource
pacemaker_resource:
resource: haproxy-bundle
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Retag the pacemaker image if containerized
when:
- step|int == 3

View File

@ -233,36 +233,38 @@ outputs:
register: manila_share_current_pcmklatest_id
- name: Temporarily tag the current Manila-Share image id with the upgraded image name
shell: "docker tag {{manila_share_current_pcmklatest_id.stdout}} {{manila_share_docker_image_latest}}"
- name: Disable the Manila-Share cluster resource before container upgrade
when:
- step|int == 1
- manila_share_containerized|bool
- is_bootstrap_node
- name: Check openstack-manila-share cluster resource status
pacemaker_resource:
resource: openstack-manila-share
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Update the Manila-Share bundle to use the new container image name
state: show
check_mode: false
ignore_errors: true
register: manila_share_pcs_res
- name: Update openstack-manila-share pcs resource bundle for new container image
when:
- step|int == 1
- manila_share_containerized|bool
- is_bootstrap_node
command: "pcs resource bundle update openstack-manila-share container image={{manila_share_docker_image_latest}}"
- name: Enable the Manila-Share cluster resource
when:
- step|int == 1
- manila_share_containerized|bool
- is_bootstrap_node
pacemaker_resource:
resource: openstack-manila-share
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- manila_share_pcs_res|succeeded
block:
- name: Disable the Manila-Share cluster resource before container upgrade
pacemaker_resource:
resource: openstack-manila-share
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Update the Manila-Share bundle to use the new container image name
command: "pcs resource bundle update openstack-manila-share container image={{manila_share_docker_image_latest}}"
- name: Enable the Manila-Share cluster resource
pacemaker_resource:
resource: openstack-manila-share
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Retag the pacemaker image if containerized
when:
- step|int == 3

View File

@ -316,50 +316,48 @@ outputs:
register: rabbitmq_current_pcmklatest_id
- name: Temporarily tag the current rabbitmq image id with the upgraded image name
shell: "docker tag {{rabbitmq_current_pcmklatest_id.stdout}} {{rabbitmq_docker_image_latest}}"
- name: Disable the rabbitmq cluster resource before container upgrade
when:
- step|int == 1
- rabbit_containerized|bool
- is_bootstrap_node
- name: Check rabbitmq-bundle cluster resource status
pacemaker_resource:
resource: rabbitmq-bundle
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Move rabbitmq logging to /var/log/containers
state: show
check_mode: false
ignore_errors: true
register: rabbit_pcs_res
- name: Update rabbitmq-bundle pcs resource bundle for new container image
when:
- step|int == 1
- rabbit_containerized|bool
- is_bootstrap_node
- rabbit_pcs_res|succeeded
block:
- name: Check rabbitmq logging configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='rabbitmq-log']"
ignore_errors: true
register: rabbitmq_logs_moved
- name: Add a bind mount for logging in the rabbitmq bundle
# rc == 6 means the configuration doesn't exist in the CIB
when: rabbitmq_logs_moved.rc == 6
command: pcs resource bundle update rabbitmq-bundle storage-map add id=rabbitmq-log source-dir=/var/log/containers/rabbitmq target-dir=/var/log/rabbitmq options=rw
- name: Update the rabbitmq bundle to use the new container image name
when:
- step|int == 1
- rabbit_containerized|bool
- is_bootstrap_node
command: "pcs resource bundle update rabbitmq-bundle container image={{rabbitmq_docker_image_latest}}"
- name: Enable the rabbitmq cluster resource
when:
- step|int == 1
- rabbit_containerized|bool
- is_bootstrap_node
pacemaker_resource:
resource: rabbitmq-bundle
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Disable the rabbitmq cluster resource before container upgrade
pacemaker_resource:
resource: rabbitmq-bundle
state: disable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Move rabbitmq logging to /var/log/containers
block:
- name: Check rabbitmq logging configuration in pacemaker
command: cibadmin --query --xpath "//storage-mapping[@id='rabbitmq-log']"
ignore_errors: true
register: rabbitmq_logs_moved
- name: Add a bind mount for logging in the rabbitmq bundle
# rc == 6 means the configuration doesn't exist in the CIB
when: rabbitmq_logs_moved.rc == 6
command: pcs resource bundle update rabbitmq-bundle storage-map add id=rabbitmq-log source-dir=/var/log/containers/rabbitmq target-dir=/var/log/rabbitmq options=rw
- name: Update the rabbitmq bundle to use the new container image name
command: "pcs resource bundle update rabbitmq-bundle container image={{rabbitmq_docker_image_latest}}"
- name: Enable the rabbitmq cluster resource
pacemaker_resource:
resource: rabbitmq-bundle
state: enable
wait_for_resource: true
register: output
retries: 5
until: output.rc == 0
- name: Retag the pacemaker image if containerized
when:
- step|int == 3