]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: log error when incorrect PCI root controller is added to domain
authorLaine Stump <laine@laine.org>
Tue, 19 Apr 2016 21:05:54 +0000 (17:05 -0400)
committerLaine Stump <laine@laine.org>
Tue, 10 May 2016 21:03:24 +0000 (17:03 -0400)
commite5aecc2f800e8e14edd561dc5af4f763f040d842
tree27d9ec474b9a1ba710463c37916c8e307d52d0f1
parentb3f2c7cae8e95ef90c733fc15b26a1def59a7d0f
conf: log error when incorrect PCI root controller is added to domain

libvirt may automatically add a pci-root or pcie-root controller to a
domain, depending on the arch/machinetype, and it hopefully always
makes the right decision about which to add (since in all cases these
controllers are an implicit part of the virtual machine).

But it's always possible that someone will create a config that
explicitly supplies the wrong type of PCI controller for the selected
machinetype. In the past that would lead to an error later when
libvirt was trying to assign addresses to other devices, for example:

  XML error: PCI bus is not compatible with the device at
  0000:00:02.0. Device requires a PCI Express slot, which is not
  provided by bus 0000:00

(that's the error message that appears if you replace the pcie-root
controller in a Q35 domain with a pci-root controller).

This patch adds a check at the same place that the implicit
controllers are added (to ensure that the same logic is used to check
which type of pci root is correct). If a pci controller with index='0'
is already present, we verify that it is of the model that we would
have otherwise added automatically; if not, an error is logged:

  The PCI controller with index='0' must be " model='pcie-root' for
  this machine type, " but model='pci-root' was found instead.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1004602
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/qemuxml2argv-440fx-wrong-root.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-q35-wrong-root.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c