Skip to content

Commit 01cbd8f

Browse files
fmountclaude
andcommitted
[cinder_multiattach] Wait for Glance reconciliation after config patch
The oc wait --for=condition=Ready on the controlplane returns immediately when the condition is already true, before the StatefulSet rolling update triggered by the config change completes. This causes a race with subsequent hooks (e.g. amphora image upload) that depend on Glance being stable. Replace the inline oc wait with two explicit steps: 1. Poll the Glance CR until customServiceConfig reflects the change 2. Wait for the controlplane Ready condition after reconciliation starts Closes: OSPCIX-1454 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 6452867 commit 01cbd8f

1 file changed

Lines changed: 35 additions & 5 deletions

File tree

hooks/playbooks/cinder_multiattach_volume_type.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@
2828
- name: Block to configure cinder_volume_type when needed
2929
when: configure_cinder_volume_type | default(false) | bool
3030
block:
31+
- name: Get OpenStackControlPlane CR name
32+
environment:
33+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
34+
PATH: "{{ cifmw_path }}"
35+
ansible.builtin.shell: |
36+
set -xe -o pipefail
37+
oc get openstackcontrolplane -o name -n {{ namespace }}
38+
register: _ctlplane_name
39+
changed_when: false
40+
3141
- name: Create tempfile
3242
ansible.builtin.tempfile:
3343
state: file
@@ -37,8 +47,7 @@
3747
- name: Write current glance customServiceConfig to tempfile
3848
ansible.builtin.shell: |
3949
set -xe -o pipefail
40-
crname=$(oc get openstackcontrolplane -o name -n {{ namespace }})
41-
oc -n {{ namespace }} get ${crname} -o jsonpath={.spec.glance.template.customServiceConfig} > {{ _glance_custom_service_config_file.path }}
50+
oc -n {{ namespace }} get {{ _ctlplane_name.stdout }} -o jsonpath={.spec.glance.template.customServiceConfig} > {{ _glance_custom_service_config_file.path }}
4251
changed_when: false
4352

4453
- name: Ensure cinder_volume_type is configured with proper value in tempfile
@@ -65,8 +74,29 @@
6574
customServiceConfig: "{{ _glance_ini_content.content | b64decode }}"
6675
ansible.builtin.shell: |
6776
set -xe -o pipefail
68-
crname=$(oc get openstackcontrolplane -o name -n {{ namespace }})
69-
oc -n {{ namespace }} patch ${crname} --type=merge --patch "{{ _yaml_patch | to_nice_yaml }}"
70-
oc -n {{ namespace }} wait ${crname} --for condition=Ready --timeout=10m
77+
oc -n {{ namespace }} patch {{ _ctlplane_name.stdout }} --type=merge --patch "{{ _yaml_patch | to_nice_yaml }}"
7178
changed_when: _glance_ini_file.changed
7279
when: _glance_ini_file.changed
80+
81+
- name: Verify Glance CR reflects the cinder_volume_type change
82+
environment:
83+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
84+
PATH: "{{ cifmw_path }}"
85+
ansible.builtin.shell: |
86+
set -xe -o pipefail
87+
gcr=$(oc -n {{ namespace }} get glance -o custom-columns=NAME:.metadata.name --no-headers)
88+
oc -n {{ namespace }} get glance ${gcr} -o jsonpath='{.spec.customServiceConfig}'
89+
register: _glance_cr_config
90+
retries: 30
91+
delay: 5
92+
until: "'cinder_volume_type' in _glance_cr_config.stdout"
93+
when: _glance_ini_file.changed
94+
95+
- name: Wait for controlplane to complete reconciliation # noqa: no-handler
96+
environment:
97+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
98+
PATH: "{{ cifmw_path }}"
99+
ansible.builtin.shell: |
100+
set -xe -o pipefail
101+
oc -n {{ namespace }} wait {{ _ctlplane_name.stdout }} --for condition=Ready --timeout=10m
102+
when: _glance_ini_file.changed

0 commit comments

Comments
 (0)