[v2,5/6] tests: qemuxml2xml: assign device addresses

Message ID c55b155406b8620b9594f5c774325fbd0ccbe15d.1455032128.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson Feb. 9, 2016, 3:59 p.m.
We use the PreFormat callback for this. Many test cases need to be extended
to pass in proper qemuCaps flags so AssignAddresses doesn't throw errors.

One test case (pcie-root-port-too-many) is dropped, since it was meant
only for checking an error condition in qemuxml2argv, and one we add in
AssignAddresses it errors here too.

Long term I think AssignAddresses should be handled in qemu's PostParse
callback, but that's not entirely straightforward. Handling it here
means we can get the test suite churn over with.
---
 .../qemuxml2xmlout-balloon-device-auto.xml         |  12 +-
 .../qemuxml2xmlout-balloon-device-period.xml       |   8 +-
 .../qemuxml2xmlout-bios-nvram-os-interleave.xml    |  12 +-
 .../qemuxml2xmlout-bios-nvram.xml                  |  12 +-
 .../qemuxml2xmlout-blkdeviotune.xml                |  12 +-
 .../qemuxml2xmlout-blkiotune-device.xml            |  12 +-
 .../qemuxml2xmlout-blkiotune.xml                   |  12 +-
 .../qemuxml2xmlout-boot-cdrom.xml                  |   8 +-
 .../qemuxml2xmlout-boot-floppy.xml                 |   8 +-
 ...muxml2xmlout-boot-menu-disable-with-timeout.xml |  12 +-
 .../qemuxml2xmlout-boot-menu-disable.xml           |  12 +-
 ...emuxml2xmlout-boot-menu-enable-with-timeout.xml |  12 +-
 .../qemuxml2xmlout-boot-multi.xml                  |  12 +-
 .../qemuxml2xmlout-boot-network.xml                |   8 +-
 .../qemuxml2xmlout-boot-order.xml                  |  14 +-
 .../qemuxml2xmlout-channel-guestfwd.xml            |  12 +-
 .../qemuxml2xmlout-channel-virtio-auto.xml         |  29 ++-
 .../qemuxml2xmlout-channel-virtio-state-active.xml |  12 +-
 ...emuxml2xmlout-channel-virtio-state-inactive.xml |  12 +-
 .../qemuxml2xmlout-channel-virtio.xml              |  12 +-
 .../qemuxml2xmlout-chardev-label.xml               |  13 +-
 .../qemuxml2xmlout-clock-catchup.xml               |  12 +-
 .../qemuxml2xmlout-clock-localtime.xml             |   8 +-
 .../qemuxml2xmlout-clock-timer-hyperv-rtc.xml      |   8 +-
 .../qemuxml2xmlout-clock-utc.xml                   |   8 +-
 .../qemuxml2xmlout-console-compat-auto.xml         |  12 +-
 .../qemuxml2xmlout-console-compat.xml              |   8 +-
 .../qemuxml2xmlout-console-compat2.xml             |  12 +-
 .../qemuxml2xmlout-console-virtio-many.xml         |  16 +-
 .../qemuxml2xmlout-console-virtio.xml              |  16 +-
 .../qemuxml2xmlout-controller-usb-order.xml        |   4 +-
 .../qemuxml2xmlout-cpu-empty.xml                   |   8 +-
 .../qemuxml2xmlout-cpu-eoi-disabled.xml            |   8 +-
 .../qemuxml2xmlout-cpu-eoi-enabled.xml             |   8 +-
 .../qemuxml2xmlout-cpu-host-kvmclock.xml           |   8 +-
 .../qemuxml2xmlout-cpu-host-model-features.xml     |  12 +-
 ...emuxml2xmlout-cpu-host-passthrough-features.xml |  12 +-
 .../qemuxml2xmlout-cpu-kvmclock.xml                |   8 +-
 .../qemuxml2xmlout-cpu-numa-disjoint.xml           |   8 +-
 .../qemuxml2xmlout-cpu-numa-disordered.xml         |   8 +-
 .../qemuxml2xmlout-cpu-numa-memshared.xml          |   8 +-
 .../qemuxml2xmlout-cpu-numa-no-memory-element.xml  |   8 +-
 .../qemuxml2xmlout-cpu-numa1.xml                   |   8 +-
 .../qemuxml2xmlout-cpu-numa2.xml                   |   8 +-
 .../qemuxml2xmlout-cputune-iothreads.xml           |  12 +-
 ...l2xmlout-cputune-iothreadsched-zeropriority.xml |  12 +-
 .../qemuxml2xmlout-cputune-iothreadsched.xml       |  12 +-
 .../qemuxml2xmlout-cputune-numatune.xml            |   4 +-
 .../qemuxml2xmlout-cputune-zero-shares.xml         |  12 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml  |  12 +-
 .../qemuxml2xmlout-default-kvm-host-arch.xml       |   8 +-
 .../qemuxml2xmlout-default-qemu-host-arch.xml      |   8 +-
 .../qemuxml2xmlout-disk-active-commit.xml          |  12 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml |  12 +-
 .../qemuxml2xmlout-disk-backing-chains-active.xml  |  13 +-
 ...qemuxml2xmlout-disk-backing-chains-inactive.xml |  13 +-
 .../qemuxml2xmlout-disk-cdrom-empty.xml            |   8 +-
 .../qemuxml2xmlout-disk-cdrom.xml                  |   8 +-
 .../qemuxml2xmlout-disk-copy_on_read.xml           |  13 +-
 .../qemuxml2xmlout-disk-drive-boot-cdrom.xml       |   8 +-
 .../qemuxml2xmlout-disk-drive-boot-disk.xml        |   8 +-
 .../qemuxml2xmlout-disk-drive-cache-directsync.xml |   8 +-
 .../qemuxml2xmlout-disk-drive-cache-unsafe.xml     |   8 +-
 .../qemuxml2xmlout-disk-drive-cache-v2-none.xml    |   8 +-
 .../qemuxml2xmlout-disk-drive-cache-v2-wb.xml      |   8 +-
 .../qemuxml2xmlout-disk-drive-cache-v2-wt.xml      |   8 +-
 .../qemuxml2xmlout-disk-drive-copy-on-read.xml     |  12 +-
 .../qemuxml2xmlout-disk-drive-discard.xml          |  12 +-
 ...xml2xmlout-disk-drive-error-policy-enospace.xml |   8 +-
 ...qemuxml2xmlout-disk-drive-error-policy-stop.xml |   8 +-
 ...out-disk-drive-error-policy-wreport-rignore.xml |   8 +-
 .../qemuxml2xmlout-disk-drive-fat.xml              |  12 +-
 .../qemuxml2xmlout-disk-drive-fmt-qcow.xml         |   8 +-
 .../qemuxml2xmlout-disk-drive-network-gluster.xml  |   6 +-
 ...emuxml2xmlout-disk-drive-network-iscsi-auth.xml |   6 +-
 .../qemuxml2xmlout-disk-drive-network-iscsi.xml    |   6 +-
 ...emuxml2xmlout-disk-drive-network-nbd-export.xml |   9 +-
 ...l2xmlout-disk-drive-network-nbd-ipv6-export.xml |   9 +-
 .../qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml |   9 +-
 .../qemuxml2xmlout-disk-drive-network-nbd-unix.xml |   9 +-
 .../qemuxml2xmlout-disk-drive-network-nbd.xml      |   9 +-
 .../qemuxml2xmlout-disk-drive-network-rbd-auth.xml |   9 +-
 ...uxml2xmlout-disk-drive-network-rbd-ceph-env.xml |   9 +-
 .../qemuxml2xmlout-disk-drive-network-rbd-ipv6.xml |   9 +-
 .../qemuxml2xmlout-disk-drive-network-rbd.xml      |  12 +-
 .../qemuxml2xmlout-disk-drive-network-sheepdog.xml |   9 +-
 .../qemuxml2xmlout-disk-floppy.xml                 |   8 +-
 .../qemuxml2xmlout-disk-many.xml                   |   8 +-
 .../qemuxml2xmlout-disk-mirror-active.xml          |  14 +-
 .../qemuxml2xmlout-disk-mirror-inactive.xml        |  14 +-
 .../qemuxml2xmlout-disk-mirror-old-inactive.xml    |  14 +-
 .../qemuxml2xmlout-disk-mirror-old.xml             |  14 +-
 .../qemuxml2xmlout-disk-scsi-device-auto.xml       |  16 +-
 .../qemuxml2xmlout-disk-scsi-device.xml            |  16 +-
 .../qemuxml2xmlout-disk-scsi-disk-vpd.xml          |  16 +-
 ...muxml2xmlout-disk-scsi-lun-passthrough-sgio.xml |  16 +-
 .../qemuxml2xmlout-disk-scsi-megasas.xml           |  16 +-
 .../qemuxml2xmlout-disk-scsi-virtio-scsi.xml       |  16 +-
 .../qemuxml2xmlout-disk-scsi-vscsi.xml             |  16 +-
 .../qemuxml2xmlout-disk-source-pool-mode.xml       |  12 +-
 .../qemuxml2xmlout-disk-source-pool.xml            |  12 +-
 .../qemuxml2xmlout-disk-usb-device.xml             |  12 +-
 ...qemuxml2xmlout-disk-virtio-scsi-cmd_per_lun.xml |   9 +-
 .../qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml  |   9 +-
 ...qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml |   9 +-
 .../qemuxml2xmlout-disk-virtio-scsi-num_queues.xml |   9 +-
 .../qemuxml2xmlout-disk-virtio.xml                 |  10 +-
 .../qemuxml2xmlout-disk-xenvbd.xml                 |   8 +-
 .../qemuxml2xmlout-encrypted-disk.xml              |   8 +-
 .../qemuxml2xmlout-eoi-disabled.xml                |   8 +-
 .../qemuxml2xmlout-eoi-enabled.xml                 |   8 +-
 .../qemuxml2xmlout-event_idx.xml                   |  13 +-
 .../qemuxml2xmlout-floppy-drive-fat.xml            |  12 +-
 .../qemuxml2xmlout-graphics-listen-network.xml     |  13 +-
 .../qemuxml2xmlout-graphics-listen-network2.xml    |  13 +-
 .../qemuxml2xmlout-graphics-sdl-fullscreen.xml     |   9 +-
 .../qemuxml2xmlout-graphics-sdl.xml                |   9 +-
 .../qemuxml2xmlout-graphics-spice-compression.xml  |  14 +-
 .../qemuxml2xmlout-graphics-spice-qxl-vga.xml      |  14 +-
 .../qemuxml2xmlout-graphics-spice-timeout.xml      |   4 +-
 .../qemuxml2xmlout-graphics-spice.xml              |  14 +-
 .../qemuxml2xmlout-graphics-vnc-sasl.xml           |   9 +-
 .../qemuxml2xmlout-graphics-vnc-tls.xml            |   9 +-
 .../qemuxml2xmlout-graphics-vnc-websocket.xml      |   5 +-
 .../qemuxml2xmlout-graphics-vnc.xml                |   9 +-
 .../qemuxml2xmlout-hostdev-pci-address.xml         |   9 +-
 ...qemuxml2xmlout-hostdev-scsi-autogen-address.xml |  20 +-
 .../qemuxml2xmlout-hostdev-scsi-large-unit.xml     |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml      |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-lsi.xml            |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-rawio.xml          |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-readonly.xml       |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-sgio.xml           |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-shareable.xml      |  16 +-
 ...muxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml   |  16 +-
 .../qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml    |  16 +-
 .../qemuxml2xmlout-hostdev-usb-address.xml         |   8 +-
 .../qemuxml2xmlout-hostdev-vfio.xml                |  13 +-
 .../qemuxml2xmlout-hugepages-pages.xml             |  12 +-
 .../qemuxml2xmlout-hugepages-pages2.xml            |  12 +-
 .../qemuxml2xmlout-hugepages-pages3.xml            |  12 +-
 .../qemuxml2xmlout-hugepages-shared.xml            |  12 +-
 .../qemuxml2xmlout-hugepages.xml                   |  12 +-
 .../qemuxml2xmlout-hyperv-off.xml                  |   8 +-
 .../qemuxml2xmlout-hyperv-panic.xml                |   4 +-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml |   4 +-
 .../qemuxml2xmlout-input-usbmouse.xml              |   8 +-
 .../qemuxml2xmlout-input-usbtablet.xml             |   8 +-
 .../qemuxml2xmlout-interface-driver.xml            |  13 +-
 .../qemuxml2xmlout-iothreads-disk-virtio-ccw.xml   |   1 +
 .../qemuxml2xmlout-iothreads-disk.xml              |   9 +-
 .../qemuxml2xmlout-iothreads-ids-partial.xml       |   8 +-
 .../qemuxml2xmlout-iothreads-ids.xml               |   8 +-
 .../qemuxml2xmlout-iothreads.xml                   |   8 +-
 .../qemuxml2xmlout-kvm-features-off.xml            |   8 +-
 .../qemuxml2xmlout-kvm-features.xml                |   4 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml |   4 +-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml  |  12 +-
 .../qemuxml2xmlout-machine-core-off.xml            |   8 +-
 .../qemuxml2xmlout-machine-core-on.xml             |   8 +-
 .../qemuxml2xmlout-memory-hotplug-dimm.xml         |  12 +-
 .../qemuxml2xmlout-memory-hotplug-nonuma.xml       |   8 +-
 .../qemuxml2xmlout-memory-hotplug.xml              |  12 +-
 .../qemuxml2xmlout-memtune-unlimited.xml           |  12 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml  |  12 +-
 .../qemuxml2xmlout-metadata-duplicate.xml          |  12 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml |  12 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-migrate.xml  |   8 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml  |  12 +-
 .../qemuxml2xmlout-misc-acpi.xml                   |   8 +-
 .../qemuxml2xmlout-misc-disable-s3.xml             |   8 +-
 .../qemuxml2xmlout-misc-disable-suspends.xml       |   8 +-
 .../qemuxml2xmlout-misc-enable-s4.xml              |   8 +-
 .../qemuxml2xmlout-misc-no-reboot.xml              |   8 +-
 .../qemuxml2xmlout-misc-uuid.xml                   |   8 +-
 .../qemuxml2xmlout-net-bandwidth.xml               |   4 +-
 .../qemuxml2xmlout-net-bandwidth2.xml              |   4 +-
 .../qemuxml2xmlout-net-eth-ifname.xml              |   9 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml  |   9 +-
 .../qemuxml2xmlout-net-hostdev-vfio.xml            |  13 +-
 .../qemuxml2xmlout-net-hostdev.xml                 |  13 +-
 .../qemuxml2xmlout-net-midonet.xml                 |  13 +-
 .../qemuxml2xmlout-net-openvswitch.xml             |  13 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml  |  13 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml |   9 +-
 .../qemuxml2xmlout-net-vhostuser.xml               |  11 +-
 .../qemuxml2xmlout-net-virtio-device.xml           |  13 +-
 .../qemuxml2xmlout-net-virtio-disable-offloads.xml |  13 +-
 ...qemuxml2xmlout-net-virtio-network-portgroup.xml |  15 +-
 .../qemuxml2xmlout-net-virtio.xml                  |   9 +-
 .../qemuxml2xmlout-nographics-vga.xml              |   8 +-
 .../qemuxml2xmlout-nosharepages.xml                |   8 +-
 ...emuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml |  12 +-
 ...ad-auto-memory-vcpu-no-cpuset-and-placement.xml |  12 +-
 .../qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml |  12 +-
 ...emuxml2xmlout-numad-static-vcpu-no-numatune.xml |  12 +-
 .../qemuxml2xmlout-numatune-auto-prefer.xml        |   8 +-
 .../qemuxml2xmlout-numatune-memnode-no-memory.xml  |   8 +-
 .../qemuxml2xmlout-numatune-memnode.xml            |   8 +-
 .../qemuxml2xmlout-panic-double.xml                |   4 +-
 .../qemuxml2xmlout-panic-isa.xml                   |  12 +-
 .../qemuxml2xmlout-panic-no-address.xml            |  12 +-
 .../qemuxml2xmlout-panic-pseries.xml               |   8 +-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml  |  12 +-
 .../qemuxml2xmlout-parallel-tcp.xml                |   8 +-
 .../qemuxml2xmlout-pci-autoadd-addr.xml            |  35 ++++
 .../qemuxml2xmlout-pci-autoadd-idx.xml             |  41 +++-
 .../qemuxml2xmlout-pci-bridge-many-disks.xml       | 124 +++++++++++-
 .../qemuxml2xmlout-pci-bridge.xml                  |  44 ++++-
 .../qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml  |  16 +-
 .../qemuxml2xmlout-pci-serial-dev-chardev.xml      |  12 +-
 .../qemuxml2xmlout-pcie-root-port-too-many.xml     |  62 ------
 .../qemuxml2xmlout-pcie-root-port.xml              |  23 ++-
 .../qemuxml2xmlout-pcie-root.xml                   |  15 +-
 .../qemuxml2xmlout-pcie-switch-downstream-port.xml |  69 +++++--
 .../qemuxml2xmlout-pcie-switch-upstream-port.xml   |  34 +++-
 .../qemuxml2xmlout-pcihole64-gib.xml               |   8 +-
 .../qemuxml2xmlout-pcihole64-none.xml              |   8 +-
 .../qemuxml2xmlout-pcihole64-q35.xml               |  16 +-
 .../qemuxml2xmlout-pcihole64.xml                   |   8 +-
 .../qemuxml2xmlout-pmu-feature-off.xml             |   4 +-
 .../qemuxml2xmlout-pmu-feature.xml                 |   4 +-
 .../qemuxml2xmlout-pseries-nvram.xml               |   4 +-
 .../qemuxml2xmlout-pseries-panic-missing.xml       |   8 +-
 .../qemuxml2xmlout-pseries-panic-no-address.xml    |   8 +-
 .../qemuxml2xmlout-pv-spinlock-disabled.xml        |   8 +-
 .../qemuxml2xmlout-pv-spinlock-enabled.xml         |   8 +-
 .../qemuxml2xmlout-q35-usb2-multi.xml              |  28 ++-
 .../qemuxml2xmlout-q35-usb2-reorder.xml            |  28 ++-
 .../qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml |  14 +-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml    |  22 ++-
 .../qemuxml2xmlout-qemu-ns-no-env.xml              |   8 +-
 .../qemuxml2xmlout-reboot-timeout-disabled.xml     |   4 +-
 .../qemuxml2xmlout-reboot-timeout-enabled.xml      |   4 +-
 .../qemuxml2xmlout-restore-v2.xml                  |   8 +-
 .../qemuxml2xmlout-s390-defaultconsole.xml         |   3 +-
 .../qemuxml2xmlout-seclabel-dac-none.xml           |  12 +-
 .../qemuxml2xmlout-seclabel-device-multiple.xml    |  12 +-
 .../qemuxml2xmlout-seclabel-dynamic-baselabel.xml  |  12 +-
 .../qemuxml2xmlout-seclabel-dynamic-labelskip.xml  |  12 +-
 .../qemuxml2xmlout-seclabel-dynamic-none.xml       |  12 +-
 .../qemuxml2xmlout-seclabel-dynamic-override.xml   |  12 +-
 .../qemuxml2xmlout-seclabel-dynamic-relabel.xml    |  12 +-
 .../qemuxml2xmlout-seclabel-none.xml               |  12 +-
 .../qemuxml2xmlout-seclabel-static-labelskip.xml   |  12 +-
 .../qemuxml2xmlout-seclabel-static.xml             |  12 +-
 .../qemuxml2xmlout-serial-dev.xml                  |   8 +-
 .../qemuxml2xmlout-serial-file.xml                 |   8 +-
 .../qemuxml2xmlout-serial-many.xml                 |   8 +-
 .../qemuxml2xmlout-serial-pty.xml                  |   8 +-
 .../qemuxml2xmlout-serial-spiceport-nospice.xml    |  12 +-
 .../qemuxml2xmlout-serial-spiceport.xml            |  13 +-
 .../qemuxml2xmlout-serial-target-port-auto.xml     |  12 +-
 .../qemuxml2xmlout-serial-tcp-telnet.xml           |   8 +-
 .../qemuxml2xmlout-serial-tcp.xml                  |   8 +-
 .../qemuxml2xmlout-serial-udp.xml                  |   8 +-
 .../qemuxml2xmlout-serial-unix.xml                 |   8 +-
 .../qemuxml2xmlout-serial-vc.xml                   |   8 +-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml  |  14 +-
 .../qemuxml2xmlout-smbios-multiple-type2.xml       |  12 +-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml |  12 +-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml    |   8 +-
 .../qemuxml2xmlout-sound-device.xml                |  30 ++-
 tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml  |  16 +-
 .../qemuxml2xmlout-tap-vhost-incorrect.xml         |  14 +-
 .../qemuxml2xmlout-tap-vhost.xml                   |  13 +-
 .../qemuxml2xmlout-tpm-passthrough.xml             |   8 +-
 .../qemuxml2xmlout-usb-ich9-ehci-addr.xml          |  25 ++-
 .../qemuxml2xmlout-usb-redir-filter-version.xml    |   8 +-
 .../qemuxml2xmlout-usb-redir-filter.xml            |   4 +-
 .../qemuxml2xmlout-usb-redir.xml                   |   4 +-
 .../qemuxml2xmlout-vcpu-placement-static.xml       |   3 +
 .../qemuxml2xmlout-vhost_queues.xml                |  13 +-
 .../qemuxml2xmlout-video-virtio-gpu-device.xml     |  13 +-
 .../qemuxml2xmlout-video-virtio-gpu-virgl.xml      |  13 +-
 .../qemuxml2xmlout-virtio-input-passthrough.xml    |   9 +-
 .../qemuxml2xmlout-virtio-input.xml                |  16 +-
 .../qemuxml2xmlout-virtio-lun.xml                  |  13 +-
 .../qemuxml2xmlout-virtio-rng-egd.xml              |   9 +-
 .../qemuxml2xmlout-virtio-rng-random.xml           |   9 +-
 .../qemuxml2xmloutdata/qemuxml2xmlout-watchdog.xml |   8 +-
 tests/qemuxml2xmltest.c                            | 220 ++++++++++++++++-----
 284 files changed, 2745 insertions(+), 829 deletions(-)
 delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-too-many.xml

