From 279de16047ba9e868e40944c9a47309ae68f4948 Mon Sep 17 00:00:00 2001 From: "Jesse Pretorius (odyssey4me)" Date: Mon, 13 Jan 2020 17:43:51 +0000 Subject: [PATCH] Add 'scale-up' upgrade steps for manila This patch adds the missing steps for 'scale-up' upgrade support for the manila service similar to the implementation in I3cfd4272449b207874723682903505d2bbdb435b Related-Bug: #1838971 Depends-On: I2c468e608a8f70d031b9ba08521bb75f7094c048 Change-Id: I6deb1e2e76c1e471c1ff9b6b05dbde86eb00fbdf (cherry picked from commit a25cb11b38e37b9c8fd9b2cfa060dda16ac67ab1) --- .../manila/manila-share-pacemaker-puppet.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/deployment/manila/manila-share-pacemaker-puppet.yaml b/deployment/manila/manila-share-pacemaker-puppet.yaml index 229943e1a2..3e8c8c1ed9 100644 --- a/deployment/manila/manila-share-pacemaker-puppet.yaml +++ b/deployment/manila/manila-share-pacemaker-puppet.yaml @@ -326,6 +326,67 @@ outputs: register: output retries: 5 until: output.rc == 0 + - name: Create hiera data to upgrade manila_share in a stepwise manner. + when: + - step|int == 1 + block: + - name: set manila_share upgrade node facts in a single-node environment + set_fact: + manila_share_short_node_names_upgraded: "{{ manila_share_short_node_names }}" + manila_share_node_names_upgraded: "{{ manila_share_node_names }}" + cacheable: no + when: groups['manila_share'] | length <= 1 + - name: set manila_share upgrade node facts from the limit option + set_fact: + manila_share_short_node_names_upgraded: "{{ manila_share_short_node_names_upgraded|default([]) + [item.split('.')[0]] }}" + manila_share_node_names_upgraded: "{{ manila_share_node_names_upgraded|default([]) + [item] }}" + cacheable: no + when: + - groups['manila_share'] | length > 1 + - item.split('.')[0] in ansible_limit.split(',') + loop: "{{ manila_share_node_names }}" + - debug: + msg: "Prepare manila_share upgrade for {{ manila_share_short_node_names_upgraded }}" + - fail: + msg: > + You can't upgrade manila_share without + staged upgrade. You need to use the limit option in order + to do so. + when: >- + manila_share_short_node_names_upgraded is not defined or + manila_share_short_node_names_upgraded | length == 0 or + manila_share_node_names_upgraded is not defined or + manila_share_node_names_upgraded | length == 0 + - name: remove manila_share init container on upgrade-scaleup to force re-init + shell: | + if podman inspect manila_share_init_bundle &> /dev/null; then + podman rm manila_share_init_bundle + fi + when: manila_share_short_node_names_upgraded | length > 1 + - name: add the manila_share short name to hiera data for the upgrade. + include_role: + name: tripleo-upgrade-hiera + tasks_from: set.yml + vars: + tripleo_upgrade_key: manila_share_short_node_names_override + tripleo_upgrade_value: "{{ manila_share_short_node_names_upgraded }}" + - name: add the manila_share long name to hiera data for the upgrade + include_role: + name: tripleo-upgrade-hiera + tasks_from: set.yml + vars: + tripleo_upgrade_key: manila_share_node_names_override + tripleo_upgrade_value: "{{ manila_share_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: + - manila_share_short_node_names_override + - manila_share_node_names_override + when: manila_share_short_node_names_upgraded | length == manila_share_node_names | length - name: Retag the pacemaker image if containerized when: - step|int == 3