diff mbox

[6/4] qemu: address: Remove QEMU_CAPS_DEVICE usage

Message ID 442bcb50901453a1a78552bcd8476d2cd6f560fa.1463261955.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson May 14, 2016, 9:39 p.m. UTC
All qemu versions we support have QEMU_CAPS_DEVICE, so checking
for it is redundant. Remove the usage.

The code diff isn't clear, but all that code is just inindented
with no other change.

Test cases that hit qemuDomainAssignAddresses but don't have
infrastructure for specifying qemuCaps values see lots of
churn, since now PCI addresses are in the XML output.
---
 src/qemu/qemu_domain_address.c                     | 252 ++++++++++-----------
 .../disk_snapshot_redefine.xml                     |  12 +-
 .../external_vm_redefine.xml                       |  12 +-
 tests/domainsnapshotxml2xmlout/full_domain.xml     |  12 +-
 tests/domainsnapshotxml2xmlout/metadata.xml        |  12 +-
 tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-boot-floppy.xml  |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-boot-network.xml |   8 +-
 .../qemuargv2xml-clock-localtime.xml               |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml  |   8 +-
 .../qemuargv2xml-console-compat.xml                |   8 +-
 .../qemuargv2xml-disk-cdrom-empty.xml              |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml |   8 +-
 .../qemuargv2xml-disk-drive-boot-cdrom.xml         |   8 +-
 .../qemuargv2xml-disk-drive-boot-disk.xml          |   8 +-
 .../qemuargv2xml-disk-drive-cache-directsync.xml   |   8 +-
 .../qemuargv2xml-disk-drive-cache-unsafe.xml       |   8 +-
 .../qemuargv2xml-disk-drive-cache-v2-none.xml      |   8 +-
 .../qemuargv2xml-disk-drive-cache-v2-wb.xml        |   8 +-
 .../qemuargv2xml-disk-drive-cache-v2-wt.xml        |   8 +-
 ...muargv2xml-disk-drive-error-policy-enospace.xml |   8 +-
 .../qemuargv2xml-disk-drive-error-policy-stop.xml  |   8 +-
 ...xml-disk-drive-error-policy-wreport-rignore.xml |   8 +-
 .../qemuargv2xml-disk-drive-fmt-qcow.xml           |   8 +-
 .../qemuargv2xml-disk-drive-network-gluster.xml    |   6 +-
 .../qemuargv2xml-disk-drive-network-iscsi-auth.xml |   6 +-
 .../qemuargv2xml-disk-drive-network-iscsi.xml      |   6 +-
 .../qemuargv2xml-disk-drive-network-nbd-export.xml |   9 +-
 ...argv2xml-disk-drive-network-nbd-ipv6-export.xml |   9 +-
 .../qemuargv2xml-disk-drive-network-nbd-ipv6.xml   |   9 +-
 .../qemuargv2xml-disk-drive-network-nbd-unix.xml   |   9 +-
 .../qemuargv2xml-disk-drive-network-nbd.xml        |   9 +-
 .../qemuargv2xml-disk-drive-network-rbd-auth.xml   |   9 +-
 ...emuargv2xml-disk-drive-network-rbd-ceph-env.xml |   9 +-
 .../qemuargv2xml-disk-drive-network-rbd-ipv6.xml   |   9 +-
 .../qemuargv2xml-disk-drive-network-rbd.xml        |  12 +-
 .../qemuargv2xml-disk-drive-network-sheepdog.xml   |   9 +-
 .../qemuargv2xmldata/qemuargv2xml-disk-floppy.xml  |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml  |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml   |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-disk-virtio.xml  |  10 +-
 .../qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml  |   8 +-
 .../qemuargv2xml-graphics-sdl-fullscreen.xml       |   9 +-
 .../qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml |   9 +-
 .../qemuargv2xml-graphics-vnc-policy.xml           |   9 +-
 .../qemuargv2xml-graphics-vnc-sasl.xml             |   9 +-
 .../qemuargv2xml-graphics-vnc-socket.xml           |   9 +-
 .../qemuargv2xml-graphics-vnc-tls.xml              |   9 +-
 .../qemuargv2xml-graphics-vnc-websocket.xml        |   5 +-
 .../qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml |   9 +-
 .../qemuargv2xml-hostdev-pci-address.xml           |   9 +-
 .../qemuargv2xml-hostdev-usb-address.xml           |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml |   4 +-
 tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml     |   4 +-
 .../qemuargv2xml-input-usbmouse.xml                |   8 +-
 .../qemuargv2xml-input-usbtablet.xml               |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-kvm-features.xml |   4 +-
 tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml   |   4 +-
 .../qemuargv2xml-machine-core-off.xml              |   8 +-
 .../qemuargv2xml-machine-core-on.xml               |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-migrate.xml    |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml  |   8 +-
 .../qemuargv2xml-misc-disable-s3.xml               |   8 +-
 .../qemuargv2xml-misc-disable-suspends.xml         |   8 +-
 .../qemuargv2xml-misc-enable-s4.xml                |   8 +-
 .../qemuargv2xml-misc-no-reboot.xml                |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml  |   8 +-
 .../qemuargv2xml-net-eth-ifname.xml                |   9 +-
 tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml    |   9 +-
 tests/qemuargv2xmldata/qemuargv2xml-net-user.xml   |   9 +-
 tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml |   9 +-
 .../qemuargv2xml-nographics-vga.xml                |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-nosharepages.xml |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-pseries-disk.xml |   5 +-
 .../qemuargv2xml-pseries-nvram.xml                 |   4 +-
 .../qemuargv2xml-qemu-ns-no-env.xml                |   8 +-
 .../qemuargv2xml-reboot-timeout-disabled.xml       |   4 +-
 .../qemuargv2xml-reboot-timeout-enabled.xml        |   4 +-
 tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-serial-file.xml  |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-serial-many.xml  |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml |   8 +-
 .../qemuargv2xml-serial-tcp-telnet.xml             |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml |   8 +-
 .../qemuargv2xmldata/qemuargv2xml-serial-unix.xml  |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml  |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-smp.xml        |   8 +-
 tests/qemuargv2xmldata/qemuargv2xml-sound.xml      |  16 +-
 tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml   |   8 +-
 tests/qemuxml2argvtest.c                           |   2 +-
 93 files changed, 688 insertions(+), 305 deletions(-)

