Skip to content

Commit ff90252

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 both the glance CR and the controlplane Ready condition after reconciliation starts (Ready=False) Closes: OSPCIX-1454 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 670f562 commit ff90252

1 file changed

Lines changed: 50 additions & 5 deletions

File tree

hooks/playbooks/cinder_multiattach_volume_type.yml

Lines changed: 50 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,44 @@
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+
# After patching the controlplane, there is a window where both
82+
# Glance and the controlplane still report Ready because the
83+
# reconciliation has not propagated yet. Wait for Glance to
84+
# enter reconciliation (Ready=False) before waiting for it
85+
# and the controlplane to become Ready again.
86+
- name: Get Glance CR name # noqa: no-handler
87+
environment:
88+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
89+
PATH: "{{ cifmw_path }}"
90+
ansible.builtin.shell: |
91+
set -xe -o pipefail
92+
oc -n {{ namespace }} get glance -o name
93+
register: _glance_name
94+
changed_when: false
95+
when: _glance_ini_file.changed
96+
97+
- name: Wait for Glance reconciliation to start # noqa: no-handler
98+
environment:
99+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
100+
PATH: "{{ cifmw_path }}"
101+
ansible.builtin.shell: |
102+
set -xe -o pipefail
103+
oc -n {{ namespace }} wait {{ _glance_name.stdout }} \
104+
--for=condition=Ready=False --timeout=5m
105+
when: _glance_ini_file.changed
106+
107+
- name: Wait for both glance and the ctlplane CRs to complete reconciliation # noqa: no-handler
108+
environment:
109+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
110+
PATH: "{{ cifmw_path }}"
111+
ansible.builtin.shell: |
112+
set -xe -o pipefail
113+
oc -n {{ namespace }} wait {{ item }} --for condition=Ready --timeout=10m
114+
loop:
115+
- "{{ _glance_name.stdout }}"
116+
- "{{ _ctlplane_name.stdout }}"
117+
when: _glance_ini_file.changed

0 commit comments

Comments
 (0)