-- 
2.5.0

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

Comments

Cole Robinson Feb. 9, 2016, 9:15 p.m. | #1
On 02/09/2016 03:11 PM, Laine Stump wrote:
> On 02/09/2016 10:59 AM, Cole Robinson wrote:

>> We use the PreFormat callback for this. Many test cases need to be extended

>> to pass in proper qemuCaps flags so AssignAddresses doesn't throw errors.

>>

>> One test case (pcie-root-port-too-many) is dropped, since it was meant

>> only for checking an error condition in qemuxml2argv, and one we add in

>> AssignAddresses it errors here too.

>>

>> Long term I think AssignAddresses should be handled in qemu's PostParse

>> callback, but that's not entirely straightforward. Handling it here

>> means we can get the test suite churn over with.

>> ---

> 

> I'm too lazy to do it myself, but it would be comforting to move the

> xml2xmlout data files into the xml2argvdata directory and run qemuxml2argvtest

> with the existing .args files to verify that all of these PCI addresses you've

> just generated are exactly the same as the ones that have been auto-generated

> over the last several years and put into the .args files...

> 


I gave it a spin:

cd tests/qemuxml2xmloutdata; for i in *.xml; do new=`echo $i | sed
"s/qemuxml2xmlout-/qemuxml2argv-/g"`; cp $i ../qemuxml2argvdata/$new; done

qemuxml2argvtest passes with no problems.

But qemuxml2xmltest actually fails now! Nothing major though, just the
controllers being reordered a bit in a few test cases. The qemu PostParse bits
should probably be adding controllers in the same order as domain_conf parses
them in, so the bits match. A patch for another day though

> (Hmm - if the xml files in all the test data directories had their

> "qemuxml2XXX-" prefixes removed as we had earlier discussed, such an operation

> would be trivial :-)

> 


Yup, it's still on my list.

>> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c

>> index e3b61c0..a06aa4d 100644

>> --- a/tests/qemuxml2xmltest.c

>> +++ b/tests/qemuxml2xmltest.c

>> @@ -37,13 +37,24 @@ struct testInfo {

>>   };

>>     static int

>> +qemuXML2XMLPreFormatCallback(virDomainDefPtr def, const void *opaque)

>> +{

>> +    const struct testInfo *info = opaque;

>> +

>> +    if (qemuDomainAssignAddresses(def, info->qemuCaps, NULL))

>> +        return -1;

>> +

>> +    return 0;

>> +}

>> +

>> +static int

>>   testXML2XMLActive(const void *opaque)

>>   {

>>       const struct testInfo *info = opaque;

>>         return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,

>>                                         info->inName, info->outActiveName,

>> true,

>> -                                      NULL, NULL);

>> +                                      qemuXML2XMLPreFormatCallback, opaque);

>>   }

>>     @@ -54,7 +65,7 @@ testXML2XMLInactive(const void *opaque)

>>         return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,

>> info->inName,

>>                                         info->outInactiveName, false,

>> -                                      NULL, NULL);

>> +                                      qemuXML2XMLPreFormatCallback, opaque);

>>   }

>>     @@ -138,6 +149,9 @@ testCompareStatusXMLToXMLFiles(const void *opaque)

>>           goto cleanup;

>>       }

>>   +    if (qemuDomainAssignAddresses(obj->def, data->qemuCaps, NULL))

>> +        goto cleanup;

>> +

> 

> Why is this needed? I though that's what the pre-format callback was for.

> 


This function, for testing domain status XML, doesn't use the standard
testutils infrastructure because it has some funky XML handling, so this call
needs to be opencoded.

> 

>>       /* format it back */

