Skip to content

Commit

Permalink
virtio_transitional_nic: don't attach incompatible controller
Browse files Browse the repository at this point in the history
On s390x, pci bridge is not available. Don't attach this.

Signed-off-by: Sebastian Mitterle <[email protected]>
  • Loading branch information
smitterl committed Dec 11, 2024
1 parent 76614d5 commit b18d3a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
variants:
- virtio:
virtio_model = "virtio"
s390-virtio:
check_pci_bridge = no
bridge_controller_needed = no
- virtio_transitional:
no s390-virtio
virtio_model = "virtio-transitional"
Expand Down
23 changes: 13 additions & 10 deletions libvirt/tests/src/virtio_transitional/virtio_transitional_nic.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def create_iface_xml(mac):
if cold_plug == "yes":
reboot() # Reboot guest if it is cold plug test
detect_new_nic(mac)
if plug_method == 'interface' and cold_plug == 'no':
if plug_method == 'interface' and cold_plug == 'no' and check_pci_bridge:
check_plug_to_pci_bridge(vm_name, mac)
session = vm.wait_for_login(serial=True)
# Add nic to VM object for further check
Expand Down Expand Up @@ -278,6 +278,8 @@ def ping_test(restart_network=False):
params['disk_model'] = params['virtio_model']
guest_os_type = params['os_type']
set_crypto_policy = params.get("set_crypto_policy")
bridge_controller_needed = params.get("bridge_controller_needed", "yes") == "yes"
check_pci_bridge = params.get("check_pci_bridge", "yes") == "yes"

target_path = None

Expand All @@ -301,15 +303,16 @@ def ping_test(restart_network=False):
libvirt.set_vm_disk(vm, params)

# Add pcie-to-pci-bridge when there is no one
pci_controllers = vmxml.get_controllers('pci')
for controller in pci_controllers:
if controller.get('model') == 'pcie-to-pci-bridge':
break
else:
contr_dict = {'controller_type': 'pci',
'controller_model': 'pcie-to-pci-bridge'}
cntl_add = libvirt.create_controller_xml(contr_dict)
libvirt.add_controller(vm_name, cntl_add)
if bridge_controller_needed:
pci_controllers = vmxml.get_controllers('pci')
for controller in pci_controllers:
if controller.get('model') == 'pcie-to-pci-bridge':
break
else:
contr_dict = {'controller_type': 'pci',
'controller_model': 'pcie-to-pci-bridge'}
cntl_add = libvirt.create_controller_xml(contr_dict)
libvirt.add_controller(vm_name, cntl_add)
try: # Update interface model as defined
iface_params = {'model': params['virtio_model']}
libvirt.modify_vm_iface(vm_name, "update_iface", iface_params)
Expand Down

0 comments on commit b18d3a2

Please sign in to comment.