Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion roles/devscripts/tasks/110_check_ocp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
when:
- _deployed_cluster.stat.exists | bool
- _needed_base_imgs | bool
- _needed_volumes | bool
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
ansible.builtin.set_fact:
cifmw_devscripts_ocp_comply: true

Expand Down
14 changes: 14 additions & 0 deletions roles/libvirt_manager/tasks/clean_layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,20 @@
default([])
}}

- name: Find stale volume attachment XML files in ocp pool
register: _ocp_vol_xml_files
ansible.builtin.find:
paths: "{{ cifmw_libvirt_manager_ocp_pool_dir }}"
patterns: "*-vol-*.xml"

- name: Remove stale volume attachment XML files
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ _ocp_vol_xml_files.files }}"
loop_control:
label: "{{ item.path | basename }}"

- name: Remove ocp_volumes storage pool
when:
- _is_deepscrub | bool
Expand Down
61 changes: 61 additions & 0 deletions roles/reproducer/tasks/ocp_layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,67 @@
name: "devscripts"
tasks_from: "110_check_ocp.yml"

# devscripts cleanup (make clean) destroys all devscripts-managed
# resources including the ocpbm/ocppr libvirt networks that were
# already created by prepare_networking.yml. Recreate any that are
# missing so that VBMC can reach ipmi.utility before devscripts
# redeploys the OCP cluster.
- name: Restore networks destroyed by devscripts cleanup
when:
- not cifmw_devscripts_ocp_comply | bool
- _cifmw_libvirt_manager_layout.networks is defined
vars:
_fixed_nets: >-
{{
['ocpbm', 'ocppr'] +
(cifmw_libvirt_manager_fixed_networks | default([]))
}}
block:
- name: List existing libvirt networks after cleanup
register: _post_cleanup_nets
community.libvirt.virt_net:
command: list_nets
uri: "qemu:///system"

- name: Identify fixed networks needing restoration
ansible.builtin.set_fact:
_nets_to_restore: >-
{{
_cifmw_libvirt_manager_layout.networks |
dict2items |
selectattr('key', 'in', _fixed_nets) |
rejectattr('key', 'in', _post_cleanup_nets.list_nets) |
list
}}

- name: Define missing networks in libvirt
community.libvirt.virt_net:
command: define
name: "{{ item.key }}"
xml: "{{ item.value }}"
uri: "qemu:///system"
loop: "{{ _nets_to_restore }}"
loop_control:
label: "{{ item.key }}"

- name: Start missing networks
community.libvirt.virt_net:
command: create
name: "{{ item.key }}"
uri: "qemu:///system"
loop: "{{ _nets_to_restore }}"
loop_control:
label: "{{ item.key }}"

- name: Ensure restored networks are active with autostart
community.libvirt.virt_net:
autostart: true
name: "{{ item.key }}"
uri: "qemu:///system"
loop: "{{ _nets_to_restore }}"
loop_control:
label: "{{ item.key }}"

- name: Bootstrap devscript using baremetal provisioning
when:
- not cifmw_devscripts_ocp_comply | bool
Expand Down
Loading