>>       if (!(actual = virDomainObjFormat(driver.xmlopt, obj, NULL,

>>                                         VIR_DOMAIN_DEF_FORMAT_SECURE))) {

>> @@ -379,14 +393,28 @@ mymain(void)

>>       DO_TEST("disk-drive-network-rbd-ipv6");

>>       DO_TEST("disk-drive-network-rbd-ceph-env");

>>       DO_TEST("disk-drive-network-sheepdog");

>> -    DO_TEST("disk-scsi-device");

>> +    DO_TEST_FULL("disk-scsi-device", WHEN_ACTIVE,

>> +            QEMU_CAPS_NODEFCONFIG,

>> +            QEMU_CAPS_SCSI_LSI);

> 

> 

> The indentation of all of the followon lines to DO_TEST_FULL()'s are off. It's

> consistent, but since it doesn't match what all of our editors likely do

> automatically, so it will start to look ugly as new cases are added. (I didn't

> look - is the indentation also incorrect in qemuxml2argvtest.c (which is where

> I assume you got the caps lists for each test)?)

> 


I didn't reflow anything in qemuxml2argtest I don't think. The nature of the
additions/removals means the indentation didn't change.

> ACK with the question about the extra call to qemuDomainAssignAddresses()

> answered and the indentation fixed so that it matches what an editor's

> auto-indent would do (putting the following lines one space past the column of

> the opening "(" )

> 


Honestly I'm not a big fan of column aligning, if there's any future
find+replace function rename the indentation is off... there's many examples
of this in libvirt code. But I fixed these cases manually and pushed now.

Thanks for the reviews!

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Cole Robinson Feb. 9, 2016, 9:19 p.m. | #2
On 02/09/2016 04:17 PM, Laine Stump wrote:
> On 02/09/2016 10:59 AM, Cole Robinson wrote:

>> We use the PreFormat callback for this. Many test cases need to be extended

>> to pass in proper qemuCaps flags so AssignAddresses doesn't throw errors.

>>

>> One test case (pcie-root-port-too-many) is dropped, since it was meant

>> only for checking an error condition in qemuxml2argv, and one we add in

>> AssignAddresses it errors here too.

> 

> I forgot to comment about this by the time I got to the end of reviewing -

> does this mean the error is no longer checked? My recollection is that test

> was meant to check the path where someone defines more pcie-root-port

> controllers than will fit on pcie-root (which is the only place you can attach

> a pcie-root-port). It obviously works now, but if the code was broken and

> someone tried to add in too many pcie-root-ports (because they wanted all

> their devices off of pcie-root rather than adding some other kind of

> bridge/switch) they would get a rude surprise (I know that's all highly

> unlikely to happen, but...

> 


The error is still checked:

$ git grep pcie-root-port-too-many
tests/qemuxml2argvtest.c:    DO_TEST_ERROR("pcie-root-port-too-many",

There's just no point to check it in qemuxml2xml as well, since it's
effectively a duplicate test.

Thanks,
Cole

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

Patch

diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
index d9efca2..5cf3807 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
@@ -19,11 +19,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>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-period.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-period.xml
index 8a96462..9220369 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-period.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-period.xml
@@ -19,9 +19,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='virtio'>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml
index 0eee88c..e5bfe7c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml
@@ -25,8 +25,12 @@ 
       <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'/>
     <serial type='pty'>
       <target port='0'/>
@@ -37,6 +41,8 @@ 
     <input type='tablet' bus='usb'/>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram.xml
index 0eee88c..e5bfe7c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram.xml
@@ -25,8 +25,12 @@ 
       <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'/>
     <serial type='pty'>
       <target port='0'/>
@@ -37,6 +41,8 @@ 
     <input type='tablet' bus='usb'/>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkdeviotune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkdeviotune.xml
index 1e1c0e5..0094b27 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkdeviotune.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkdeviotune.xml
@@ -35,11 +35,17 @@ 
       </iotune>
       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
     </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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune-device.xml
index 3b8080d..9b203e0 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune-device.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune-device.xml
@@ -38,11 +38,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune.xml
index f7efcb9..90170f4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune.xml
@@ -22,11 +22,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-cdrom.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-cdrom.xml
index 9c0e667..4642eb4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-cdrom.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-cdrom.xml
@@ -21,8 +21,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-floppy.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-floppy.xml
index 390bc67..574e4bc 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-floppy.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-floppy.xml
@@ -26,9 +26,13 @@ 
       <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='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>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml
index 8727c18..bfe3e97 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable-with-timeout.xml
@@ -21,11 +21,17 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable.xml
index 8727c18..bfe3e97 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable.xml
@@ -21,11 +21,17 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-enable-with-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-enable-with-timeout.xml
index 82e366c..8c96bbd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-enable-with-timeout.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-enable-with-timeout.xml
@@ -21,11 +21,17 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-multi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-multi.xml
index 5e029bd..37dcabf 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-multi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-multi.xml
@@ -24,11 +24,17 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-network.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-network.xml
index ad421da..1e3b3c9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-network.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-network.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-order.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-order.xml
index 4a6fbd4..823ddcf 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-order.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-order.xml
@@ -32,6 +32,7 @@ 
       </source>
       <target dev='vda' bus='virtio'/>
       <boot order='3'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </disk>
     <disk type='file' device='floppy'>
       <driver name='qemu' type='raw'/>
@@ -40,17 +41,24 @@ 
       <boot order='4'/>
       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
     </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='fdc' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
     <interface type='user'>
       <mac address='00:11:22:33:44:55'/>
       <model type='virtio'/>
       <boot order='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-guestfwd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-guestfwd.xml
index b5e5c23..099dfe9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-guestfwd.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-guestfwd.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <channel type='pipe'>
       <source path='/tmp/guestfwd'/>
@@ -28,6 +32,8 @@ 
     </channel>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
index f2247c3..f208f06 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
@@ -19,20 +19,29 @@ 
       <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='virtio-serial' index='0' ports='16' vectors='4'/>
+    <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='virtio-serial' index='0' ports='16' vectors='4'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
     <controller type='virtio-serial' index='1'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='virtio-serial' index='2'/>
+    <controller type='virtio-serial' index='2'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
     <channel type='pty'>
       <target type='virtio' name='org.linux-kvm.port.0'/>
+      <address type='virtio-serial' controller='0' bus='0' port='1'/>
     </channel>
     <channel type='pty'>
       <target type='virtio' name='org.linux-kvm.port.foo'/>
-      <address type='virtio-serial' controller='1' bus='0' port='0'/>
+      <address type='virtio-serial' controller='1' bus='0' port='1'/>
     </channel>
     <channel type='pty'>
       <target type='virtio' name='org.linux-kvm.port.bar'/>
@@ -40,18 +49,20 @@ 
     </channel>
     <channel type='pty'>
       <target type='virtio' name='org.linux-kvm.port.wizz'/>
-      <address type='virtio-serial' controller='0' bus='0' port='0'/>
+      <address type='virtio-serial' controller='0' bus='0' port='2'/>
     </channel>
     <channel type='pty'>
       <target type='virtio' name='org.linux-kvm.port.ooh'/>
-      <address type='virtio-serial' controller='1' bus='0' port='0'/>
+      <address type='virtio-serial' controller='1' bus='0' port='2'/>
     </channel>
     <channel type='pty'>
       <target type='virtio' name='org.linux-kvm.port.lla'/>
-      <address type='virtio-serial' controller='2' bus='0' port='0'/>
+      <address type='virtio-serial' controller='2' bus='0' port='1'/>
     </channel>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-state-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-state-active.xml
index a8487cd..d1d59e4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-state-active.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-state-active.xml
@@ -20,8 +20,12 @@ 
       <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='virtio-serial' index='1'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </controller>
@@ -40,6 +44,8 @@ 
     </channel>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-state-inactive.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-state-inactive.xml
index 037b6e5..9e0b4bc 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-state-inactive.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-state-inactive.xml
@@ -19,8 +19,12 @@ 
       <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='virtio-serial' index='1'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </controller>
@@ -39,6 +43,8 @@ 
     </channel>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio.xml
index 4ca270d..1a9768d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio.xml
@@ -19,8 +19,12 @@ 
       <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='virtio-serial' index='1'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </controller>
@@ -31,6 +35,8 @@ 
     </channel>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml
index 09094af..ee5d68f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml
@@ -14,8 +14,12 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <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'/>
     <serial type='file'>
       <source path='/tmp/serial.file'>
@@ -37,11 +41,14 @@ 
     </console>
     <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>
     <rng model='virtio'>
       <backend model='egd' type='pipe'>
         <source path='/dev/null'/>
       </backend>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </rng>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-catchup.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-catchup.xml
index 1fe968b..28314bf 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-catchup.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-catchup.xml
@@ -29,11 +29,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-localtime.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-localtime.xml
index 642d276..64a6d65 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-localtime.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-localtime.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-timer-hyperv-rtc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-timer-hyperv-rtc.xml
index c54af6a..b510b3f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-timer-hyperv-rtc.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-timer-hyperv-rtc.xml
@@ -19,10 +19,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-utc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-utc.xml
index 9da4df0..3e2af3b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-utc.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-utc.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
index b3ba4fc..8ebced6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <serial type='pty'>
       <target port='0'/>
@@ -30,6 +34,8 @@ 
     </console>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml
index 3eaeffa..92cb131 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='pty'>
       <target port='0'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml
index d79ac9d..dcb86da 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml
@@ -20,10 +20,16 @@ 
       <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'/>
-    <controller type='virtio-serial' index='0'/>
+    <controller type='virtio-serial' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
     <serial type='pty'>
       <target port='0'/>
     </serial>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml
index 31d2793..3986664 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml
@@ -19,9 +19,15 @@ 
       <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='virtio-serial' 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='virtio-serial' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <serial type='pty'>
       <target port='0'/>
@@ -40,6 +46,8 @@ 
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
index f20abf9..1f78bff 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
@@ -19,15 +19,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='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'/>
-    <controller type='virtio-serial' index='0'/>
+    <controller type='virtio-serial' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
     <console type='pty'>
       <target type='virtio' port='0'/>
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-controller-usb-order.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-controller-usb-order.xml
index e88b5cf..31b79ea 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-controller-usb-order.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-controller-usb-order.xml
@@ -31,6 +31,8 @@ 
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-empty.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-empty.xml
index d1829d8..6c608f7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-empty.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-empty.xml
@@ -14,10 +14,14 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-disabled.xml
index 59d50d3..7a51e3d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-disabled.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-disabled.xml
@@ -22,10 +22,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-enabled.xml
index c2c494b..ae8ab6a 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-enabled.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-enabled.xml
@@ -22,10 +22,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-kvmclock.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-kvmclock.xml
index 98689f3..c2bdad9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-kvmclock.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-kvmclock.xml
@@ -17,10 +17,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-model-features.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-model-features.xml
index 530cc9a..161fcfe 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-model-features.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-model-features.xml
@@ -25,11 +25,17 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-passthrough-features.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-passthrough-features.xml
index fceb6a6..935f8cd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-passthrough-features.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-passthrough-features.xml
@@ -29,11 +29,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-kvmclock.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-kvmclock.xml
index 003a1ed..4d222de 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-kvmclock.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-kvmclock.xml
@@ -19,10 +19,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disjoint.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disjoint.xml
index 08662d0..6474002 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disjoint.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disjoint.xml
@@ -21,10 +21,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disordered.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disordered.xml
index 8e35c3d..6df4c90 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disordered.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disordered.xml
@@ -22,10 +22,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-memshared.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-memshared.xml
index 244a615..0795595 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-memshared.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-memshared.xml
@@ -21,10 +21,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-no-memory-element.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-no-memory-element.xml
index 1c61772..64bab0f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-no-memory-element.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-no-memory-element.xml
@@ -21,10 +21,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml
index 1c61772..64bab0f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml
@@ -21,10 +21,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml
index 1c61772..64bab0f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml
@@ -21,10 +21,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreads.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreads.xml
index 4702dc8..6c95e05 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreads.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreads.xml
@@ -30,11 +30,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
index 47580c9..5616c5c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
@@ -30,11 +30,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched.xml
index 4d665e9..a0457bc 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched.xml
@@ -30,11 +30,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
index 1278b00..ff987e7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
@@ -22,7 +22,9 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-x86_64</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/qemuxml2xmloutdata/qemuxml2xmlout-cputune-zero-shares.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-zero-shares.xml
index 1e7f3bc..c52db0d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-zero-shares.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-zero-shares.xml
@@ -27,11 +27,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml
index 951fef9..de9c331 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml
@@ -27,11 +27,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
index 9fd32ac..6718df3 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
@@ -14,10 +14,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml
index a506b50..cd223f1 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml
@@ -14,10 +14,14 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-x86_64</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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
index 7889248..9822995 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
@@ -29,11 +29,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml
index bbf5d55..7c35c7a 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml
@@ -27,11 +27,17 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
index c4cbf6b..1337dfa 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
@@ -25,6 +25,7 @@ 
         <backingStore/>
       </backingStore>
       <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='qcow2'/>
@@ -57,6 +58,7 @@ 
         </backingStore>
       </backingStore>
       <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'/>
@@ -65,6 +67,7 @@ 
       </source>
       <backingStore/>
       <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='qcow2'/>
@@ -82,17 +85,23 @@ 
         <backingStore/>
       </backingStore>
       <target dev='vdd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </disk>
     <disk type='block' device='disk'>
       <driver name='qemu' type='qcow2'/>
       <source dev='/dev/HostVG/QEMUGuest11'/>
       <backingStore/>
       <target dev='vde' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' 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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-inactive.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-inactive.xml
index 9101111..2c8a233 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-inactive.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-inactive.xml
@@ -20,6 +20,7 @@ 
         <host transport='unix' socket='/path/to/sock'/>
       </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='qcow2'/>
@@ -27,6 +28,7 @@ 
         <host transport='unix' socket='/var/run/nbdsock'/>
       </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'/>
@@ -34,6 +36,7 @@ 
         <host name='example.org' port='6000'/>
       </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='qcow2'/>
@@ -46,16 +49,22 @@ 
         <host name='mon3.example.org' port='6322'/>
       </source>
       <target dev='vdd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </disk>
     <disk type='block' device='disk'>
       <driver name='qemu' type='qcow2'/>
       <source dev='/dev/HostVG/QEMUGuest11'/>
       <target dev='vde' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' 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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml
index 705c493..4398680 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml
@@ -26,8 +26,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom.xml
index 04f4976..0f0dd7f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-copy_on_read.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-copy_on_read.xml
index 9c40895..7837510 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-copy_on_read.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-copy_on_read.xml
@@ -29,16 +29,21 @@ 
       <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='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
-    <controller type='ide' index='0'/>
+    <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'/>
     <interface type='user'>
       <mac address='52:54:00:e5:48:58'/>
       <model type='virtio'/>
       <driver name='vhost' txmode='iothread'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <serial type='pty'>
       <target port='0'/>
@@ -48,6 +53,8 @@ 
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-boot-cdrom.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-boot-cdrom.xml
index 80a6978..0d0266b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-boot-cdrom.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-boot-cdrom.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-boot-disk.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-boot-disk.xml
index 809eb80..1bd0576 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-boot-disk.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-boot-disk.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-directsync.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-directsync.xml
index 497014f..e4d4a27 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-directsync.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-directsync.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-unsafe.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-unsafe.xml
index e247651..8262282 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-unsafe.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-unsafe.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-none.xml
index 2ee3118..8614f09 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-none.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-none.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-wb.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-wb.xml
index 95800b6..0b08af4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-wb.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-wb.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-wt.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-wt.xml
index d0364ba..b58e964 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-wt.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-cache-v2-wt.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-copy-on-read.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-copy-on-read.xml
index 4e33edf..c47d3d0 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-copy-on-read.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-copy-on-read.xml
@@ -20,11 +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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-discard.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-discard.xml
index df93310..deda117 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-discard.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-discard.xml
@@ -29,11 +29,17 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-enospace.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-enospace.xml
index 1b9557c..501b586 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-enospace.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-enospace.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-stop.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-stop.xml
index 824740d..ef344c9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-stop.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-stop.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-wreport-rignore.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-wreport-rignore.xml
index ba3ee29..e9c8dfa 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-wreport-rignore.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-error-policy-wreport-rignore.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fat.xml
index b0d8bdc..a6975d0 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fat.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fat.xml
@@ -21,11 +21,17 @@ 
       <readonly/>
       <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fmt-qcow.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fmt-qcow.xml
index d3fdab4..b005aa7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fmt-qcow.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fmt-qcow.xml
@@ -27,8 +27,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-gluster.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-gluster.xml
index 0c66e7f..160fd9d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-gluster.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi-auth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi-auth.xml
index 5ac4abf..4f0e87f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi-auth.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi.xml
index 31fc9f2..05c7315 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-export.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-export.xml
index 36d8d73..a773db9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-export.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-export.xml
@@ -26,9 +26,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6-export.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6-export.xml
index 04b7522..fe1d216 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6-export.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6-export.xml
@@ -26,9 +26,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml
index 48e9e9c..8e3cb9f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml
@@ -26,9 +26,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-unix.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-unix.xml
index 7da39e6..c03f217 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-unix.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-unix.xml
@@ -26,9 +26,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd.xml
index d7fd1fc..64d9f5d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd.xml
@@ -26,9 +26,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-auth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-auth.xml
index ac2e942..7d58eac 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-auth.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-auth.xml
@@ -31,9 +31,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-ceph-env.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-ceph-env.xml
index 2924969..1637d44 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-ceph-env.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-ceph-env.xml
@@ -28,9 +28,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-ipv6.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-ipv6.xml
index ac023ab..1a5f57a 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-ipv6.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd-ipv6.xml
@@ -29,9 +29,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd.xml
index b3783db..3a19bde 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-rbd.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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,9 +56,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-sheepdog.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-sheepdog.xml
index 001b0cd..ca271d7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-sheepdog.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-sheepdog.xml
@@ -26,9 +26,14 @@ 
         <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-floppy.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-floppy.xml
index 8add406..fbba06c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-floppy.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-floppy.xml
@@ -32,9 +32,13 @@ 
       <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='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>
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-many.xml
index f60aba3..5a378ad 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-many.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-many.xml
@@ -38,8 +38,12 @@ 
       <target dev='hdd' bus='ide'/>
       <address type='drive' controller='0' bus='1' target='0' unit='1'/>
     </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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
index d0b61cb..3518df8 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
@@ -38,6 +38,7 @@ 
         <source file='/tmp/copy.img'/>
       </mirror>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <source file='/tmp/logs.img'/>
@@ -47,12 +48,19 @@ 
         <source file='/tmp/logcopy.img'/>
       </mirror>
       <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </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='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-inactive.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-inactive.xml
index 731a4b4..869a134 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-inactive.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-inactive.xml
@@ -28,16 +28,24 @@ 
     <disk type='file' device='disk'>
       <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'>
       <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='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='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old-inactive.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old-inactive.xml
index 731a4b4..869a134 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old-inactive.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old-inactive.xml
@@ -28,16 +28,24 @@ 
     <disk type='file' device='disk'>
       <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'>
       <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='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='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
index 14732a5..fbed498 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
@@ -38,17 +38,25 @@ 
         <source file='/tmp/copy.img'/>
       </mirror>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <source file='/tmp/logs.img'/>
       <backingStore/>
       <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </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='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
index b803f1e..216f25b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
@@ -24,12 +24,20 @@ 
       <target dev='sda' bus='scsi'/>
       <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'/>
-    <controller type='scsi' index='0'/>
+    <controller type='scsi' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device.xml
index fae9513..2d0a2ef 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device.xml
@@ -24,12 +24,20 @@ 
       <target dev='sda' bus='scsi'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
-    <controller type='scsi' index='0' model='lsilogic'/>
+    <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='scsi' index='0' model='lsilogic'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </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='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
index 13004c1..42c7bcd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
@@ -30,12 +30,20 @@ 
       <product>ST3567807GD</product>
       <address type='drive' controller='1' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'/>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='scsi' index='1' model='lsilogic'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='scsi' index='1' model='lsilogic'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </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='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-lun-passthrough-sgio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-lun-passthrough-sgio.xml
index 676ab97..ab81b60 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-lun-passthrough-sgio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-lun-passthrough-sgio.xml
@@ -24,12 +24,20 @@ 
       <target dev='hdb' bus='scsi'/>
       <address type='drive' controller='0' bus='0' target='1' unit='1'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='scsi' index='1' model='lsilogic'/>
-    <controller type='usb' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='scsi' index='1' model='lsilogic'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-megasas.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-megasas.xml
index d8e509f..879ec44 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-megasas.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-megasas.xml
@@ -24,12 +24,20 @@ 
       <target dev='sda' bus='scsi'/>
       <address type='drive' controller='0' bus='0' target='4' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='scsi' index='0' model='lsisas1078'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0' model='lsisas1078'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-virtio-scsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-virtio-scsi.xml
index 0699f51..671e8fe 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-virtio-scsi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-virtio-scsi.xml
@@ -24,12 +24,20 @@ 
       <target dev='sda' bus='scsi'/>
       <address type='drive' controller='0' bus='0' target='4' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml
index fa74b62..ccdc578 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml
@@ -24,12 +24,20 @@ 
       <target dev='sda' bus='scsi'/>
       <address type='drive' controller='0' bus='0' target='3' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='scsi' index='0' model='ibmvscsi'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0' model='ibmvscsi'>
+      <address type='spapr-vio' reg='0x2000'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool-mode.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool-mode.xml
index 4f7f3f1..4fe0cc5 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool-mode.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool-mode.xml
@@ -39,11 +39,17 @@ 
       <target dev='hdc' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='3'/>
     </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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool.xml
index ad6d638..19eea66 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool.xml
@@ -35,11 +35,17 @@ 
       <target dev='hdd' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='2'/>
     </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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-usb-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-usb-device.xml
index 6e132cb..2eef27c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-usb-device.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-usb-device.xml
@@ -23,11 +23,17 @@ 
       <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='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-cmd_per_lun.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-cmd_per_lun.xml
index 9a192b7..67d9e73 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-cmd_per_lun.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-cmd_per_lun.xml
@@ -19,13 +19,18 @@ 
       <target dev='sdb' bus='scsi'/>
       <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='scsi' index='0' model='virtio-scsi'>
       <driver cmd_per_lun='50'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </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='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml
index a9c2840..9177ba6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml
@@ -19,13 +19,18 @@ 
       <target dev='sdb' bus='scsi'/>
       <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='scsi' index='0' model='virtio-scsi'>
       <driver ioeventfd='on'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </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='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml
index be1454e..9e4b959 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml
@@ -19,13 +19,18 @@ 
       <target dev='sdb' bus='scsi'/>
       <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='scsi' index='0' model='virtio-scsi'>
       <driver max_sectors='512'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </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='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-num_queues.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-num_queues.xml
index 89ea310..c012ab5 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-num_queues.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-num_queues.xml
@@ -19,13 +19,18 @@ 
       <target dev='sdb' bus='scsi'/>
       <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='scsi' index='0' model='virtio-scsi'>
       <driver queues='8'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </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='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio.xml
index b843878..c70fe9b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio.xml
@@ -31,14 +31,20 @@ 
       <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='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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-xenvbd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-xenvbd.xml
index 088daff..de6ca8b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-xenvbd.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-xenvbd.xml
@@ -37,8 +37,12 @@ 
       <source file='/tmp/logs.img'/>
       <target dev='xvdg' bus='xen'/>
     </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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-encrypted-disk.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-encrypted-disk.xml
index 6de570a..038a0e7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-encrypted-disk.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-encrypted-disk.xml
@@ -23,10 +23,14 @@ 
       </encryption>
       <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-disabled.xml
index f416737..7e52b46 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-disabled.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-disabled.xml
@@ -19,10 +19,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-enabled.xml
index 7c9db82..8e86f61 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-enabled.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-enabled.xml
@@ -19,10 +19,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-event_idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-event_idx.xml
index 77c0845..1e9d33c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-event_idx.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-event_idx.xml
@@ -29,16 +29,21 @@ 
       <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='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
-    <controller type='ide' index='0'/>
+    <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'/>
     <interface type='user'>
       <mac address='52:54:00:e5:48:58'/>
       <model type='virtio'/>
       <driver name='vhost' event_idx='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <serial type='pty'>
       <target port='0'/>
@@ -48,6 +53,8 @@ 
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-floppy-drive-fat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-floppy-drive-fat.xml
index 4e0826f..b472647 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-floppy-drive-fat.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-floppy-drive-fat.xml
@@ -21,12 +21,18 @@ 
       <readonly/>
       <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='fdc' index='0'/>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml
index bf78ca8..599eda9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml
@@ -19,8 +19,12 @@ 
       <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'/>
@@ -29,7 +33,10 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
index abee7b6..8687a6b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
@@ -19,8 +19,12 @@ 
       <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'/>
@@ -30,7 +34,10 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml
index 1bac0b5..cbf7a78 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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='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'/>
     <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/>
     <video>
       <model type='cirrus' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml
index 5f94052..536a0f7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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='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'/>
     <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/>
     <video>
       <model type='vga' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml
index c13327a..e0419e1 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml
@@ -19,8 +19,12 @@ 
       <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'/>
@@ -34,10 +38,14 @@ 
     </graphics>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </video>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml
index ac705f3..82a359d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml
@@ -19,8 +19,12 @@ 
       <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'/>
@@ -31,10 +35,14 @@ 
     </graphics>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <video>
       <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </video>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
index 4f4f47c..8a0711e 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
@@ -58,7 +58,9 @@ 
     <controller type='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
-    <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'/>
     <interface type='ethernet'>
       <mac address='52:54:00:71:70:89'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml
index 0c61ee5..38d3507 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml
@@ -19,8 +19,12 @@ 
       <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'/>
@@ -38,10 +42,14 @@ 
     </graphics>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </video>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml
index e350142..7146529 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml
@@ -20,8 +20,12 @@ 
       <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'/>
@@ -30,6 +34,7 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml
index e350142..7146529 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml
@@ -20,8 +20,12 @@ 
       <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'/>
@@ -30,6 +34,7 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml
index afa4b5a..3f23c79 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml
index 3313469..73d3b1b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml
@@ -20,8 +20,12 @@ 
       <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'/>
@@ -30,6 +34,7 @@ 
     </graphics>
     <video>
       <model type='cirrus' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-pci-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-pci-address.xml
index 77b484d..aed0a0c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-pci-address.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-pci-address.xml
@@ -20,8 +20,12 @@ 
       <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'/>
@@ -29,6 +33,7 @@ 
       <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/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml
index a948caa..a6be3b6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml
@@ -19,11 +19,19 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
-    <controller type='scsi' index='1'/>
+    <controller type='scsi' index='1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <hostdev mode='subsystem' type='scsi' managed='yes'>
@@ -103,6 +111,8 @@ 
       </source>
       <address type='drive' controller='1' bus='0' target='0' unit='2'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-large-unit.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-large-unit.xml
index e0846e9..5f3cff7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-large-unit.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-large-unit.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -32,6 +38,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='4' unit='8'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml
index ed2bf25..5ed4095 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -43,6 +49,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='5'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml
index 056151e..d4d93fb 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -37,6 +43,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='5'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi.xml
index f545d74..4a631be 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -32,6 +38,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='7'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-rawio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-rawio.xml
index 466b9e6..f5c1def 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-rawio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-rawio.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -32,6 +38,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='4' unit='8'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-readonly.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-readonly.xml
index 69c0b0d..906ac91 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-readonly.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-readonly.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -33,6 +39,8 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='0' target='4' unit='8'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-sgio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-sgio.xml
index 3ad679b..09b80e6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-sgio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-sgio.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -32,6 +38,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='4' unit='8'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-shareable.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-shareable.xml
index effd5f3..37efd76 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-shareable.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-shareable.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -33,6 +39,8 @@ 
       <shareable/>
       <address type='drive' controller='0' bus='0' target='4' unit='8'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml
index 33577ab..a5d3b8e 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -43,6 +49,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='2' unit='5'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml
index e612eec..8fdaa71 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -37,6 +43,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='2' unit='5'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml
index 6f302be..ed14360 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml
@@ -19,9 +19,15 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <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'/>
@@ -32,6 +38,8 @@ 
       </source>
       <address type='drive' controller='0' bus='0' target='4' unit='8'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-usb-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-usb-address.xml
index a196886..d33a4e5 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-usb-address.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-usb-address.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-vfio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-vfio.xml
index 7161561..620a24f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-vfio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-vfio.xml
@@ -19,8 +19,12 @@ 
       <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'/>
@@ -29,7 +33,10 @@ 
       <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='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages.xml
index 24665a4..227e407 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages.xml
@@ -37,11 +37,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages2.xml
index 5b10307..aba8cf8 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages2.xml
@@ -30,11 +30,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages3.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages3.xml
index d6f9703..a6d4c11 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages3.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages3.xml
@@ -30,11 +30,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-shared.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-shared.xml
index 709a0f9..ad6e3d1 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-shared.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-shared.xml
@@ -37,11 +37,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages.xml
index 0eb59df..3fe3bce 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages.xml
@@ -22,11 +22,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-off.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-off.xml
index 1067f64..b09c447 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-off.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-off.xml
@@ -22,10 +22,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-panic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-panic.xml
index 0cafc07..31aacd5 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-panic.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml
index 2b8f332..a79115c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-input-usbmouse.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbmouse.xml
index 2ff76e1..689918a 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbmouse.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbmouse.xml
@@ -20,8 +20,12 @@ 
       <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='usb'/>
     <input type='mouse' bus='ps2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbtablet.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbtablet.xml
index 096c082..a969566 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbtablet.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbtablet.xml
@@ -20,8 +20,12 @@ 
       <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='tablet' bus='usb'/>
     <input type='mouse' bus='ps2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml
index e853de5..cd286fd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml
@@ -29,17 +29,22 @@ 
       <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='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
-    <controller type='ide' index='0'/>
+    <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'/>
     <interface type='user'>
       <mac address='52:54:00:e5:48:58'/>
       <model type='virtio'/>
       <driver ioeventfd='on' event_idx='on' queues='5'/>
       <link state='up'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <serial type='pty'>
       <target port='0'/>
@@ -49,6 +54,8 @@ 
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml
index 242ea8a..b6f7d30 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml
@@ -19,6 +19,7 @@ 
       <driver name='qemu' type='raw' iothread='1'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='hda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
     </disk>
     <disk type='block' device='disk'>
       <driver name='qemu' type='raw' iothread='2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
index cf50a2b..0eb45b7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
@@ -31,9 +31,14 @@ 
       <driver name='qemu' type='raw' iothread='2'/>
       <source file='/var/lib/libvirt/images/iothrtest2.img'/>
       <target dev='vdc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
index f0ca119..d6deced 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
@@ -25,8 +25,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids.xml
index 32e0075..f4c2395 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids.xml
@@ -25,8 +25,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
index 5f18b92..5c5d9db 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
@@ -21,8 +21,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features-off.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features-off.xml
index 5e54e78..7c6be71 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features-off.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features-off.xml
@@ -20,10 +20,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features.xml
index 8837596..647be59 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml
index 15b474b..2b674a5 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml
index 2093556..2907330 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml
@@ -25,8 +25,12 @@ 
       <readonly/>
       <address type='drive' controller='0' bus='1' 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'/>
     <lease>
       <lockspace>somearea</lockspace>
@@ -35,6 +39,8 @@ 
     </lease>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-off.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-off.xml
index be84ca4..05212d2 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-off.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-off.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-on.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-on.xml
index 58784ba..03b6744 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-on.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-on.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-dimm.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-dimm.xml
index 48d5904..c5b5d75 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-dimm.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-dimm.xml
@@ -30,12 +30,18 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
     <memory model='dimm'>
       <target>
         <size unit='KiB'>523264</size>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nonuma.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nonuma.xml
index c83a6a5..c6857fd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nonuma.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nonuma.xml
@@ -15,10 +15,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug.xml
index 90bd43e..3fa0507 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug.xml
@@ -26,11 +26,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune-unlimited.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune-unlimited.xml
index 820984d..6c858d7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune-unlimited.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune-unlimited.xml
@@ -19,11 +19,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml
index 4ce40ac..6652ec9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml
@@ -24,11 +24,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata-duplicate.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata-duplicate.xml
index 25e969d..ad2d0f1 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata-duplicate.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata-duplicate.xml
@@ -23,11 +23,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml
index 25e969d..ad2d0f1 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml
@@ -23,11 +23,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-migrate.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-migrate.xml
index 23fc792..71d312c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-migrate.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-migrate.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml
index bfdd1aa..3c071ea 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml
@@ -24,11 +24,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-acpi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-acpi.xml
index 800a0a9..88c2840 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-acpi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-acpi.xml
@@ -23,8 +23,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-s3.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-s3.xml
index 3619c24..7c069f6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-s3.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-s3.xml
@@ -23,8 +23,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-suspends.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-suspends.xml
index 30276e0..06393d7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-suspends.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-suspends.xml
@@ -24,8 +24,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-enable-s4.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-enable-s4.xml
index ac8b3f0..d8d68a6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-enable-s4.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-enable-s4.xml
@@ -23,8 +23,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-no-reboot.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-no-reboot.xml
index 6dba315..b6b9c6c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-no-reboot.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-no-reboot.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-uuid.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-uuid.xml
index 800a0a9..88c2840 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-uuid.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-uuid.xml
@@ -23,8 +23,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml
index daecc8b..7dc55e0 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml
@@ -34,7 +34,9 @@ 
       <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='ide' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml
index 10e15ee..46e5d61 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml
@@ -27,7 +27,9 @@ 
       <target dev='vda' 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='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-ifname.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-ifname.xml
index d1810b5..c5fab8f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-ifname.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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='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'/>
     <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/qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml
index 5e88efb..dc335bd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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='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'/>
     <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/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev-vfio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev-vfio.xml
index d4e4476..a3bcbd4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev-vfio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev-vfio.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <interface type='hostdev' managed='yes'>
       <mac address='00:11:22:33:44:55'/>
@@ -35,9 +39,12 @@ 
         <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
       </virtualport>
       <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev.xml
index 8cf6254..55e2302 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <interface type='hostdev' managed='yes'>
       <mac address='00:11:22:33:44:55'/>
@@ -34,9 +38,12 @@ 
         <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
       </virtualport>
       <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-midonet.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-midonet.xml
index f108cad..2071150 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-midonet.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-midonet.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <interface type='bridge'>
       <mac address='00:11:22:33:44:55'/>
@@ -29,9 +33,12 @@ 
         <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
       </virtualport>
       <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-openvswitch.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-openvswitch.xml
index 2902cb2..e0fe4aa 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-openvswitch.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-openvswitch.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <interface type='network'>
       <mac address='00:11:22:33:44:55'/>
@@ -34,9 +38,12 @@ 
         <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f' profileid='bob'/>
       </virtualport>
       <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml
index 239510d..0752902 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml
@@ -19,8 +19,12 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
     <interface type='udp'>
       <mac address='52:54:00:8c:b9:05'/>
@@ -28,9 +32,12 @@ 
         <local address='192.168.10.1' port='5556'/>
       </source>
       <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml
index 17d7adc..e9fe508 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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='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'/>
     <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/qemuxml2xmloutdata/qemuxml2xmlout-net-vhostuser.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-vhostuser.xml
index 3771563..ac1d7e1 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-vhostuser.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-vhostuser.xml
@@ -20,23 +20,30 @@ 
       <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'/>
     <interface type='vhostuser'>
       <mac address='52:54:00:ee:96:6b'/>
       <source type='unix' path='/tmp/vhost0.sock' mode='server'/>
       <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <interface type='vhostuser'>
       <mac address='52:54:00:ee:96:6c'/>
       <source type='unix' path='/tmp/vhost1.sock' mode='client'/>
       <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </interface>
     <interface type='server'>
       <mac address='52:54:00:95:db:c0'/>
       <source port='2015'/>
       <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-device.xml
index 5d631fd..3748cd6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-device.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-device.xml
@@ -19,16 +19,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='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'/>
     <interface type='user'>
       <mac address='00:11:22:33:44:55'/>
       <model type='virtio'/>
       <driver txmode='iothread'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-disable-offloads.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-disable-offloads.xml
index 30297e6..8038ff7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-disable-offloads.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-disable-offloads.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <interface type='user'>
       <mac address='00:22:44:66:88:aa'/>
@@ -29,9 +33,12 @@ 
         <host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off' mrg_rxbuf='off'/>
         <guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
       </driver>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-network-portgroup.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-network-portgroup.xml
index 8445feb..f77d6da 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-network-portgroup.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-network-portgroup.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <interface type='network' trustGuestRxFilters='yes'>
       <mac address='00:11:22:33:44:55'/>
@@ -32,6 +36,7 @@ 
         <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
       </virtualport>
       <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <interface type='network' trustGuestRxFilters='no'>
       <mac address='10:11:22:33:44:55'/>
@@ -40,6 +45,7 @@ 
         <parameters instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f' interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
       </virtualport>
       <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='22:11:22:33:44:55'/>
@@ -48,9 +54,12 @@ 
         <parameters profileid='testhis99'/>
       </virtualport>
       <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio.xml
index 422649c..8984d43 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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='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'/>
     <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/qemuxml2xmloutdata/qemuxml2xmlout-nographics-vga.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-nographics-vga.xml
index 23fc792..71d312c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-nographics-vga.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-nographics-vga.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-nosharepages.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-nosharepages.xml
index 021642a..7a4996c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-nosharepages.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-nosharepages.xml
@@ -23,8 +23,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml
index b3b01fd..8a6113d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml
@@ -25,11 +25,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml
index aa4c858..1427c01 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml
@@ -25,11 +25,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml
index 8ca9637..1b0226f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml
@@ -25,11 +25,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-static-vcpu-no-numatune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-static-vcpu-no-numatune.xml
index d85ba6b..243e167 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-static-vcpu-no-numatune.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-static-vcpu-no-numatune.xml
@@ -22,11 +22,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml
index 328de41..87b92a4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml
@@ -22,10 +22,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode-no-memory.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode-no-memory.xml
index b9f7ca4..dfb0343 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode-no-memory.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode-no-memory.xml
@@ -23,10 +23,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml
index 380498d..d84fe27 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml
@@ -26,10 +26,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-double.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-double.xml
index 5908ab3..9863da3 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-double.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-double.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/qemuxml2xmloutdata/qemuxml2xmlout-panic-isa.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-isa.xml
index 767d615..0c2ea12 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-isa.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-isa.xml
@@ -19,13 +19,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='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>
     <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>
     <panic model='isa'>
       <address type='isa' iobase='0x505'/>
     </panic>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-no-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-no-address.xml
index c3c7551..3fe8ec5 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-no-address.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-no-address.xml
@@ -19,13 +19,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='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>
     <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>
     <panic model='isa'/>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml
index 8fcd644..1ed11ce 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml
@@ -14,15 +14,17 @@ 
   <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'/>
     <serial type='pty'>
       <target port='0'/>
-      <address type='spapr-vio'/>
+      <address type='spapr-vio' reg='0x30000000'/>
     </serial>
     <console type='pty'>
       <target type='serial' port='0'/>
-      <address type='spapr-vio'/>
+      <address type='spapr-vio' reg='0x30000000'/>
     </console>
     <memballoon model='none'/>
     <panic model='pseries'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml
index 767d615..0c2ea12 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml
@@ -19,13 +19,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='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>
     <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>
     <panic model='isa'>
       <address type='isa' iobase='0x505'/>
     </panic>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-parallel-tcp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-parallel-tcp.xml
index 99d2110..d8199b3 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-parallel-tcp.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-parallel-tcp.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <parallel type='tcp'>
       <source mode='bind' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml
index 5c7f2b8..b4d6a41 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml
@@ -33,6 +33,41 @@ 
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='pci' index='1' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <controller type='pci' index='3' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='3'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </controller>
+    <controller type='pci' index='4' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </controller>
+    <controller type='pci' index='5' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='5'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </controller>
+    <controller type='pci' index='6' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='6'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+    </controller>
+    <controller type='pci' index='7' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='7'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml
index ddf0e4c..8ca1e39 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml
@@ -32,8 +32,47 @@ 
     <controller type='ide' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
-    <controller type='pci' index='8' model='pci-bridge'/>
+    <controller type='pci' index='8' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='8'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='pci' index='1' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </controller>
+    <controller type='pci' index='3' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='3'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </controller>
+    <controller type='pci' index='4' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </controller>
+    <controller type='pci' index='5' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='5'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+    </controller>
+    <controller type='pci' index='6' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='6'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+    </controller>
+    <controller type='pci' index='7' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='7'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge-many-disks.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge-many-disks.xml
index b4c37bd..9bf8ff6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge-many-disks.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge-many-disks.xml
@@ -26,529 +26,651 @@ 
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/test.img'/>
       <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-a-a.img'/>
       <target dev='vdaa' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-a-b.img'/>
       <target dev='vdab' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-a-c.img'/>
       <target dev='vdac' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-a-d.img'/>
       <target dev='vdad' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-b-a.img'/>
       <target dev='vdba' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-b-b.img'/>
       <target dev='vdbb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-b-c.img'/>
       <target dev='vdbc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-b-d.img'/>
       <target dev='vdbd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-c-a.img'/>
       <target dev='vdca' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-c-b.img'/>
       <target dev='vdcb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-c-c.img'/>
       <target dev='vdcc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-c-d.img'/>
       <target dev='vdcd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-d-a.img'/>
       <target dev='vdda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x13' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-d-b.img'/>
       <target dev='vddb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-d-c.img'/>
       <target dev='vddc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x15' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-d-d.img'/>
       <target dev='vddd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x16' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-e-a.img'/>
       <target dev='vdea' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x17' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-e-b.img'/>
       <target dev='vdeb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x18' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-e-c.img'/>
       <target dev='vdec' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-e-d.img'/>
       <target dev='vded' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-f-a.img'/>
       <target dev='vdfa' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-f-b.img'/>
       <target dev='vdfb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-f-c.img'/>
       <target dev='vdfc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-f-d.img'/>
       <target dev='vdfd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-g-a.img'/>
       <target dev='vdga' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-g-b.img'/>
       <target dev='vdgb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-g-c.img'/>
       <target dev='vdgc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x02' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-g-d.img'/>
       <target dev='vdgd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x03' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-h-a.img'/>
       <target dev='vdha' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x04' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-h-b.img'/>
       <target dev='vdhb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x05' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-h-c.img'/>
       <target dev='vdhc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x06' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-h-d.img'/>
       <target dev='vdhd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x07' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-i-a.img'/>
       <target dev='vdia' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x08' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-i-b.img'/>
       <target dev='vdib' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x09' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-i-c.img'/>
       <target dev='vdic' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x0a' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-i-d.img'/>
       <target dev='vdid' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x0b' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-j-a.img'/>
       <target dev='vdja' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x0c' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-j-b.img'/>
       <target dev='vdjb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x0d' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-j-c.img'/>
       <target dev='vdjc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x0e' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-j-d.img'/>
       <target dev='vdjd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x0f' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-k-a.img'/>
       <target dev='vdka' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x10' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-k-b.img'/>
       <target dev='vdkb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x11' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-k-c.img'/>
       <target dev='vdkc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x12' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-k-d.img'/>
       <target dev='vdkd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x13' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-l-a.img'/>
       <target dev='vdla' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x14' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-l-b.img'/>
       <target dev='vdlb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x15' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-l-c.img'/>
       <target dev='vdlc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x16' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-l-d.img'/>
       <target dev='vdld' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x17' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-m-a.img'/>
       <target dev='vdma' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x18' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-m-b.img'/>
       <target dev='vdmb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x19' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-m-c.img'/>
       <target dev='vdmc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x1a' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-m-d.img'/>
       <target dev='vdmd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x1b' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-n-a.img'/>
       <target dev='vdna' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x1c' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-n-b.img'/>
       <target dev='vdnb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x1d' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-n-c.img'/>
       <target dev='vdnc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x1e' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-n-d.img'/>
       <target dev='vdnd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x1f' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-o-a.img'/>
       <target dev='vdoa' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-o-b.img'/>
       <target dev='vdob' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-o-c.img'/>
       <target dev='vdoc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-o-d.img'/>
       <target dev='vdod' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-p-a.img'/>
       <target dev='vdpa' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-p-b.img'/>
       <target dev='vdpb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-p-c.img'/>
       <target dev='vdpc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-p-d.img'/>
       <target dev='vdpd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-q-a.img'/>
       <target dev='vdqa' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x09' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-q-b.img'/>
       <target dev='vdqb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x0a' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-q-c.img'/>
       <target dev='vdqc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x0b' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-q-d.img'/>
       <target dev='vdqd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x0c' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-r-a.img'/>
       <target dev='vdra' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x0d' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-r-b.img'/>
       <target dev='vdrb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x0e' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-r-c.img'/>
       <target dev='vdrc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x0f' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-r-d.img'/>
       <target dev='vdrd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x10' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-s-a.img'/>
       <target dev='vdsa' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x11' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-s-b.img'/>
       <target dev='vdsb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x12' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-s-c.img'/>
       <target dev='vdsc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x13' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-s-d.img'/>
       <target dev='vdsd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x14' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-t-a.img'/>
       <target dev='vdta' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x15' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-t-b.img'/>
       <target dev='vdtb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x16' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-t-c.img'/>
       <target dev='vdtc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x17' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-t-d.img'/>
       <target dev='vdtd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x18' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-u-a.img'/>
       <target dev='vdua' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x19' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-u-b.img'/>
       <target dev='vdub' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x1a' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-u-c.img'/>
       <target dev='vduc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x1b' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-u-d.img'/>
       <target dev='vdud' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x1c' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-v-a.img'/>
       <target dev='vdva' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x1d' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-v-b.img'/>
       <target dev='vdvb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x1e' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-v-c.img'/>
       <target dev='vdvc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x1f' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-v-d.img'/>
       <target dev='vdvd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-w-a.img'/>
       <target dev='vdwa' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x02' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-w-b.img'/>
       <target dev='vdwb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x03' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-w-c.img'/>
       <target dev='vdwc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x04' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-w-d.img'/>
       <target dev='vdwd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x05' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-x-a.img'/>
       <target dev='vdxa' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x06' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-x-b.img'/>
       <target dev='vdxb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-x-c.img'/>
       <target dev='vdxc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x08' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-x-d.img'/>
       <target dev='vdxd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x09' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-y-a.img'/>
       <target dev='vdya' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x0a' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-y-b.img'/>
       <target dev='vdyb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x0b' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-y-c.img'/>
       <target dev='vdyc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x0c' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-y-d.img'/>
       <target dev='vdyd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x0d' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-z-a.img'/>
       <target dev='vdza' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x0e' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-z-b.img'/>
       <target dev='vdzb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x0f' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-z-c.img'/>
       <target dev='vdzc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/disk-z-d.img'/>
       <target dev='vdzd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x11' 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='pci' index='1' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <controller type='pci' index='3' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='3'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml
index 683c269..3958ab3 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml
@@ -33,167 +33,207 @@ 
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='pci' index='1' model='pci-bridge'/>
-    <controller type='pci' index='2' model='pci-bridge'/>
+    <controller type='pci' index='1' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
     <interface type='network'>
       <mac address='52:54:00:f1:95:51'/>
       <source network='default'/>
       <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:5c:c6:1a'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:39:97:ac'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:45:28:cb'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:ee:b9:a8'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:a9:f7:17'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:df:2b:f3'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:78:94:b4'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:6b:9b:06'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:17:df:bc'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:3b:d0:51'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:8d:2d:17'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:a7:66:af'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:54:ab:d7'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x13' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:1f:99:90'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:c8:43:87'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x15' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:df:22:b2'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x16' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:d2:9a:47'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x17' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:86:05:e2'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x18' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:8c:1c:c2'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:48:58:92'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:99:e5:bf'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:b1:8c:25'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:60:e0:d0'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:37:00:6a'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:c7:c8:ad'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:4e:a7:cf'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:00:79:69'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x02' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:47:00:6f'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x03' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:2a:8c:8b'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x04' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:ec:d5:e3'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x05' function='0x0'/>
     </interface>
     <interface type='network'>
       <mac address='52:54:00:7e:6e:c8'/>
       <source network='default'/>
       <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x06' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml
index 6ad1134..f970d42 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml
@@ -19,18 +19,24 @@ 
       <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'/>
     <interface type='user'>
       <mac address='52:54:00:24:a5:9f'/>
       <model type='virtio'/>
       <rom bar='on'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <interface type='user'>
       <mac address='52:54:00:24:a5:9e'/>
       <model type='virtio'/>
       <rom file='/etc/fake/bootrom.bin'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </interface>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
@@ -39,13 +45,17 @@ 
         <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
       </source>
       <rom bar='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <source>
         <address domain='0x0000' bus='0x06' slot='0x12' function='0x6'/>
       </source>
       <rom bar='on' file='/etc/fake/bootrom.bin'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </hostdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml
index 10d3a48..e41325b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <serial type='dev'>
       <source path='/dev/ttyS2'/>
@@ -34,6 +38,8 @@ 
     </console>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-too-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-too-many.xml
deleted file mode 100644
index 98be1cd..0000000
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-too-many.xml
+++ /dev/null
@@ -1,62 +0,0 @@ 
-<domain type='qemu'>
-  <name>q35-test</name>
-  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
-  <memory unit='KiB'>2097152</memory>
-  <currentMemory unit='KiB'>2097152</currentMemory>
-  <vcpu placement='static' cpuset='0-1'>2</vcpu>
-  <os>
-    <type arch='x86_64' machine='q35'>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/libexec/qemu-kvm</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='sda' bus='sata'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <controller type='pci' index='0' model='pcie-root'/>
-    <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
-    <controller type='pci' index='2' model='pci-bridge'/>
-    <controller type='pci' index='3' model='pcie-root-port'/>
-    <controller type='pci' index='4' model='pcie-root-port'/>
-    <controller type='pci' index='5' model='pcie-root-port'/>
-    <controller type='pci' index='6' model='pcie-root-port'/>
-    <controller type='pci' index='7' model='pcie-root-port'/>
-    <controller type='pci' index='8' model='pcie-root-port'/>
-    <controller type='pci' index='9' model='pcie-root-port'/>
-    <controller type='pci' index='10' model='pcie-root-port'/>
-    <controller type='pci' index='11' model='pcie-root-port'/>
-    <controller type='pci' index='12' model='pcie-root-port'/>
-    <controller type='pci' index='13' model='pcie-root-port'/>
-    <controller type='pci' index='14' model='pcie-root-port'/>
-    <controller type='pci' index='15' model='pcie-root-port'/>
-    <controller type='pci' index='16' model='pcie-root-port'/>
-    <controller type='pci' index='17' model='pcie-root-port'/>
-    <controller type='pci' index='18' model='pcie-root-port'/>
-    <controller type='pci' index='19' model='pcie-root-port'/>
-    <controller type='pci' index='20' model='pcie-root-port'/>
-    <controller type='pci' index='21' model='pcie-root-port'/>
-    <controller type='pci' index='22' model='pcie-root-port'/>
-    <controller type='pci' index='23' model='pcie-root-port'/>
-    <controller type='pci' index='24' model='pcie-root-port'/>
-    <controller type='pci' index='25' model='pcie-root-port'/>
-    <controller type='pci' index='26' model='pcie-root-port'/>
-    <controller type='pci' index='27' model='pcie-root-port'/>
-    <controller type='pci' index='28' model='pcie-root-port'/>
-    <controller type='pci' index='29' model='pcie-root-port'/>
-    <controller type='pci' index='30' model='pcie-root-port'/>
-    <controller type='pci' index='31' model='pcie-root-port'/>
-    <controller type='sata' index='0'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <video>
-      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
-    </video>
-    <memballoon model='none'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
index 795f8dd..cb1c60f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
@@ -20,18 +20,33 @@ 
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pcie-root'/>
-    <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
-    <controller type='pci' index='2' model='pci-bridge'/>
-    <controller type='pci' index='3' model='pcie-root-port'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='3' model='pcie-root-port'>
+      <model name='ioh3420'/>
+      <target chassis='3' port='0x10'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </controller>
     <controller type='pci' index='4' model='pcie-root-port'>
       <model name='ioh3420'/>
       <target chassis='40' port='0x1a'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
     </controller>
-    <controller type='sata' index='0'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
index 7eb0a32..013cbc4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
@@ -15,9 +15,18 @@ 
   <devices>
     <emulator>/usr/libexec/qemu-kvm</emulator>
     <controller type='pci' index='0' model='pcie-root'/>
-    <controller type='sata' index='0'/>
-    <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
-    <controller type='pci' index='2' model='pci-bridge'/>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+    </controller>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml
index b781675..8f0e5ac 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml
@@ -20,26 +20,71 @@ 
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pcie-root'/>
-    <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
-    <controller type='pci' index='2' model='pci-bridge'/>
-    <controller type='pci' index='3' model='pcie-root-port'/>
-    <controller type='pci' index='4' model='pcie-switch-upstream-port'/>
-    <controller type='pci' index='5' model='pcie-switch-downstream-port'/>
-    <controller type='pci' index='6' model='pcie-switch-downstream-port'/>
-    <controller type='pci' index='7' model='pcie-switch-downstream-port'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='3' model='pcie-root-port'>
+      <model name='ioh3420'/>
+      <target chassis='3' port='0x10'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </controller>
+    <controller type='pci' index='4' model='pcie-switch-upstream-port'>
+      <model name='x3130-upstream'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
+    </controller>
+    <controller type='pci' index='5' model='pcie-switch-downstream-port'>
+      <model name='xio3130-downstream'/>
+      <target chassis='5' port='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+    </controller>
+    <controller type='pci' index='6' model='pcie-switch-downstream-port'>
+      <model name='xio3130-downstream'/>
+      <target chassis='6' port='0x1'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='7' model='pcie-switch-downstream-port'>
+      <model name='xio3130-downstream'/>
+      <target chassis='7' port='0x2'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
+    </controller>
     <controller type='pci' index='8' model='pcie-switch-downstream-port'>
       <model name='xio3130-downstream'/>
       <target chassis='30' port='0x27'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='9' model='pcie-switch-upstream-port'>
+      <model name='x3130-upstream'/>
+      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
+    </controller>
+    <controller type='pci' index='10' model='pcie-switch-downstream-port'>
+      <model name='xio3130-downstream'/>
+      <target chassis='10' port='0x4'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x04' function='0x0'/>
+    </controller>
+    <controller type='pci' index='11' model='pcie-switch-downstream-port'>
+      <model name='xio3130-downstream'/>
+      <target chassis='11' port='0x5'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x05' function='0x0'/>
+    </controller>
+    <controller type='pci' index='12' model='pcie-switch-downstream-port'>
+      <model name='xio3130-downstream'/>
+      <target chassis='12' port='0x6'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x06' function='0x0'/>
+    </controller>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
     </controller>
-    <controller type='pci' index='9' model='pcie-switch-upstream-port'/>
-    <controller type='pci' index='10' model='pcie-switch-downstream-port'/>
-    <controller type='pci' index='11' model='pcie-switch-downstream-port'/>
-    <controller type='pci' index='12' model='pcie-switch-downstream-port'/>
-    <controller type='sata' index='0'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml
index 4205f8a..79c0304 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml
@@ -20,19 +20,41 @@ 
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
     <controller type='pci' index='0' model='pcie-root'/>
-    <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
-    <controller type='pci' index='2' model='pci-bridge'/>
-    <controller type='pci' index='3' model='pcie-root-port'/>
-    <controller type='pci' index='4' model='pcie-root-port'/>
-    <controller type='pci' index='5' model='pcie-switch-upstream-port'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='3' model='pcie-root-port'>
+      <model name='ioh3420'/>
+      <target chassis='3' port='0x10'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </controller>
+    <controller type='pci' index='4' model='pcie-root-port'>
+      <model name='ioh3420'/>
+      <target chassis='4' port='0x18'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='5' model='pcie-switch-upstream-port'>
+      <model name='x3130-upstream'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
+    </controller>
     <controller type='pci' index='6' model='pcie-switch-upstream-port'>
       <model name='x3130-upstream'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+    </controller>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
     </controller>
-    <controller type='sata' index='0'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-gib.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-gib.xml
index 793ff3f..ece3a67 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-gib.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-gib.xml
@@ -17,9 +17,13 @@ 
     <controller type='pci' index='0' model='pci-root'>
       <pcihole64 unit='KiB'>1048576</pcihole64>
     </controller>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-none.xml
index bcc5b3c..e949a5e 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-none.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-none.xml
@@ -17,9 +17,13 @@ 
     <controller type='pci' index='0' model='pci-root'>
       <pcihole64 unit='KiB'>0</pcihole64>
     </controller>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml
index a967bf4..0845413 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml
@@ -22,13 +22,23 @@ 
     <controller type='pci' index='0' model='pcie-root'>
       <pcihole64 unit='KiB'>1048576</pcihole64>
     </controller>
-    <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
-    <controller type='pci' index='2' model='pci-bridge'/>
-    <controller type='sata' index='0'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64.xml
index 931f513..ce408b2 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64.xml
@@ -17,9 +17,13 @@ 
     <controller type='pci' index='0' model='pci-root'>
       <pcihole64 unit='KiB'>1048576</pcihole64>
     </controller>
-    <controller type='usb' index='0'/>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature-off.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature-off.xml
index 1eb5a83..13526fe 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature-off.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature-off.xml
@@ -18,7 +18,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/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature.xml
index 41b7fbf..67fce45 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature.xml
@@ -18,7 +18,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/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml
index 2da2832..713f31c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml
index 8fcd644..1ed11ce 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml
@@ -14,15 +14,17 @@ 
   <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'/>
     <serial type='pty'>
       <target port='0'/>
-      <address type='spapr-vio'/>
+      <address type='spapr-vio' reg='0x30000000'/>
     </serial>
     <console type='pty'>
       <target type='serial' port='0'/>
-      <address type='spapr-vio'/>
+      <address type='spapr-vio' reg='0x30000000'/>
     </console>
     <memballoon model='none'/>
     <panic model='pseries'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml
index 8fcd644..1ed11ce 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml
@@ -14,15 +14,17 @@ 
   <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'/>
     <serial type='pty'>
       <target port='0'/>
-      <address type='spapr-vio'/>
+      <address type='spapr-vio' reg='0x30000000'/>
     </serial>
     <console type='pty'>
       <target type='serial' port='0'/>
-      <address type='spapr-vio'/>
+      <address type='spapr-vio' reg='0x30000000'/>
     </console>
     <memballoon model='none'/>
     <panic model='pseries'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-disabled.xml
index 693b71c..aa1cc2c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-disabled.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-disabled.xml
@@ -19,10 +19,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-enabled.xml
index 0b8c9af..5621b25 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-enabled.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-enabled.xml
@@ -19,10 +19,14 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml
index eee1a0b..04cf91e 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml
@@ -22,46 +22,66 @@ 
     <controller type='pci' index='0' model='pcie-root'/>
     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
       <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
     </controller>
     <controller type='pci' index='2' model='pci-bridge'>
       <model name='pci-bridge'/>
       <target chassisNr='56'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
     </controller>
-    <controller type='usb' index='0' model='ich9-ehci1'/>
     <controller type='usb' index='0' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
+    </controller>
+    <controller type='usb' index='1' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x7'/>
     </controller>
-    <controller type='usb' index='1' model='ich9-ehci1'/>
     <controller type='usb' index='1' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='1' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x1'/>
     </controller>
     <controller type='usb' index='1' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x2'/>
+    </controller>
+    <controller type='usb' index='2' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x7'/>
     </controller>
-    <controller type='usb' index='2' model='ich9-ehci1'/>
     <controller type='usb' index='2' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='2' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x1'/>
     </controller>
     <controller type='usb' index='2' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
     </controller>
-    <controller type='sata' index='0'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml
index 83ad8fb..eef74d7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml
@@ -22,46 +22,66 @@ 
     <controller type='pci' index='0' model='pcie-root'/>
     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
       <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
     </controller>
     <controller type='pci' index='2' model='pci-bridge'>
       <model name='pci-bridge'/>
       <target chassisNr='56'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
     </controller>
-    <controller type='usb' index='0' model='ich9-ehci1'/>
     <controller type='usb' index='0' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
+    </controller>
+    <controller type='usb' index='1' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x7'/>
     </controller>
-    <controller type='usb' index='1' model='ich9-ehci1'/>
     <controller type='usb' index='1' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='1' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x2'/>
     </controller>
     <controller type='usb' index='1' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x1'/>
+    </controller>
+    <controller type='usb' index='2' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x7'/>
     </controller>
-    <controller type='usb' index='2' model='ich9-ehci1'/>
     <controller type='usb' index='2' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x2'/>
     </controller>
     <controller type='usb' index='2' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x1'/>
     </controller>
     <controller type='usb' index='2' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0' multifunction='on'/>
+    </controller>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
     </controller>
-    <controller type='sata' index='0'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml
index 70024a0..19729cc 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml
@@ -22,26 +22,36 @@ 
     <controller type='pci' index='0' model='pcie-root'/>
     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
       <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
     </controller>
     <controller type='pci' index='2' model='pci-bridge'>
       <model name='pci-bridge'/>
       <target chassisNr='56'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
     </controller>
-    <controller type='usb' index='0' model='ich9-ehci1'/>
     <controller type='usb' index='0' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
+    </controller>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
     </controller>
-    <controller type='sata' index='0'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
index 053d5ed..19729cc 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
@@ -22,16 +22,36 @@ 
     <controller type='pci' index='0' model='pcie-root'/>
     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
       <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
     </controller>
     <controller type='pci' index='2' model='pci-bridge'>
       <model name='pci-bridge'/>
       <target chassisNr='56'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-uhci1'>
+      <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-uhci2'>
+      <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-uhci3'>
+      <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
+    </controller>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
     </controller>
-    <controller type='sata' index='0'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
       <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </video>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-qemu-ns-no-env.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-qemu-ns-no-env.xml
index 44c9064..4c2625e 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-qemu-ns-no-env.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-qemu-ns-no-env.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-disabled.xml
index 8fa2a7e..cffefd2 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-disabled.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-enabled.xml
index 92707f4..7cfd1de 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-enabled.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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/qemuxml2xmloutdata/qemuxml2xmlout-restore-v2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-restore-v2.xml
index 23fc792..71d312c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-restore-v2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-restore-v2.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml
index 54bb364..3f349b2 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml
@@ -14,7 +14,8 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-kvm</emulator>
-    <controller type='virtio-serial' index='0'/>
+    <controller type='virtio-serial' index='0'>
+    </controller>
     <console type='pty'>
       <target type='virtio' port='0'/>
     </console>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dac-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dac-none.xml
index ac42473..59aba42 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dac-none.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dac-none.xml
@@ -19,12 +19,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>
   <seclabel type='none' model='dac'/>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-device-multiple.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-device-multiple.xml
index 88ea2e0..db220f6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-device-multiple.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-device-multiple.xml
@@ -24,11 +24,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='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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-baselabel.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-baselabel.xml
index ec7b314..02d5fdb 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-baselabel.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-baselabel.xml
@@ -19,12 +19,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>
   <seclabel type='dynamic' model='selinux' relabel='yes'>
     <baselabel>system_u:system_r:svirt_custom_t:s0</baselabel>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-labelskip.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-labelskip.xml
index cc74b25..e85ac7a 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-labelskip.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-labelskip.xml
@@ -20,12 +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='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>
   <seclabel type='dynamic' model='selinux' relabel='yes'>
     <baselabel>system_u:system_r:svirt_custom_t:s0</baselabel>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none.xml
index 4872b91..225afd4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none.xml
@@ -19,12 +19,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>
   <seclabel type='none' model='none'/>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-override.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-override.xml
index ceab337..df736b9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-override.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-override.xml
@@ -31,12 +31,18 @@ 
       <readonly/>
       <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>
   <seclabel type='dynamic' model='selinux' relabel='yes'>
     <baselabel>system_u:system_r:svirt_custom_t:s0</baselabel>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-relabel.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-relabel.xml
index 4872b91..225afd4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-relabel.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-relabel.xml
@@ -19,12 +19,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>
   <seclabel type='none' model='none'/>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-none.xml
index 4872b91..225afd4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-none.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-none.xml
@@ -19,12 +19,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>
   <seclabel type='none' model='none'/>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
index b850af1..9bdc51c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
@@ -22,12 +22,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>
   <seclabel type='static' model='selinux' relabel='yes'>
     <label>system_u:system_r:svirt_custom_t:s0:c192,c392</label>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static.xml
index 32c83bd..a9755db 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static.xml
@@ -19,12 +19,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>
   <seclabel type='static' model='selinux' relabel='no'>
     <label>system_u:system_r:svirt_custom_t:s0:c192,c392</label>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-dev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-dev.xml
index aa03ab8..b65a2aa 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-dev.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-dev.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='dev'>
       <source path='/dev/ttyS2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-file.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-file.xml
index a7596ad..33d6133 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-file.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-file.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='file'>
       <source path='/tmp/serial.log'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-many.xml
index 75d77ad..cd3c792 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-many.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-many.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='pty'>
       <target port='0'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-pty.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-pty.xml
index 7be7259..434796c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-pty.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-pty.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='pty'>
       <target port='0'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml
index 970ef7f..463008d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <serial type='spiceport'>
       <source channel='org.qemu.console.serial.0'/>
@@ -32,6 +36,8 @@ 
     </console>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml
index 1127db1..5808960 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml
@@ -19,8 +19,12 @@ 
       <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'/>
     <serial type='spiceport'>
       <source channel='org.qemu.console.serial.0'/>
@@ -38,7 +42,10 @@ 
     </graphics>
     <video>
       <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml
index 55df65d..4206fbd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml
@@ -19,8 +19,12 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
     <serial type='pty'>
       <target port='0'/>
@@ -36,6 +40,8 @@ 
     </console>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-telnet.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-telnet.xml
index 48037bb..1fbfec9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-telnet.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-telnet.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='tcp'>
       <source mode='bind' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp.xml
index ba0c289..fa9aa34 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='tcp'>
       <source mode='connect' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-udp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-udp.xml
index 61661e7..b260b3b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-udp.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-udp.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='udp'>
       <source mode='bind' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-unix.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-unix.xml
index 6789e2d..15399eb 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-unix.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-unix.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='unix'>
       <source mode='connect' path='/tmp/serial.sock'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-vc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-vc.xml
index 69ce1ba..0b8f0cb 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-vc.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-vc.xml
@@ -20,8 +20,12 @@ 
       <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'/>
     <serial type='vc'>
       <target port='0'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
index 5bc4904..1197f36 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
@@ -14,14 +14,19 @@ 
   <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'/>
     <memballoon model='none'/>
-    <shmem name='shmem0'/>
+    <shmem name='shmem0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </shmem>
     <shmem name='shmem1'>
       <size unit='M'>128</size>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </shmem>
     <shmem name='shmem2'>
       <size unit='M'>256</size>
@@ -30,25 +35,30 @@ 
     <shmem name='shmem3'>
       <size unit='M'>512</size>
       <server/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </shmem>
     <shmem name='shmem4'>
       <size unit='M'>1024</size>
       <server path='/tmp/shmem4-sock'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
     </shmem>
     <shmem name='shmem5'>
       <size unit='M'>2048</size>
       <server path='/tmp/shmem5-sock'/>
       <msi ioeventfd='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
     </shmem>
     <shmem name='shmem6'>
       <size unit='M'>4096</size>
       <server path='/tmp/shmem6-sock'/>
       <msi vectors='16'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </shmem>
     <shmem name='shmem7'>
       <size unit='M'>8192</size>
       <server path='/tmp/shmem7-sock'/>
       <msi vectors='32' ioeventfd='on'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </shmem>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios-multiple-type2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios-multiple-type2.xml
index 60c4af2..e17c662 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios-multiple-type2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios-multiple-type2.xml
@@ -50,11 +50,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml
index 0fbb0a8..2eb56f5 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml
@@ -43,11 +43,17 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml
index 9ac578b..16cf0f0 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml
@@ -23,8 +23,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound-device.xml
index dbae994..f6dfea4 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound-device.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound-device.xml
@@ -19,26 +19,42 @@ 
       <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'/>
     <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='ich6'/>
+    <sound model='ac97'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </sound>
+    <sound model='ich6'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </sound>
     <sound model='ich6'>
       <codec type='micro'/>
       <codec type='duplex'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </sound>
+    <sound model='ich9'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
     </sound>
-    <sound model='ich9'/>
     <sound model='ich9'>
       <codec type='micro'/>
       <codec type='duplex'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
     </sound>
     <sound model='usb'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml
index ccffe4a..710106a 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-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='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'/>
     <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/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml
index 2f2a376..7341928 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml
@@ -16,22 +16,28 @@ 
   <on_crash>restart</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='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
-    <controller type='ide' index='0'/>
+    <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'/>
     <interface type='user'>
       <mac address='52:54:00:e5:48:58'/>
       <model type='definitely-not-virtio'/>
       <backend tap='/dev/null'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <interface type='user'>
       <mac address='52:54:00:e5:48:59'/>
       <model type='virtio'/>
       <driver name='vhost'/>
       <backend tap='/dev/null' vhost='/dev/zero'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </interface>
     <serial type='pty'>
       <target port='0'/>
@@ -41,6 +47,8 @@ 
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml
index 7d85fd8..67a9dbc 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml
@@ -29,17 +29,22 @@ 
       <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='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
-    <controller type='ide' index='0'/>
+    <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'/>
     <interface type='user'>
       <mac address='52:54:00:e5:48:58'/>
       <model type='virtio'/>
       <driver name='vhost' queues='5'/>
       <backend tap='/dev/null' vhost='/dev/zero'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <serial type='pty'>
       <target port='0'/>
@@ -49,6 +54,8 @@ 
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tpm-passthrough.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tpm-passthrough.xml
index 12ad8cf..bf79b0b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tpm-passthrough.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tpm-passthrough.xml
@@ -18,7 +18,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'/>
@@ -27,6 +29,8 @@ 
         <device path='/dev/tpm0'/>
       </backend>
     </tpm>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-ich9-ehci-addr.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-ich9-ehci-addr.xml
index 596f2e2..ea07479 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-ich9-ehci-addr.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-ich9-ehci-addr.xml
@@ -14,39 +14,56 @@ 
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <controller type='usb' index='0' model='ich9-ehci1'/>
+    <controller type='usb' index='0' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x7'/>
+    </controller>
     <controller type='usb' index='0' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x2'/>
     </controller>
     <controller type='usb' index='0' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x1'/>
+    </controller>
+    <controller type='usb' index='1' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
     </controller>
-    <controller type='usb' index='1' model='ich9-ehci1'/>
     <controller type='usb' index='1' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='1' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
     </controller>
     <controller type='usb' index='1' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
+    </controller>
+    <controller type='usb' index='2' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
     </controller>
-    <controller type='usb' index='2' model='ich9-ehci1'/>
     <controller type='usb' index='2' model='ich9-uhci1'>
       <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
     </controller>
     <controller type='usb' index='2' model='ich9-uhci3'>
       <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
     </controller>
     <controller type='usb' index='2' model='ich9-uhci2'>
       <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' 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='0x06' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter-version.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter-version.xml
index bdabe97..77ce72f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter-version.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter-version.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'/>
@@ -29,6 +31,8 @@ 
       <usbdev class='0x08' vendor='0x15E1' product='0x2007' version='9.40' allow='yes'/>
       <usbdev allow='no'/>
     </redirfilter>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter.xml
index 9b49581..bc8d86c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter.xml
@@ -42,6 +42,8 @@ 
       <usbdev class='0x08' vendor='0x15E1' product='0x2007' version='1.10' allow='yes'/>
       <usbdev allow='no'/>
     </redirfilter>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir.xml
index 4702697..8d180ad 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir.xml
@@ -39,6 +39,8 @@ 
     <redirdev bus='usb' type='spicevmc'>
       <address type='usb' bus='0' port='4'/>
     </redirdev>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
index 9cd00c0..c6471e3 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
@@ -27,9 +27,12 @@ 
     </controller>
     <controller type='pci' index='0' model='pcie-root'/>
     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
     </controller>
     <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
       <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
     </controller>
     <input type='mouse' bus='ps2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml
index 2355133..1e4fdd6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml
@@ -29,16 +29,21 @@ 
       <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='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
-    <controller type='ide' index='0'/>
+    <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'/>
     <interface type='user'>
       <mac address='52:54:00:e5:48:58'/>
       <model type='virtio'/>
       <driver name='vhost' queues='5'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <serial type='pty'>
       <target port='0'/>
@@ -48,6 +53,8 @@ 
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml
index e3d28bb..726c0d3 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml
@@ -20,14 +20,21 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
     <video>
       <model type='virtio' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml
index 47a93b1..3655a39 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml
@@ -20,8 +20,12 @@ 
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='ide' index='0'/>
-    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <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'/>
@@ -29,7 +33,10 @@ 
       <model type='virtio' heads='1'>
         <acceleration accel3d='yes'/>
       </model>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input-passthrough.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input-passthrough.xml
index 79270ab..66dc660 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input-passthrough.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input-passthrough.xml
@@ -14,13 +14,18 @@ 
   <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='passthrough' bus='virtio'>
       <source evdev='/dev/input/event1234'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </input>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input.xml
index 4f5e3e9..240b177 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input.xml
@@ -14,15 +14,23 @@ 
   <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='virtio'/>
+    <input type='mouse' bus='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </input>
     <input type='keyboard' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </input>
-    <input type='tablet' bus='virtio'/>
+    <input type='tablet' bus='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </input>
     <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>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-lun.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-lun.xml
index 63dbfda..2cfa734 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-lun.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-lun.xml
@@ -28,16 +28,21 @@ 
       <target dev='vdb' bus='virtio'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x05' 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='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </controller>
-    <controller type='ide' index='0'/>
+    <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'/>
     <interface type='user'>
       <mac address='52:54:00:e5:48:58'/>
       <model type='virtio'/>
       <driver name='vhost' event_idx='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>
     <serial type='pty'>
       <target port='0'/>
@@ -47,6 +52,8 @@ 
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-egd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-egd.xml
index 64a0eed..d9afcc5 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-egd.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-egd.xml
@@ -14,16 +14,21 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
     <rng model='virtio'>
       <backend model='egd' type='tcp'>
         <source mode='connect' host='1.2.3.4' service='1234'/>
         <protocol type='raw'/>
       </backend>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </rng>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml
index 71bd21a..e8a0478 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml
@@ -14,14 +14,19 @@ 
   <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'/>
-    <memballoon model='virtio'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
     <rng model='virtio'>
       <rate bytes='123' period='1234'/>
       <backend model='random'>/dev/hwrng</backend>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </rng>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-watchdog.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-watchdog.xml
index eb7ed99..fb8d037 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-watchdog.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-watchdog.xml
@@ -20,8 +20,12 @@ 
       <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'/>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index e3b61c0..a06aa4d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -37,13 +37,24 @@  struct testInfo {
 };
 
 static int
+qemuXML2XMLPreFormatCallback(virDomainDefPtr def, const void *opaque)
+{
+    const struct testInfo *info = opaque;
+
+    if (qemuDomainAssignAddresses(def, info->qemuCaps, NULL))
+        return -1;
+
+    return 0;
+}
+
+static int
 testXML2XMLActive(const void *opaque)
 {
     const struct testInfo *info = opaque;
 
     return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
                                       info->inName, info->outActiveName, true,
-                                      NULL, NULL);
+                                      qemuXML2XMLPreFormatCallback, opaque);
 }
 
 