-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Cole Robinson May 18, 2016, 11:53 a.m. UTC | #1
On 05/18/2016 06:27 AM, Andrea Bolognani wrote:
> On Sat, 2016-05-14 at 17:39 -0400, Cole Robinson wrote:

>> All qemu versions we support have QEMU_CAPS_DEVICE, so checking

>> for it is redundant. Remove the usage.

>>  

>> The code diff isn't clear, but all that code is just inindented

>> with no other change.

> 

> 'git show -w' is your friend ;)

> 

> This information, however, should probably be moved out of

> the commit message and after the '---' separator.

> 

>> Test cases that hit qemuDomainAssignAddresses but don't have

>> infrastructure for specifying qemuCaps values see lots of

>> churn, since now PCI addresses are in the XML output.

> 

> So, I want to make sure I'm getting this right: the addresses

> should have been there in the first place, and would be if we

> were processing the input files in the real world, outside of

> the test suite; however, since the addresses being there

> depend on QEMU_CAPS_DEVICE, and some test cases run with an

> empty virQEMUCaps, they never appeared until we got rid of

> the check on QEMU_CAPS_DEVICE.

> 

> ACK if the above makes sense.


Kind of. Prior to patch #2, the test suite output was correct (no addresses),
it's what we were returning via domxml-from-native. After patch #2, the test
suite output was wrong for all real world usage; it didn't change because it
was only hitting a !QEMU_CAPS_DEVICE code path

So the potentially contentious bit is that patch #2 changes domxml-from-native
output to contain addresses, however that's exactly the same result that will
happen when the XML would eventually be defined anyways, so it's effectively
the same result as pre-patch #2 anyways. If we think of domxml-from-native as
telling the user 'this is exactly what libvirt thinks that command line is'
then we are now giving more accurate results

Let me know if that still warrants the ACK

Thanks,
Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Cole Robinson May 18, 2016, 6:37 p.m. UTC | #2
On 05/18/2016 10:59 AM, Andrea Bolognani wrote:
> On Wed, 2016-05-18 at 09:58 -0400, Laine Stump wrote:

>> On 05/18/2016 07:53 AM, Cole Robinson wrote:

>>>

>>> Kind of. Prior to patch #2, the test suite output was correct (no addresses),

>>> it's what we were returning via domxml-from-native. After patch #2, the test

>>> suite output was wrong for all real world usage; it didn't change because it

>>> was only hitting a !QEMU_CAPS_DEVICE code path

>>>

>>> So the potentially contentious bit is that patch #2 changes domxml-from-native

>>> output to contain addresses, however that's exactly the same result that will

>>> happen when the XML would eventually be defined anyways, so it's effectively

>>> the same result as pre-patch #2 anyways. If we think of domxml-from-native as

