libvirt/tests
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
..
capabilityschemadata qemu: Implement CPUs check against machine type's cpu-max 2013-07-01 14:30:42 +02:00
commanddata build: clean up stray files found by 'make distcheck' 2013-05-06 14:01:08 -06:00
confdata
cputestdata cpu: Let explicit features override model features 2013-07-22 13:57:53 +02:00
domainschemadata Add XML config for resource partitions 2013-04-15 17:35:31 +01:00
domainsnapshotxml2xmlin
domainsnapshotxml2xmlout qemu: auto-add pci-root controller for pc machine types 2013-04-25 13:05:10 +02:00
fchostdata/fc_host tests: Add tests for fc_host 2013-05-13 17:24:18 +08:00
interfaceschemadata
lxcxml2xmldata Add 'nbd' as a valid filesystem driver type 2013-05-13 13:15:19 +01:00
networkxml2confdata Revert "Add support for <option> tag in network config" 2013-02-27 10:55:24 -05:00
networkxml2xmlin Configure native vlan modes on Open vSwitch ports 2013-06-25 00:22:36 -04:00
networkxml2xmlout Configure native vlan modes on Open vSwitch ports 2013-06-25 00:22:36 -04:00
nodedevschemadata nodedev: add iommuGroup to node device object 2013-06-26 14:10:56 -04:00
nodeinfodata
nwfilterxml2xmlin
nwfilterxml2xmlout
qemuhelpdata qemu: New cap flags for scsi-generic 2013-05-13 18:30:26 +08:00
qemuhotplugtestdata qemuhotplugtest: Introduce test for chardev hotplug 2013-07-16 11:47:39 +02:00
qemuxml2argvdata qemu: set/validate slot/connection type when assigning slots for PCI devices 2013-07-24 06:45:07 -04:00
qemuxml2xmloutdata qemu: set/validate slot/connection type when assigning slots for PCI devices 2013-07-24 06:45:07 -04:00
qemuxmlnsdata
securityselinuxlabeldata Add a test suite for validating SELinux labelling 2013-01-14 13:40:04 +00:00
sexpr2xmldata
storagepoolschemadata schema: require target path in storage pool xml 2013-05-17 08:33:22 +02:00
storagepoolxml2xmlin Make logical pools independent on target path 2013-07-16 12:16:37 +02:00
storagepoolxml2xmlout Make logical pools independent on target path 2013-07-16 12:16:37 +02:00
storagevolschemadata schema: make source optional in volume XML 2013-05-17 08:35:08 +02:00
storagevolxml2argvdata tests: split long lines 2013-07-18 10:08:04 -06:00
storagevolxml2xmlin conf: add features to volume target XML 2013-06-21 13:25:30 +02:00
storagevolxml2xmlout conf: add features to volume target XML 2013-06-21 13:25:30 +02:00
sysinfodata Implement minimal sysinfo for ARM platforms 2013-04-04 11:07:31 +01:00
vmx2xmldata
xencapsdata
xmconfigdata
xml2sexprdata
xml2vmxdata util: Change virMacAddrFormat to lowercase hex characters 2013-04-02 15:53:43 +02:00
.valgrind.supp valgrind.supp: Add more valgrind suppression paths 2013-07-23 19:04:48 -04:00
capabilityschematest
commandhelper.c testutils: Resolve Coverity issues 2013-07-11 14:18:11 -04:00
commandtest.c Merge virCommandPreserveFD / virCommandTransferFD 2013-07-18 12:18:24 +01:00
cpuset
cputest.c cpu: Let explicit features override model features 2013-07-22 13:57:53 +02:00
define-dev-segfault
domainschematest
domainsnapshotschematest
domainsnapshotxml2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
esxutilstest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
eventtest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
fchosttest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
fdstreamtest.c Introduce virFilePrintf() as a portable fprintf() 2013-05-31 10:51:33 -06:00
int-overflow
interfaceschematest
interfacexml2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
jsontest.c json: support removing a value from an object 2013-05-13 15:15:54 -06:00
libvirtd-fail
libvirtd-pool
libvirtdconftest.c Adapt to VIR_ALLOC and virAsprintf in tests/* 2013-07-10 11:07:33 +02:00
lxcxml2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
Makefile.am Add API for calling systemd-machined's DBus API 2013-07-22 13:09:58 +01:00
networkschematest
networkxml2conftest.c viralloc: Report OOM error on failure 2013-07-10 11:07:31 +02:00
networkxml2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
nodedevschematest
nodedevxml2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
nodeinfotest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
nwfilterschematest
nwfilterxml2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
object-locking.ml Rename 'DeviceMonitor' to 'NodeDeviceDriver' 2013-04-24 10:59:53 +01:00
oomtrace.pl
openvzutilstest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
openvzutilstest.conf
pkix_asn1_tab.c
qemuargv2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
qemuhelptest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
qemuhotplugtest.c qemu: Emit VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED events 2013-07-18 15:28:45 +02:00
qemumonitorjsontest.c tests: Free test at the end of GetDeviceAliases JSON test 2013-07-22 16:59:14 +02:00
qemumonitortest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
qemumonitortestutils.c Adapt to VIR_ALLOC and virAsprintf in tests/* 2013-07-10 11:07:33 +02:00
qemumonitortestutils.h maint: Rename xmlconf to xmlopt and virDomainXMLConfig to virDomainXMLOption 2013-04-04 22:18:56 +02:00
qemuxml2argvtest.c qemu: set/validate slot/connection type when assigning slots for PCI devices 2013-07-24 06:45:07 -04:00
qemuxml2xmltest.c qemu: set/validate slot/connection type when assigning slots for PCI devices 2013-07-24 06:45:07 -04:00
qemuxmlnstest.c qemu: Add callback struct for qemuBuildCommandLine 2013-05-20 20:14:19 +08:00
read-bufsiz
read-non-seekable
reconnect.c Replace two-state local integers with bool 2013-06-06 17:22:53 +02:00
schematestutils.sh tests: use portable shell code 2013-05-09 11:46:45 -06:00
seclabeltest.c tests: uniformly report test failures 2013-02-25 17:38:11 -07:00
securityselinuxhelper.c Adapt to VIR_STRDUP and VIR_STRNDUP in tests/* 2013-05-10 11:54:29 +02:00
securityselinuxlabeltest.c Adapt to VIR_ALLOC and virAsprintf in tests/* 2013-07-10 11:07:33 +02:00
securityselinuxtest.c Adapt to VIR_ALLOC and virAsprintf in tests/* 2013-07-10 11:07:33 +02:00
sexpr2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
shunloadhelper.c shunloadtest: Resolve Coverity CHECKED_RETURN error 2013-05-21 09:22:21 -04:00
shunloadtest.c shunloadtest: Resolve Coverity CHECKED_RETURN error 2013-05-21 09:22:21 -04:00
sockettest.c virsocket: Introduce virSocketAddrIsWildcard 2013-06-07 15:21:57 +02:00
ssh.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
start
statstest.c Rename stats_linux.{c,h} to virstatslinux.{c,h} 2012-12-21 11:19:48 +00:00
storagebackendsheepdogtest.c Build breaker - requires VIR_FROM_THIS 2013-05-10 08:52:43 -04:00
storagepoolschematest schema: require target path in storage pool xml 2013-05-17 08:33:22 +02:00
storagepoolxml2xmltest.c Make logical pools independent on target path 2013-07-16 12:16:37 +02:00
storagevolschematest schema: make source optional in volume XML 2013-05-17 08:35:08 +02:00
storagevolxml2argvtest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
storagevolxml2xmltest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
sysinfotest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
test_conf.c viralloc: Report OOM error on failure 2013-07-10 11:07:31 +02:00
test_conf.sh rename tests/conftest.c 2013-03-19 13:13:28 -06:00
test-lib.sh
testutils.c Change s/i/iv/ in test code to avoid syntax-check 2013-07-19 13:08:30 +01:00
testutils.h Add API for calling systemd-machined's DBus API 2013-07-22 13:09:58 +01:00
testutilslxc.c virCaps: get rid of defaultConsoleTargetType callback 2013-04-04 22:42:39 +02:00
testutilslxc.h
testutilsqemu.c qemu: Add callback struct for qemuBuildCommandLine 2013-05-20 20:14:19 +08:00
testutilsqemu.h build: skip qemu in tests when !WITH_QEMU 2013-05-31 11:35:34 -06:00
testutilsxen.c virCaps: get rid of defaultConsoleTargetType callback 2013-04-04 22:42:39 +02:00
testutilsxen.h virCaps: get rid of defaultConsoleTargetType callback 2013-04-04 22:42:39 +02:00
utiltest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
vcpupin
viratomictest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
virauthconfigtest.c virutil: Move string related functions to virstring.c 2013-05-02 16:56:55 +02:00
virbitmaptest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
virbuftest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
vircgroupmock.c Workaround issue with clang and inline functions with static vars 2013-05-14 15:00:22 +01:00
vircgrouptest.c Remove obsolete cgroups creation apis 2013-07-23 22:46:31 +01:00
virdbustest.c Introduce virDBusCallMethod & virDBusMessageRead methods 2013-07-22 13:09:58 +01:00
virdrivermoduletest.c virutil: Move string related functions to virstring.c 2013-05-02 16:56:55 +02:00
virendiantest.c util: add virendian.h macros 2013-02-12 09:00:15 -07:00
virhashdata.h
virhashtest.c virAsprintf: correctly check return value 2013-07-18 14:05:46 +02:00
viridentitytest.c virutil: Move string related functions to virstring.c 2013-05-02 16:56:55 +02:00
virkeycodetest.c Add a test suite for keycode mapping functions 2013-04-08 10:03:20 +01:00
virkeyfiletest.c virutil: Move string related functions to virstring.c 2013-05-02 16:56:55 +02:00
virlockspacetest.c util: move virFile* functions from virutil.c to virfile.c 2013-05-10 13:09:30 -04:00
virnetmessagetest.c Adapt to VIR_ALLOC and virAsprintf in tests/* 2013-07-10 11:07:33 +02:00
virnetsockettest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
virnettlscontexttest.c Fix TLS tests with gnutls 3 2013-03-04 17:42:16 +00:00
virportallocatortest.c util: move virFile* functions from virutil.c to virfile.c 2013-05-10 13:09:30 -04:00
virsh-all
virsh-optparse
virsh-schedinfo Allow multiple parameters for schedinfo 2013-04-03 08:49:30 +02:00
virsh-synopsis
virsh-undefine
virshtest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
virstoragetest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
virstringtest.c Introduce virFilePrintf() as a portable fprintf() 2013-05-31 10:51:33 -06:00
virsystemdmock.c Add logic for handling systemd-machined non-existance 2013-07-23 22:35:26 +01:00
virsystemdtest.c Add logic for handling systemd-machined non-existance 2013-07-23 22:35:26 +01:00
virt-aa-helper-test add vnc unix sockets to apparmor policy 2012-12-11 14:32:39 -07:00
virtimetest.c virutil: Move string related functions to virstring.c 2013-05-02 16:56:55 +02:00
viruritest.c tests/: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
vmx2xmltest.c Adapt to VIR_STRDUP and VIR_STRNDUP in tests/* 2013-05-10 11:54:29 +02:00
xencapstest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
xmconfigtest.c viralloc: Report OOM error on failure 2013-07-10 11:07:31 +02:00
xml2sexprtest.c Introduce OOM reporting to virAsprintf 2013-07-10 11:07:31 +02:00
xml2vmxtest.c Adapt to VIR_STRDUP and VIR_STRNDUP in tests/* 2013-05-10 11:54:29 +02:00