@@ -54,7 +65,7 @@  testXML2XMLInactive(const void *opaque)
 
     return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->inName,
                                       info->outInactiveName, false,
-                                      NULL, NULL);
+                                      qemuXML2XMLPreFormatCallback, opaque);
 }
 
 
@@ -138,6 +149,9 @@  testCompareStatusXMLToXMLFiles(const void *opaque)
         goto cleanup;
     }
 
+    if (qemuDomainAssignAddresses(obj->def, data->qemuCaps, NULL))
+        goto cleanup;
+
     /* format it back */
     if (!(actual = virDomainObjFormat(driver.xmlopt, obj, NULL,
                                       VIR_DOMAIN_DEF_FORMAT_SECURE))) {
@@ -379,14 +393,28 @@  mymain(void)
     DO_TEST("disk-drive-network-rbd-ipv6");
     DO_TEST("disk-drive-network-rbd-ceph-env");
     DO_TEST("disk-drive-network-sheepdog");
-    DO_TEST("disk-scsi-device");
+    DO_TEST_FULL("disk-scsi-device", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_SCSI_LSI);
     DO_TEST("disk-scsi-vscsi");
-    DO_TEST("disk-scsi-virtio-scsi");
-    DO_TEST("disk-virtio-scsi-num_queues");
-    DO_TEST("disk-virtio-scsi-cmd_per_lun");
-    DO_TEST("disk-virtio-scsi-max_sectors");
-    DO_TEST("disk-virtio-scsi-ioeventfd");
-    DO_TEST("disk-scsi-megasas");
+    DO_TEST_FULL("disk-scsi-virtio-scsi", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST_FULL("disk-virtio-scsi-num_queues", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST_FULL("disk-virtio-scsi-cmd_per_lun", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST_FULL("disk-virtio-scsi-max_sectors", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST_FULL("disk-virtio-scsi-ioeventfd", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST_FULL("disk-scsi-megasas", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_SCSI_MEGASAS);
     DO_TEST("disk-mirror-old");
     DO_TEST_FULL("disk-mirror", WHEN_ACTIVE, NONE);
     DO_TEST_FULL("disk-mirror", WHEN_INACTIVE, NONE);
@@ -463,7 +491,8 @@  mymain(void)
     DO_TEST("cputune-iothreadsched");
     DO_TEST("cputune-iothreadsched-zeropriority");
     DO_TEST("cputune-numatune");
-    DO_TEST("vcpu-placement-static");
+    DO_TEST_FULL("vcpu-placement-static", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE);
 
     DO_TEST("smp");
     DO_TEST("iothreads");
@@ -471,7 +500,8 @@  mymain(void)
     DO_TEST("iothreads-ids-partial");
     DO_TEST("cputune-iothreads");
     DO_TEST("iothreads-disk");
-    DO_TEST("iothreads-disk-virtio-ccw");
+    DO_TEST_FULL("iothreads-disk-virtio-ccw", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
     DO_TEST("lease");
     DO_TEST("event_idx");
     DO_TEST("vhost_queues");
@@ -497,9 +527,15 @@  mymain(void)
     DO_TEST("seclabel-device-multiple");
     DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, NONE);
     DO_TEST("numad-static-vcpu-no-numatune");
-    DO_TEST("disk-scsi-lun-passthrough-sgio");
 
-    DO_TEST("disk-scsi-disk-vpd");
+    DO_TEST_FULL("disk-scsi-lun-passthrough-sgio", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI,
+            QEMU_CAPS_SCSI_DISK_WWN);
+    DO_TEST_FULL("disk-scsi-disk-vpd", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI,
+            QEMU_CAPS_SCSI_DISK_WWN);
     DO_TEST("disk-source-pool");
     DO_TEST("disk-source-pool-mode");
 
@@ -512,12 +548,13 @@  mymain(void)
     DO_TEST("pseries-panic-missing");
     DO_TEST("pseries-panic-no-address");
 
-    /* These tests generate different XML */
     DO_TEST("balloon-device-auto");
     DO_TEST("balloon-device-period");
     DO_TEST("channel-virtio-auto");
     DO_TEST("console-compat-auto");
-    DO_TEST("disk-scsi-device-auto");
+    DO_TEST_FULL("disk-scsi-device-auto", WHEN_ACTIVE,
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_SCSI_LSI);
     DO_TEST("console-virtio");
     DO_TEST("serial-target-port-auto");
     DO_TEST("graphics-listen-network2");
@@ -526,48 +563,133 @@  mymain(void)
     DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement");
     DO_TEST("numad-auto-memory-vcpu-cpuset");
     DO_TEST("usb-ich9-ehci-addr");
+    DO_TEST("disk-copy_on_read");
+    DO_TEST("tpm-passthrough");
 
     DO_TEST("metadata");
     DO_TEST("metadata-duplicate");
 
-    DO_TEST("tpm-passthrough");
-    DO_TEST("pci-bridge");
-    DO_TEST("pci-bridge-many-disks");
-    DO_TEST("pci-autoadd-addr");
-    DO_TEST("pci-autoadd-idx");
-    DO_TEST("pcie-root");
-    DO_TEST("q35");
-    DO_TEST("q35-usb2");
-    DO_TEST("q35-usb2-multi");
-    DO_TEST("q35-usb2-reorder");
-    DO_TEST("pcie-root-port");
-    DO_TEST("pcie-root-port-too-many");
-    DO_TEST("pcie-switch-upstream-port");
-    DO_TEST("pcie-switch-downstream-port");
-
-    DO_TEST("hostdev-scsi-lsi");
-    DO_TEST("hostdev-scsi-virtio-scsi");
-    DO_TEST("hostdev-scsi-readonly");
-
-    DO_TEST("disk-copy_on_read");
-    DO_TEST("hostdev-scsi-shareable");
-    DO_TEST("hostdev-scsi-sgio");
-    DO_TEST("hostdev-scsi-rawio");
-
-    DO_TEST("hostdev-scsi-autogen-address");
-    DO_TEST("hostdev-scsi-large-unit");
-
-    DO_TEST("hostdev-scsi-lsi-iscsi");
-    DO_TEST("hostdev-scsi-lsi-iscsi-auth");
-    DO_TEST("hostdev-scsi-virtio-iscsi");
-    DO_TEST("hostdev-scsi-virtio-iscsi-auth");
-
-    DO_TEST("s390-defaultconsole");
+    DO_TEST_FULL("pci-bridge", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE);
+    DO_TEST_FULL("pci-bridge-many-disks", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE);
+    DO_TEST_FULL("pci-autoadd-addr", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE);
+    DO_TEST_FULL("pci-autoadd-idx", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE);
+
+    DO_TEST_FULL("q35", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+    DO_TEST_FULL("q35-usb2", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+    DO_TEST_FULL("q35-usb2-multi", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+    DO_TEST_FULL("q35-usb2-reorder", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+
+    DO_TEST_FULL("pcie-root", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+    DO_TEST_FULL("pcie-root-port", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+    DO_TEST_FULL("pcie-switch-upstream-port", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+    DO_TEST_FULL("pcie-switch-downstream-port", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+
+
+    DO_TEST_FULL("hostdev-scsi-lsi", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+    DO_TEST_FULL("hostdev-scsi-virtio-scsi", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+    DO_TEST_FULL("hostdev-scsi-readonly", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+
+    DO_TEST_FULL("hostdev-scsi-shareable", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+    DO_TEST_FULL("hostdev-scsi-sgio", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+    DO_TEST_FULL("hostdev-scsi-rawio", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+
+    DO_TEST_FULL("hostdev-scsi-autogen-address", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+    DO_TEST_FULL("hostdev-scsi-large-unit", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+
+    DO_TEST_FULL("hostdev-scsi-lsi-iscsi", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+    DO_TEST_FULL("hostdev-scsi-lsi-iscsi-auth", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+    DO_TEST_FULL("hostdev-scsi-virtio-iscsi", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+    DO_TEST_FULL("hostdev-scsi-virtio-iscsi-auth", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
+
+    DO_TEST_FULL("s390-defaultconsole", WHEN_ACTIVE,
+            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
 
     DO_TEST("pcihole64");
     DO_TEST("pcihole64-gib");
     DO_TEST("pcihole64-none");
-    DO_TEST("pcihole64-q35");
+    DO_TEST_FULL("pcihole64-q35", WHEN_ACTIVE,
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL,
+            QEMU_CAPS_Q35_PCI_HOLE64_SIZE);
 
     DO_TEST("panic");
     DO_TEST("panic-isa");