Skip to content

Commit

Permalink
Merge pull request autotest#5879 from smitterl/s390_pci_controller
Browse files Browse the repository at this point in the history
attach_interface_with_model: don't attach incompatible controller
  • Loading branch information
Yingshun authored Sep 9, 2024
2 parents f9441b8 + a217a59 commit d9f6455
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
pci_model = pcie-root-port
s390-virtio:
check_pci_model = no
bridge_controller_needed = no
- e1000e:
only x86_64
iface_driver = e1000e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,21 @@ def run(test, params, env):
iface_driver = params.get("iface_driver")
model_type = params.get("model_type")
check_pci_model = params.get("check_pci_model", "yes") == "yes"
bridge_controller_needed = params.get("bridge_controller_needed", "yes") == "yes"

vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
bkxml = vmxml.copy()

try:
pci_controllers = vmxml.get_controllers("pci")
for controller in pci_controllers:
if controller.get("model") == "pcie-to-pci-bridge":
break
else:
controller_dict = {"model": "pcie-to-pci-bridge"}
libvirt_vmxml.modify_vm_device(vmxml, "controller", controller_dict, 50)
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:
controller_dict = {"model": "pcie-to-pci-bridge"}
libvirt_vmxml.modify_vm_device(vmxml, "controller", controller_dict, 50)

libvirt_vmxml.remove_vm_devices_by_type(vm, "interface")
test.log.debug(f"VMXML of {vm_name}:\n{virsh.dumpxml(vm_name).stdout_text}")

Expand Down

0 comments on commit d9f6455

Please sign in to comment.