[libvirt] [PATCH 3/4] conf: log error when incorrect PCI root controller is added to domain

Cole Robinson crobinso at redhat.com
Sat Apr 23 16:45:36 UTC 2016


On 04/21/2016 02:48 PM, Laine Stump wrote:
> 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 | 47 +++++++++++++++++++++++++++++++++++------------
>  1 file changed, 35 insertions(+), 12 deletions(-)

Given that this is a non-trivial error condition, I think we should have a
qemuxml2xml test case that checks for this error

- Cole




More information about the libvir-list mailing list