libvirt/tests/qemuxml2xmloutdata
Laine Stump 3ceb4c7df6 qemu: set/validate slot/connection type when assigning slots for PCI devices
Since PCI bridges, PCIe bridges, PCIe switches, and PCIe root ports
all share the same namespace, they are all defined as controllers of
type='pci' in libvirt (but with a differing model attribute). Each of
these controllers has a certain connection type upstream, allows
certain connection types downstream, and each can either allow a
single downstream connection at slot 0, or connections from slot 1 -
31.

Right now, we only support the pci-root and pci-bridge devices, both
of which only allow PCI devices to connect, and both which have usable
slots 1 - 31. In preparation for adding other types of controllers
that have different capabilities, this patch 1) adds info to the
qemuDomainPCIAddressBus object to indicate the capabilities, 2) sets
those capabilities appropriately for pci-root and pci-bridge devices,
and 3) validates that the controller being connected to is the proper
type when allocating slots or validating that a user-selected slot is
appropriate for a device..

Having this infrastructure in place will make it much easier to add
support for the other PCI controller types.

While it would be possible to do all the necessary checking by just
storing the controller model in the qemyuDomainPCIAddressBus, it
greatly simplifies all the validation code to also keep a "flags",
"minSlot" and "maxSlot" for each - that way we can just check those
attributes rather than requiring a nearly identical switch statement
everywhere we need to validate compatibility.

You may notice many places where the flags are seemingly hard-coded to

  QEMU_PCI_CONNECT_HOTPLUGGABLE | QEMU_PCI_CONNECT_TYPE_PCI

This is currently the correct value for all PCI devices, and in the
future will be the default, with small bits of code added to change to
the flags for the few devices which are the exceptions to this rule.

Finally, there are a few places with "FIXME" comments. Note that these
aren't indicating places that are broken according to the currently
supported devices, they are places that will need fixing when support
for new PCI controller models is added.

To assure that there was no regression in the auto-allocation of PCI
addresses or auto-creation of integrated pci-root, ide, and usb
controllers, a new test case (pci-bridge-many-disks) has been added to
both the qemuxml2argv and qemuxml2xml tests. This new test defines a
domain with several dozen virtio disks but no pci-root or
pci-bridges. The .args file of the new test case was created using
libvirt sources from before this patch, and the test still passes
after this patch has been applied.
2013-07-24 06:45:07 -04:00
..
qemuxml2xmlout-balloon-device-auto.xml conf: Swap order of AddImplicitControllers and DomainDefPostParse 2013-06-28 09:52:00 +02:00
qemuxml2xmlout-channel-virtio-auto.xml conf: Swap order of AddImplicitControllers and DomainDefPostParse 2013-06-28 09:52:00 +02:00
qemuxml2xmlout-console-compat-auto.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-console-virtio.xml conf: Swap order of AddImplicitControllers and DomainDefPostParse 2013-06-28 09:52:00 +02:00
qemuxml2xmlout-disk-cdrom-empty.xml numad: Always output 'placement' of <vcpu> 2012-05-08 16:57:37 -06:00
qemuxml2xmlout-disk-mirror.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-disk-scsi-device-auto.xml conf: Swap order of AddImplicitControllers and DomainDefPostParse 2013-06-28 09:52:00 +02:00
qemuxml2xmlout-graphics-listen-network2.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-graphics-spice-timeout.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-hostdev-scsi-autogen-address.xml conf: Generate address for scsi host device automatically 2013-06-01 10:00:23 +08:00
qemuxml2xmlout-memtune.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-metadata.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-numad-static-vcpu-no-numatune.xml numad: Set memory policy from numad advisory nodeset 2012-05-08 16:57:32 -06:00
qemuxml2xmlout-pci-autoadd-addr.xml qemu: auto-add bridges and allow using them 2013-04-25 13:19:40 +02:00
qemuxml2xmlout-pci-autoadd-idx.xml qemu: auto-add bridges and allow using them 2013-04-25 13:19:40 +02:00
qemuxml2xmlout-pci-bridge-many-disks.xml qemu: set/validate slot/connection type when assigning slots for PCI devices 2013-07-24 06:45:07 -04:00
qemuxml2xmlout-s390-defaultconsole.xml S390: Testcase for console default target type (virtio) 2013-06-28 09:52:00 +02:00
qemuxml2xmlout-serial-target-port-auto.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
qemuxml2xmlout-usb-ich9-ehci-addr.xml qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00