Skip to content

Commit 3330406

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 3330406

1 file changed

Lines changed: 40 additions & 5 deletions

File tree

hooks/playbooks/cinder_multiattach_volume_type.yml

Lines changed: 40 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,34 @@
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+
# The controlplane patch triggers a reconciliation that propagates
82+
# customServiceConfig to the Glance CR. We must confirm that the
83+
# updated CR is available before waiting for Ready, otherwise oc wait
84+
# returns immediately on the stale Ready=True from before the rolling
85+
# update.
86+
- name: Verify Glance CR reflects the cinder_volume_type change
87+
environment:
88+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
89+
PATH: "{{ cifmw_path }}"
90+
ansible.builtin.shell: |
91+
set -xe -o pipefail
92+
gcr=$(oc -n {{ namespace }} get glance -o custom-columns=NAME:.metadata.name --no-headers)
93+
oc -n {{ namespace }} get glance ${gcr} -o jsonpath='{.spec.customServiceConfig}'
94+
register: _glance_cr_config
95+
retries: 30
96+
delay: 5
97+
until: "'cinder_volume_type' in _glance_cr_config.stdout"
98+
when: _glance_ini_file.changed
99+
100+
- name: Wait for controlplane to complete reconciliation
101+
environment:
102+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
103+
PATH: "{{ cifmw_path }}"
104+
ansible.builtin.shell: |
105+
set -xe -o pipefail
106+
oc -n {{ namespace }} wait {{ _ctlplane_name.stdout }} --for condition=Ready --timeout=10m
107+
when: _glance_ini_file.changed

0 commit comments

Comments
 (0)