>>> telling the user 'this is exactly what libvirt thinks that command line is'

>>> then we are now giving more accurate results

>>>

>>> Let me know if that still warrants the ACK

>>

>> My opinion is that this is a change for the better. While it is true 

>> that this could lead to XML that potentially shows different PCI 

>> addresses than what would have been auto-assigned by qemu when presented 

>> with the original commandline, it *is* showing the addresses that would 

>> be auto-allocated by libvirt if you had fed the "un-addressified" XML to 

>> libvirt - so at least the user will get a warning rather than being 

>> surprised at runtime. And it's not as if the output of 

>> domxml-from-native has ever produced anything even close to the correct 

>> XML in any real world situation. (dreadkopp in public #virt pastebin'ed 

>> an example last night - 90% of it was translated directly into 

>> <qemu:arg> elements).

> 

> After reading Cole's explanation, I tend to agree.

> 

> So I guess we can go ahead and merge this, as well as 5/4 :)

> 


Thanks pushed now with your suggested changes, except the bits I just mailed about

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9c8c262..9d09b3a 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1463,158 +1463,155 @@  qemuDomainAssignPCIAddresses(virDomainDefPtr def,
     int ret = -1;
     virDomainPCIAddressSetPtr addrs = NULL;
     qemuDomainObjPrivatePtr priv = NULL;
+    int max_idx = -1;
+    int nbuses = 0;
+    size_t i;
+    int rv;
+    bool buses_reserved = true;
 
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-        int max_idx = -1;
-        int nbuses = 0;
-        size_t i;
-        int rv;
-        bool buses_reserved = true;
-
-        virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
+    virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
 
-        for (i = 0; i < def->ncontrollers; i++) {
-            if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
-                if ((int) def->controllers[i]->idx > max_idx)
-                    max_idx = def->controllers[i]->idx;
-            }
+    for (i = 0; i < def->ncontrollers; i++) {
+        if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
+            if ((int) def->controllers[i]->idx > max_idx)
+                max_idx = def->controllers[i]->idx;
         }
+    }
 
-        nbuses = max_idx + 1;
-
-        if (nbuses > 0 &&
-            virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) {
-            virDomainDeviceInfo info;
+    nbuses = max_idx + 1;
 
-            /* 1st pass to figure out how many PCI bridges we need */
-            if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, true)))
-                goto cleanup;
+    if (nbuses > 0 &&
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) {
+        virDomainDeviceInfo info;
 
-            if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps,
-                                                         addrs) < 0)
-                goto cleanup;
+        /* 1st pass to figure out how many PCI bridges we need */
+        if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, true)))
+            goto cleanup;
 
-            for (i = 0; i < addrs->nbuses; i++) {
-                if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i]))
-                    buses_reserved = false;
-            }
+        if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps,
+                                                     addrs) < 0)
+            goto cleanup;
 
-            /* Reserve 1 extra slot for a (potential) bridge only if buses
-             * are not fully reserved yet
-             */
-            if (!buses_reserved &&
-                virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
-                goto cleanup;
+        for (i = 0; i < addrs->nbuses; i++) {
+            if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i]))
+                buses_reserved = false;
+        }
 
-            if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
-                goto cleanup;
+        /* Reserve 1 extra slot for a (potential) bridge only if buses
+         * are not fully reserved yet
+         */
+        if (!buses_reserved &&
+            virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
+            goto cleanup;
 
-            for (i = 1; i < addrs->nbuses; i++) {
-                virDomainPCIAddressBusPtr bus = &addrs->buses[i];
+        if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
+            goto cleanup;
 
-                if ((rv = virDomainDefMaybeAddController(
-                         def, VIR_DOMAIN_CONTROLLER_TYPE_PCI,
-                         i, bus->model)) < 0)
-                    goto cleanup;
-                /* If we added a new bridge, we will need one more address */
-                if (rv > 0 &&
-                    virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
-                    goto cleanup;
-            }
-            nbuses = addrs->nbuses;
-            virDomainPCIAddressSetFree(addrs);
-            addrs = NULL;
+        for (i = 1; i < addrs->nbuses; i++) {
+            virDomainPCIAddressBusPtr bus = &addrs->buses[i];
 
-        } else if (max_idx > 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("PCI bridges are not supported "
-                             "by this QEMU binary"));
-            goto cleanup;
+            if ((rv = virDomainDefMaybeAddController(
+                     def, VIR_DOMAIN_CONTROLLER_TYPE_PCI,
+                     i, bus->model)) < 0)
+                goto cleanup;
+            /* If we added a new bridge, we will need one more address */
+            if (rv > 0 &&
+                virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
+                goto cleanup;
         }
+        nbuses = addrs->nbuses;
+        virDomainPCIAddressSetFree(addrs);
+        addrs = NULL;
 
-        if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
-            goto cleanup;
+    } else if (max_idx > 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("PCI bridges are not supported "
+                         "by this QEMU binary"));
+        goto cleanup;
+    }
 
