• L
    conf: log error when incorrect PCI root controller is added to domain · e5aecc2f
    Laine Stump 提交于
    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
    e5aecc2f
qemuxml2argvtest.c 75.8 KB