From b1e1e5d31051ff569eef3154e3460c7b910640dd Mon Sep 17 00:00:00 2001 From: "Jesse Pretorius (odyssey4me)" Date: Tue, 14 Jan 2020 15:03:11 +0000 Subject: [PATCH] Add 'scale-up' upgrade steps for cinder-volume This patch adds the missing steps for 'scale-up' upgrade support for the cinder-volume service similar to the implementation in I3cfd4272449b207874723682903505d2bbdb435b Related-Bug: #1838971 Change-Id: Ib97f3e7508e277d03d3cb75bba640264518b6323 (cherry picked from commit 1044d0bf3dfeff0ffa5929abb07b11a0cb1000de) --- .../cinder-volume-pacemaker-puppet.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/deployment/cinder/cinder-volume-pacemaker-puppet.yaml b/deployment/cinder/cinder-volume-pacemaker-puppet.yaml index d00908a3cb..f60448717d 100644 --- a/deployment/cinder/cinder-volume-pacemaker-puppet.yaml +++ b/deployment/cinder/cinder-volume-pacemaker-puppet.yaml @@ -324,6 +324,67 @@ outputs: register: output retries: 5 until: output.rc == 0 + - name: Create hiera data to upgrade cinder_volume in a stepwise manner. + when: + - step|int == 1 + block: + - name: set cinder_volume upgrade node facts in a single-node environment + set_fact: + cinder_volume_short_node_names_upgraded: "{{ cinder_volume_short_node_names }}" + cinder_volume_node_names_upgraded: "{{ cinder_volume_node_names }}" + cacheable: no + when: groups['cinder_volume'] | length <= 1 + - name: set cinder_volume upgrade node facts from the limit option + set_fact: + cinder_volume_short_node_names_upgraded: "{{ cinder_volume_short_node_names_upgraded|default([]) + [item.split('.')[0]] }}" + cinder_volume_node_names_upgraded: "{{ cinder_volume_node_names_upgraded|default([]) + [item] }}" + cacheable: no + when: + - groups['cinder_volume'] | length > 1 + - item.split('.')[0] in ansible_limit.split(',') + loop: "{{ cinder_volume_node_names }}" + - debug: + msg: "Prepare cinder_volume upgrade for {{ cinder_volume_short_node_names_upgraded }}" + - fail: + msg: > + You can't upgrade cinder_volume without + staged upgrade. You need to use the limit option in order + to do so. + when: >- + cinder_volume_short_node_names_upgraded is not defined or + cinder_volume_short_node_names_upgraded | length == 0 or + cinder_volume_node_names_upgraded is not defined or + cinder_volume_node_names_upgraded | length == 0 + - name: remove cinder_volume init container on upgrade-scaleup to force re-init + shell: | + if podman inspect cinder_volume_init_bundle &> /dev/null; then + podman rm cinder_volume_init_bundle + fi + when: cinder_volume_short_node_names_upgraded | length > 1 + - name: add the cinder_volume short name to hiera data for the upgrade. + include_role: + name: tripleo-upgrade-hiera + tasks_from: set.yml + vars: + tripleo_upgrade_key: cinder_volume_short_node_names_override + tripleo_upgrade_value: "{{ cinder_volume_short_node_names_upgraded }}" + - name: add the cinder_volume long name to hiera data for the upgrade + include_role: + name: tripleo-upgrade-hiera + tasks_from: set.yml + vars: + tripleo_upgrade_key: cinder_volume_node_names_override + tripleo_upgrade_value: "{{ cinder_volume_node_names_upgraded }}" + - name: remove the extra hiera data needed for the upgrade. + include_role: + name: tripleo-upgrade-hiera + tasks_from: remove.yml + vars: + tripleo_upgrade_key: "{{ item }}" + loop: + - cinder_volume_short_node_names_override + - cinder_volume_node_names_override + when: cinder_volume_short_node_names_upgraded | length == cinder_volume_node_names | length - name: Retag the pacemaker image if containerized when: - step|int == 3