-        if (qemuDomainSupportsPCI(def, qemuCaps)) {
-            if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps,
-                                                         addrs) < 0)
-                goto cleanup;
+    if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
+        goto cleanup;
 
-            if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
-                goto cleanup;
+    if (qemuDomainSupportsPCI(def, qemuCaps)) {
+        if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps,
+                                                     addrs) < 0)
+            goto cleanup;
 
-            for (i = 0; i < def->ncontrollers; i++) {
-                virDomainControllerDefPtr cont = def->controllers[i];
-                int idx = cont->idx;
-                virPCIDeviceAddressPtr addr;
-                virDomainPCIControllerOptsPtr options;
+        if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
+            goto cleanup;
 
-                if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI)
-                    continue;
+        for (i = 0; i < def->ncontrollers; i++) {
+            virDomainControllerDefPtr cont = def->controllers[i];
+            int idx = cont->idx;
+            virPCIDeviceAddressPtr addr;
+            virDomainPCIControllerOptsPtr options;
 
-                addr = &cont->info.addr.pci;
-                options = &cont->opts.pciopts;
+            if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI)
+                continue;
 
-                /* set default model name (the actual name of the
-                 * device in qemu) for any controller that doesn't yet
-                 * have it set.
-                 */
-                qemuDomainPCIControllerSetDefaultModelName(cont);
+            addr = &cont->info.addr.pci;
+            options = &cont->opts.pciopts;
 
-                /* set defaults for any other auto-generated config
-                 * options for this controller that haven't been
-                 * specified in config.
-                 */
-                switch ((virDomainControllerModelPCI)cont->model) {
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
-                    if (options->chassisNr == -1)
-                        options->chassisNr = cont->idx;
-                    break;
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
-                    if (options->chassis == -1)
-                       options->chassis = cont->idx;
-                    if (options->port == -1)
-                       options->port = (addr->slot << 3) + addr->function;
-                    break;
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
-                    if (options->chassis == -1)
-                       options->chassis = cont->idx;
-                    if (options->port == -1)
-                       options->port = addr->slot;
-                    break;
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS:
-                    if (options->busNr == -1)
-                        options->busNr = qemuDomainAddressFindNewBusNr(def);
-                    if (options->busNr == -1) {
-                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                       _("No free busNr lower than current "
-                                         "lowest busNr is available to "
-                                         "auto-assign to bus %d. Must be "
-                                         "manually assigned"),
-                                       addr->bus);
-                        goto cleanup;
-                    }
-                    break;
-                case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
-                case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
-                    break;
-                }
+            /* set default model name (the actual name of the
+             * device in qemu) for any controller that doesn't yet
+             * have it set.
+             */
+            qemuDomainPCIControllerSetDefaultModelName(cont);
 
-                /* check if every PCI bridge controller's ID is greater than
-                 * the bus it is placed onto
-                 */
-                if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE &&
-                    idx <= addr->bus) {
+            /* set defaults for any other auto-generated config
+             * options for this controller that haven't been
+             * specified in config.
+             */
+            switch ((virDomainControllerModelPCI)cont->model) {
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
+                if (options->chassisNr == -1)
+                    options->chassisNr = cont->idx;
+                break;
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
+                if (options->chassis == -1)
+                   options->chassis = cont->idx;
+                if (options->port == -1)
+                   options->port = (addr->slot << 3) + addr->function;
+                break;
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
+                if (options->chassis == -1)
+                   options->chassis = cont->idx;
+                if (options->port == -1)
+                   options->port = addr->slot;
+                break;
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS:
+                if (options->busNr == -1)
+                    options->busNr = qemuDomainAddressFindNewBusNr(def);
+                if (options->busNr == -1) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                   _("PCI controller at index %d (0x%02x) has "
-                                     "bus='0x%02x', but bus must be <= index"),
-                                   idx, idx, addr->bus);
+                                   _("No free busNr lower than current "
+                                     "lowest busNr is available to "
+                                     "auto-assign to bus %d. Must be "
+                                     "manually assigned"),
+                                   addr->bus);
                     goto cleanup;
                 }
