From e2c842e9e4d1863a4132666a9ce200230c01fcf2 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 19 Jun 2026 17:21:19 +0100 Subject: [PATCH 1/2] openstack: Guard network resource names on os_net_id being defined The 'Compute network resource names' task in common.yaml uses the os_net_id variable, which is loaded from netid.json. Since commit 7b6b3f1c70 (OCPBUGS-39285), netid.json is loaded conditionally via include_vars (skipped when the file doesn't exist), but the task that consumes os_net_id had no corresponding guard. This causes the UPI deprovision playbook to fail with "'os_net_id' is undefined" when netid.json is not present in the working directory. Add a 'when: os_net_id is defined' guard, consistent with the existing 'when: sym.stat.exists' guard on the 'Compute resource names' task above. Note that the deprovision playbooks (e.g. down-network.yaml) do use these network resource names, but they already handle missing resources gracefully - they list resources by tag first and use 'state: absent' for deletion. Without os_net_id the names can't be computed at all, so skipping is the only safe option. More importantly, failing hard here prevents the entire deprovision run from cleaning up resources that *can* be cleaned up (servers, security groups, etc. that use infraID from metadata.json rather than os_net_id). Signed-off-by: Stephen Finucane Assisted-By: Claude Opus 4.6 (1M context) --- upi/openstack/common.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/upi/openstack/common.yaml b/upi/openstack/common.yaml index 47bd82e01bd..531c5a89210 100644 --- a/upi/openstack/common.yaml +++ b/upi/openstack/common.yaml @@ -47,3 +47,4 @@ # Port names os_port_api: "{{ os_net_id }}-api-port" os_port_ingress: "{{ os_net_id }}-ingress-port" + when: os_net_id is defined From a211562b80e216acb201700ab23b4ae33f35387e Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 23 Jun 2026 14:13:14 +0100 Subject: [PATCH 2/2] openstack/upi: Remove cluster FIPs You cannot delete a router while it still has FIPs associated with it. Signed-off-by: Stephen Finucane --- upi/openstack/down-network.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/upi/openstack/down-network.yaml b/upi/openstack/down-network.yaml index 7f44c4e8573..c357f8483e8 100644 --- a/upi/openstack/down-network.yaml +++ b/upi/openstack/down-network.yaml @@ -40,6 +40,16 @@ cmd: "openstack port delete {{ ports.stdout_lines | join(' ') }}" when: ports.stdout != "" + - name: 'List FIPs' + ansible.builtin.command: + cmd: "openstack floating ip list --router {{ os_router}} -f value -c ID" + register: fips + + - name: 'Remove the cluster FIPs' + ansible.builtin.command: + cmd: "openstack floating ip delete {{ fips.stdout_lines | join(' ') }}" + when: fips.stdout != "" + - name: 'Remove the cluster router' openstack.cloud.router: name: "{{ os_router }}"