Skip to content

Commit a6fadbb

Browse files
holserxbezdickclaude
authored andcommitted
[libvirt_manager] Add predictable interface names
Enable systemd predictable network interface naming inside guest VMs by removing net.ifnames=0 from kernel args via virt-customize. This gives guests consistent PCI-topology-based names (enp1s0, enp2s0, etc.) instead of legacy ethN naming. Predictable network interfaces are requirement for testing Leapp upgrade functionality. Controlled by cifmw_libvirt_manager_predictable_nic_names (defaults to false). Jira: OSPRH-29381 Co-Authored-By: Lukas Bezdicka <lbezdick@redhat.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sergii Golovatiuk <sgolovat@redhat.com>
1 parent a74a0d2 commit a6fadbb

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

roles/libvirt_manager/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ cifmw_libvirt_manager_firewalld_zone_libvirt_forward: true
8484
cifmw_libvirt_manager_firewalld_default_zone: public
8585
cifmw_libvirt_manager_firewalld_default_zone_masquerade: true
8686
cifmw_libvirt_manager_attach_dummy_interface_on_bridges: true
87+
cifmw_libvirt_manager_predictable_nic_names: false
8788
cifmw_libvirt_manager_extra_network_configuration: {}
8889

8990
cifmw_libvirt_manager_vm_users: []

roles/libvirt_manager/tasks/create_vms.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@
6161
xml: "{{ lookup('template', cifmw_libvirt_manager_vm_template) }}"
6262
uri: "qemu:///system"
6363

64+
- name: "Disable net.ifnames=0 for {{ vm }}"
65+
when:
66+
- vm_data.disk_file_name != 'blank'
67+
- cifmw_libvirt_manager_predictable_nic_names | default(false) | bool
68+
- vm is match('^.*(compute).*$')
69+
ansible.builtin.command:
70+
cmd: "virt-customize -c qemu:///system --domain cifmw-{{ vm }} --run-command 'grubby --remove-args=net.ifnames=0 --update-kernel=ALL'"
71+
6472
- name: "Attach listed networks to the VMs {{ vm }}"
6573
vars:
6674
vm_item: "{{ vm }}"

0 commit comments

Comments
 (0)