+                break;
+            case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
+                break;
+            }
+
+            /* check if every PCI bridge controller's ID is greater than
+             * the bus it is placed onto
+             */
+            if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE &&
+                idx <= addr->bus) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("PCI controller at index %d (0x%02x) has "
+                                 "bus='0x%02x', but bus must be <= index"),
+                               idx, idx, addr->bus);
+                goto cleanup;
             }
         }
     }
@@ -1681,7 +1678,6 @@  qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
         VIR_WARN("Unable to release CCW address on %s",
                  NULLSTR(devstr));
     else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
-             virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
              virDomainPCIAddressReleaseSlot(priv->pciaddrs,
                                             &info->addr.pci) < 0)
         VIR_WARN("Unable to release PCI address on %s",
diff --git a/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml b/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml
index eb7f567..297ca7f 100644
--- a/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml
+++ b/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml
@@ -70,12 +70,18 @@ 
         <target dev='hdf' bus='ide'/>
         <address type='drive' controller='0' bus='5' target='0' unit='0'/>
       </disk>
-      <controller type='usb' index='0'/>
-      <controller type='ide' index='0'/>
+      <controller type='usb' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+      </controller>
+      <controller type='ide' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+      </controller>
       <controller type='pci' index='0' model='pci-root'/>
       <input type='mouse' bus='ps2'/>
       <input type='keyboard' bus='ps2'/>
-      <memballoon model='virtio'/>
+      <memballoon model='virtio'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      </memballoon>
     </devices>
   </domain>
   <active>1</active>
diff --git a/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml b/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml
index e8e4640..e2e7a40 100644
--- a/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml
+++ b/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml
@@ -35,12 +35,18 @@ 
         <target dev='hda' bus='ide'/>
         <address type='drive' controller='0' bus='0' target='0' unit='0'/>
       </disk>
-      <controller type='usb' index='0'/>
-      <controller type='ide' index='0'/>
+      <controller type='usb' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+      </controller>
+      <controller type='ide' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+      </controller>
       <controller type='pci' index='0' model='pci-root'/>
       <input type='mouse' bus='ps2'/>
       <input type='keyboard' bus='ps2'/>
-      <memballoon model='virtio'/>
+      <memballoon model='virtio'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      </memballoon>
     </devices>
   </domain>
 </domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/full_domain.xml b/tests/domainsnapshotxml2xmlout/full_domain.xml
index 7d70a11..0b0b7e0 100644
--- a/tests/domainsnapshotxml2xmlout/full_domain.xml
+++ b/tests/domainsnapshotxml2xmlout/full_domain.xml
@@ -28,12 +28,18 @@ 
         <target dev='hda' bus='ide'/>
         <address type='drive' controller='0' bus='0' target='0' unit='0'/>
       </disk>
-      <controller type='usb' index='0'/>
-      <controller type='ide' index='0'/>
+      <controller type='usb' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+      </controller>
+      <controller type='ide' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+      </controller>
       <controller type='pci' index='0' model='pci-root'/>
       <input type='mouse' bus='ps2'/>
       <input type='keyboard' bus='ps2'/>
-      <memballoon model='virtio'/>
+      <memballoon model='virtio'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      </memballoon>
     </devices>
   </domain>
   <active>1</active>
diff --git a/tests/domainsnapshotxml2xmlout/metadata.xml b/tests/domainsnapshotxml2xmlout/metadata.xml
index 9a2c24f..f0d8d07 100644
--- a/tests/domainsnapshotxml2xmlout/metadata.xml
+++ b/tests/domainsnapshotxml2xmlout/metadata.xml
@@ -32,12 +32,18 @@ 
         <target dev='hda' bus='ide'/>
         <address type='drive' controller='0' bus='0' target='0' unit='0'/>
       </disk>
-      <controller type='usb' index='0'/>
-      <controller type='ide' index='0'/>
+      <controller type='usb' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+      </controller>
+      <controller type='ide' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+      </controller>
       <controller type='pci' index='0' model='pci-root'/>
       <input type='mouse' bus='ps2'/>
       <input type='keyboard' bus='ps2'/>
-      <memballoon model='virtio'/>
+      <memballoon model='virtio'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      </memballoon>
     </devices>
   </domain>
 </domainsnapshot>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml b/tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml
index 5bcc1a7..f4a471a 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml
@@ -21,9 +21,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-boot-floppy.xml b/tests/qemuargv2xmldata/qemuargv2xml-boot-floppy.xml
index a507558..9bf4414 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-boot-floppy.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-boot-floppy.xml
@@ -26,10 +26,14 @@ 
       <target dev='fda' bus='fdc'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='fdc' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-boot-network.xml b/tests/qemuargv2xmldata/qemuargv2xml-boot-network.xml
index d060da6..b7e5dde 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-boot-network.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-boot-network.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-clock-localtime.xml b/tests/qemuargv2xmldata/qemuargv2xml-clock-localtime.xml
index 7ffdb97..b039541 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-clock-localtime.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-clock-localtime.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml b/tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml
index ecefafa..9beaf06 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml b/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml
index 3768715..5a17374 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='pty'>
       <target port='0'/>
     </serial>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom-empty.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom-empty.xml
index aaa7e32..ea7653b 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom-empty.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom-empty.xml
@@ -26,9 +26,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml
index 146f453..f8a7c77 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-cdrom.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-cdrom.xml
index 2984763..12d27d6 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-cdrom.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-cdrom.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-disk.xml
index 40ffdfc..ab7a9ed 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-disk.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-disk.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-directsync.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-directsync.xml
index 5a12671..08198f5 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-directsync.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-directsync.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-unsafe.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-unsafe.xml
index a6215bc..544524b 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-unsafe.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-unsafe.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-none.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-none.xml
index 8064075..70c5576 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-none.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-none.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wb.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wb.xml
index 92d6250..8ee2360 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wb.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wb.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wt.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wt.xml
index 0ce3530..a18fda7 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wt.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wt.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-enospace.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-enospace.xml
index 59b9262..38f3877 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-enospace.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-enospace.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-stop.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-stop.xml
index 8be911e..f3afc3f 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-stop.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-stop.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-wreport-rignore.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-wreport-rignore.xml
index fade9b6..d8eefcb 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-wreport-rignore.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-wreport-rignore.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-fmt-qcow.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-fmt-qcow.xml
index a904719..d14710f 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-fmt-qcow.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-fmt-qcow.xml
@@ -27,9 +27,13 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.xml
index 0c66e7f..160fd9d 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.xml
@@ -20,6 +20,7 @@ 
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
@@ -27,8 +28,11 @@ 
         <host transport='unix' socket='/path/to/sock'/>
       </source>
       <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml
index b5f948b..36da19e 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml
@@ -23,6 +23,7 @@ 
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
@@ -30,8 +31,11 @@ 
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi.xml
index 31fc9f2..05c7315 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi.xml
@@ -20,6 +20,7 @@ 
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
@@ -27,8 +28,11 @@ 
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-export.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-export.xml
index 8f50481..74ec758 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-export.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-export.xml
@@ -26,10 +26,15 @@ 
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6-export.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6-export.xml
index a0557e0..25a4fb8 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6-export.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6-export.xml
@@ -26,10 +26,15 @@ 
         <host name='::1' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6.xml
index 2828249..979caf5 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6.xml
@@ -26,10 +26,15 @@ 
         <host name='::1' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-unix.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-unix.xml
index 1a315b7..fc08eb3 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-unix.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-unix.xml
@@ -26,10 +26,15 @@ 
         <host transport='unix' socket='/var/run/nbdsock'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd.xml
index feae85d..9c2e959 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd.xml
@@ -26,10 +26,15 @@ 
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml
index bf82750..c3ef946 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml
@@ -31,10 +31,15 @@ 
         <host name='mon3.example.org' port='6322'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ceph-env.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ceph-env.xml
index afa11ec..928a30c 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ceph-env.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ceph-env.xml
@@ -28,10 +28,15 @@ 
         <host name='mon3.example.org' port='6322'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ipv6.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ipv6.xml
index 7f73472..331b6b9 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ipv6.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ipv6.xml
@@ -29,10 +29,15 @@ 
         <host name='2001:db8::ff00:42:8329' port='6322'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd.xml
index d605aac..fd4e505 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd.xml
@@ -28,6 +28,7 @@ 
         <host name='mon3.example.org' port='6322'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
@@ -35,6 +36,7 @@ 
         <snapshot name='asdf'/>
       </source>
       <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
@@ -45,6 +47,7 @@ 
         <snapshot name='foo'/>
       </source>
       <target dev='vdc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
@@ -53,10 +56,15 @@ 
         <config file='/blah/test.conf'/>
       </source>
       <target dev='vdd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-sheepdog.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-sheepdog.xml
index 5868d5b..0f789e2 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-sheepdog.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-sheepdog.xml
@@ -26,10 +26,15 @@ 
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-floppy.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-floppy.xml
index 85f8b41..ff31982 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-floppy.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-floppy.xml
@@ -32,10 +32,14 @@ 
       <target dev='fdb' bus='fdc'/>
       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='fdc' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml
index 8ce58e3..834708c 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml
@@ -38,9 +38,13 @@ 
       <target dev='hdd' bus='ide'/>
       <address type='drive' controller='0' bus='1' target='0' unit='1'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml
index 729c3c0..8bf3990 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml
@@ -25,9 +25,13 @@ 
       <source file='/tmp/usbdisk.img'/>
       <target dev='sda' bus='usb'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-virtio.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-virtio.xml
index 9889132..fb8ab06 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-virtio.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-virtio.xml
@@ -31,15 +31,21 @@ 
       <driver name='qemu' type='raw'/>
       <source file='/tmp/data.img'/>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/tmp/logs.img'/>
       <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml
index 2fe02f9..17c5e2c 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml
@@ -37,9 +37,13 @@ 
       <source file='/tmp/logs.img'/>
       <target dev='xvdg' bus='xen'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl-fullscreen.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl-fullscreen.xml
index 0bc0436..5ff9913 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl-fullscreen.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl-fullscreen.xml
@@ -20,14 +20,19 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml
index 7cd9d6c..f99a829 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml
@@ -20,14 +20,19 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/>
     <video>
       <model type='vga' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml
index 3ebb375..eaf6997 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <graphics type='vnc' port='65530' autoport='no' listen='::' sharePolicy='allow-exclusive'>
@@ -30,6 +34,7 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml
index 5b7d560..7f66e5e 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'>
@@ -30,6 +34,7 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml
index 93daa76..edbaab3 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml
@@ -20,14 +20,19 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <graphics type='vnc' socket='/tmp/foo.socket'/>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml
index 5b7d560..7f66e5e 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'>
@@ -30,6 +34,7 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml
index 260ad1c..bafbcc2 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml
@@ -14,7 +14,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
@@ -23,6 +25,7 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml
index 374345b..430d440 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'>
@@ -30,6 +34,7 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml
index 99cc9d7..111f659 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml
@@ -20,15 +20,20 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <source>
         <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
       </source>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </hostdev>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-usb-address.xml b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-usb-address.xml
index ddc95d7..d4a3f41 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-usb-address.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-usb-address.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <hostdev mode='subsystem' type='usb' managed='no'>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml b/tests/qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml
index e549e05..c71c65d 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml
@@ -17,7 +17,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml b/tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml
index 5a19af0..53ce642 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml
@@ -22,7 +22,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-input-usbmouse.xml b/tests/qemuargv2xmldata/qemuargv2xml-input-usbmouse.xml
index 5a3a9e6..83aeb03 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-input-usbmouse.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-input-usbmouse.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='usb'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-input-usbtablet.xml b/tests/qemuargv2xmldata/qemuargv2xml-input-usbtablet.xml
index 0b9c242..cf1a018 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-input-usbtablet.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-input-usbtablet.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='tablet' bus='usb'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-kvm-features.xml b/tests/qemuargv2xmldata/qemuargv2xml-kvm-features.xml
index 840e3e2..3f21de3 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-kvm-features.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-kvm-features.xml
@@ -20,7 +20,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml b/tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml
index ae8ccc9..888dd9e 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml
@@ -19,7 +19,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/kvm</emulator>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-core-off.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-core-off.xml
index 84ebc9b..13c4ffe 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-machine-core-off.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-core-off.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-core-on.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-core-on.xml
index b0d7454..05da1dc 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-machine-core-on.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-core-on.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-migrate.xml b/tests/qemuargv2xmldata/qemuargv2xml-migrate.xml
index ecefafa..9beaf06 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-migrate.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-migrate.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml
index 397615c..3752878 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml
@@ -23,9 +23,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml
index 546e48f..9c08695 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml
@@ -23,9 +23,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml
index 7ab1c73..1697d00 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml
@@ -24,9 +24,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml
index 2bc8875..5d9148f 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml
@@ -23,9 +23,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-no-reboot.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-no-reboot.xml
index e14536b..0456fa1 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-no-reboot.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-no-reboot.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml
index 397615c..3752878 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml
@@ -23,9 +23,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml b/tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml
index e9c0378..113bd19 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml
@@ -20,14 +20,19 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <interface type='ethernet'>
       <mac address='00:11:22:33:44:55'/>
       <script path='/etc/qemu-ifup'/>
       <target dev='nic02'/>
       <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml b/tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml
index 96ad0a8..54194d7 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml
@@ -20,13 +20,18 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <interface type='ethernet'>
       <mac address='00:11:22:33:44:55'/>
       <script path='/etc/qemu-ifup'/>
       <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-net-user.xml b/tests/qemuargv2xmldata/qemuargv2xml-net-user.xml
index 7dd1cfe..133f5f1 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-net-user.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-net-user.xml
@@ -20,12 +20,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <interface type='user'>
       <mac address='00:11:22:33:44:55'/>
       <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml b/tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml
index db033eb..7d8ff10 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml
@@ -20,12 +20,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <interface type='user'>
       <mac address='00:11:22:33:44:55'/>
       <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga.xml b/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga.xml
index ecefafa..9beaf06 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-nosharepages.xml b/tests/qemuargv2xmldata/qemuargv2xml-nosharepages.xml
index 3b95c6e..b627d70 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-nosharepages.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-nosharepages.xml
@@ -23,9 +23,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml b/tests/qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml
index 0bb1f3a..e4c4437 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <parallel type='tcp'>
       <source mode='bind' host='127.0.0.1' service='9999'/>
       <protocol type='raw'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml
index ab9195a..1bad8ee 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml
@@ -27,7 +27,9 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='0' target='0' unit='2'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='scsi' index='0'>
       <address type='spapr-vio' reg='0x2000'/>
@@ -37,6 +39,7 @@ 
     <graphics type='sdl'/>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
     <panic model='pseries'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml
index eafe49d..7e9f864 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml
@@ -14,7 +14,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-ppc64</emulator>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <memballoon model='none'/>
     <nvram>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-qemu-ns-no-env.xml b/tests/qemuargv2xmldata/qemuargv2xml-qemu-ns-no-env.xml
index 98df80e..5d67117 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-qemu-ns-no-env.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-qemu-ns-no-env.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-disabled.xml b/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-disabled.xml
index 29ddd9f..21654d7 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-disabled.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-disabled.xml
@@ -15,7 +15,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-enabled.xml b/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-enabled.xml
index 1d7f6f1..dd0b7d8 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-enabled.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-enabled.xml
@@ -15,7 +15,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml b/tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml
index ecefafa..9beaf06 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml
index b80218b..eb46e9f 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='dev'>
       <source path='/dev/ttyS2'/>
       <target port='0'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml
index 90182a8..be03983 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='file'>
       <source path='/tmp/serial.log'/>
       <target port='0'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml
index e8a628a..82737e4 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='pty'>
       <target port='0'/>
     </serial>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml
index 3768715..5a17374 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='pty'>
       <target port='0'/>
     </serial>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml
index ca625a0..316b9c4 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='tcp'>
       <source mode='bind' host='127.0.0.1' service='9999'/>
       <protocol type='telnet'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml
index c747dde..492679a 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='tcp'>
       <source mode='connect' host='127.0.0.1' service='9999'/>
       <protocol type='raw'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml
index 1187e2a..31a34ca 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='udp'>
       <source mode='bind' host='127.0.0.1' service='9999'/>
       <source mode='connect' host='127.0.0.1' service='9998'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml
index 8734c75..5a15fc7 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='unix'>
       <source mode='connect' path='/tmp/serial.sock'/>
       <target port='0'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml
index 11575b7..8dca851 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <serial type='vc'>
       <target port='0'/>
     </serial>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-smp.xml b/tests/qemuargv2xmldata/qemuargv2xml-smp.xml
index 1a4ada1..1a52569 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-smp.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-smp.xml
@@ -23,9 +23,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-sound.xml b/tests/qemuargv2xmldata/qemuargv2xml-sound.xml
index 0557f61..6d60d1e 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-sound.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-sound.xml
@@ -20,15 +20,23 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <sound model='pcspk'/>
-    <sound model='es1370'/>
+    <sound model='es1370'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </sound>
     <sound model='sb16'/>
-    <sound model='ac97'/>
+    <sound model='ac97'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </sound>
     <memballoon model='none'/>
   </devices>
 </domain>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml b/tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml
index 757ac86..29e1b0c 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml
@@ -20,9 +20,13 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='ide' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <watchdog model='ib700' action='poweroff'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 840efc9..a83102d 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1563,7 +1563,7 @@  mymain(void)
             QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
     DO_TEST_PARSE_ERROR("440fx-wrong-root", NONE);
 
-    DO_TEST_FAILURE("pcie-root-port-too-many",
+    DO_TEST_PARSE_ERROR("pcie-root-port-too-many",
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_IOH3420,