diff mbox

[2/9] tests: qemuxml2xml: Always use different output file

Message ID 0f86c05da39e9bb08f97aaa905ce7cbaf8a8490b.1454011611.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson Jan. 28, 2016, 8:30 p.m. UTC
Most qemuxml2xml tests expect that the input XML is unchanged after
parsing. This is unlike 99% of new qemu configs in the wild, which after
initial parsing end up with stable PCI device addresses. The xml2xml bit
doesn't currently hit that code path though, so most XML testing indeed
does not change.

Future patches will add that PCI address bits, which means most test cases
will have different output. So let's do away with the hardcoded same vs
different test split, and always track a separate output file. Tests can
still have same input and output, it just necessitates 2 separate XML files.
---
 .../qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml   |  49 +++++
 .../qemuxml2xmlout-aarch64-gic.xml                 |  32 ++++
 .../qemuxml2xmlout-aarch64-gicv3.xml               |  32 ++++
 .../qemuxml2xmlout-bios-nvram.xml                  |  42 ++++
 .../qemuxml2xmlout-blkdeviotune.xml                |  45 +++++
 .../qemuxml2xmlout-blkiotune-device.xml            |  48 +++++
 .../qemuxml2xmlout-blkiotune.xml                   |  32 ++++
 .../qemuxml2xmlout-boot-cdrom.xml                  |  31 +++
 .../qemuxml2xmlout-boot-floppy.xml                 |  37 ++++
 .../qemuxml2xmlout-boot-menu-disable.xml           |  31 +++
 ...emuxml2xmlout-boot-menu-enable-with-timeout.xml |  31 +++
 .../qemuxml2xmlout-boot-multi.xml                  |  34 ++++
 .../qemuxml2xmlout-boot-network.xml                |  30 +++
 .../qemuxml2xmlout-boot-order.xml                  |  56 ++++++
 .../qemuxml2xmlout-channel-guestfwd.xml            |  33 ++++
 .../qemuxml2xmlout-channel-virtio.xml              |  36 ++++
 .../qemuxml2xmlout-chardev-label.xml               |  47 +++++
 .../qemuxml2xmlout-clock-catchup.xml               |  39 ++++
 .../qemuxml2xmlout-clock-localtime.xml             |  30 +++
 .../qemuxml2xmlout-clock-timer-hyperv-rtc.xml      |  28 +++
 .../qemuxml2xmlout-clock-utc.xml                   |  30 +++
 .../qemuxml2xmlout-console-compat.xml              |  36 ++++
 .../qemuxml2xmlout-console-virtio-many.xml         |  45 +++++
 .../qemuxml2xmlout-cpu-eoi-disabled.xml            |  31 +++
 .../qemuxml2xmlout-cpu-eoi-enabled.xml             |  31 +++
 .../qemuxml2xmlout-cpu-host-kvmclock.xml           |  26 +++
 .../qemuxml2xmlout-cpu-host-model-features.xml     |  35 ++++
 ...emuxml2xmlout-cpu-host-passthrough-features.xml |  39 ++++
 .../qemuxml2xmlout-cpu-kvmclock.xml                |  28 +++
 .../qemuxml2xmlout-cpu-numa-disjoint.xml           |  30 +++
 .../qemuxml2xmlout-cpu-numa-memshared.xml          |  30 +++
 ...l2xmlout-cputune-iothreadsched-zeropriority.xml |  40 ++++
 .../qemuxml2xmlout-cputune-numatune.xml            |  39 ++++
 .../qemuxml2xmlout-cputune-zero-shares.xml         |  37 ++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml  |  37 ++++
 .../qemuxml2xmlout-disk-active-commit.xml          |  39 ++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml |  37 ++++
 .../qemuxml2xmlout-disk-cdrom.xml                  |  37 ++++
 .../qemuxml2xmlout-disk-copy_on_read.xml           |  53 ++++++
 .../qemuxml2xmlout-disk-drive-copy-on-read.xml     |  30 +++
 .../qemuxml2xmlout-disk-drive-fat.xml              |  31 +++
 .../qemuxml2xmlout-disk-drive-fmt-qcow.xml         |  37 ++++
 ...emuxml2xmlout-disk-drive-network-iscsi-auth.xml |  40 ++++
 .../qemuxml2xmlout-disk-drive-network-iscsi.xml    |  37 ++++
 ...emuxml2xmlout-disk-drive-network-nbd-export.xml |  37 ++++
 ...l2xmlout-disk-drive-network-nbd-ipv6-export.xml |  37 ++++
 .../qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml |  37 ++++
 .../qemuxml2xmlout-disk-drive-network-nbd-unix.xml |  37 ++++
 .../qemuxml2xmlout-disk-drive-network-nbd.xml      |  37 ++++
 .../qemuxml2xmlout-disk-floppy.xml                 |  43 +++++
 .../qemuxml2xmlout-disk-many.xml                   |  48 +++++
 .../qemuxml2xmlout-disk-mirror-active.xml          |  58 ++++++
 ...xml => qemuxml2xmlout-disk-mirror-inactive.xml} |   0
 .../qemuxml2xmlout-disk-scsi-device.xml            |  35 ++++
 .../qemuxml2xmlout-disk-scsi-disk-vpd.xml          |  41 ++++
 ...muxml2xmlout-disk-scsi-lun-passthrough-sgio.xml |  35 ++++
 .../qemuxml2xmlout-disk-scsi-megasas.xml           |  35 ++++
 .../qemuxml2xmlout-disk-scsi-virtio-scsi.xml       |  35 ++++
 .../qemuxml2xmlout-disk-scsi-vscsi.xml             |  35 ++++
 .../qemuxml2xmlout-disk-source-pool-mode.xml       |  49 +++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-disk-usb.xml |  35 ++++
 ...qemuxml2xmlout-disk-virtio-scsi-cmd_per_lun.xml |  31 +++
 .../qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml  |  31 +++
 ...qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml |  31 +++
 .../qemuxml2xmlout-disk-virtio-scsi-num_queues.xml |  31 +++
 .../qemuxml2xmlout-disk-virtio.xml                 |  47 +++++
 .../qemuxml2xmlout-disk-xenvbd.xml                 |  47 +++++
 .../qemuxml2xmlout-encrypted-disk.xml              |  32 ++++
 .../qemuxml2xmlout-eoi-disabled.xml                |  28 +++
 .../qemuxml2xmlout-eoi-enabled.xml                 |  28 +++
 .../qemuxml2xmlout-event_idx.xml                   |  53 ++++++
 .../qemuxml2xmlout-floppy-drive-fat.xml            |  32 ++++
 .../qemuxml2xmlout-graphics-listen-network.xml     |  35 ++++
 .../qemuxml2xmlout-graphics-sdl-fullscreen.xml     |  34 ++++
 .../qemuxml2xmlout-graphics-sdl.xml                |  34 ++++
 .../qemuxml2xmlout-graphics-spice-compression.xml  |  43 +++++
 .../qemuxml2xmlout-graphics-spice-qxl-vga.xml      |  40 ++++
 .../qemuxml2xmlout-graphics-spice.xml              |  47 +++++
 .../qemuxml2xmlout-graphics-vnc-sasl.xml           |  36 ++++
 .../qemuxml2xmlout-graphics-vnc-tls.xml            |  36 ++++
 .../qemuxml2xmlout-graphics-vnc-websocket.xml      |  29 +++
 .../qemuxml2xmlout-graphics-vnc.xml                |  36 ++++
 .../qemuxml2xmlout-hostdev-pci-address.xml         |  35 ++++
 .../qemuxml2xmlout-hostdev-scsi-large-unit.xml     |  37 ++++
 .../qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml |  48 +++++
 .../qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml      |  42 ++++
 .../qemuxml2xmlout-hostdev-scsi-lsi.xml            |  37 ++++
 .../qemuxml2xmlout-hostdev-scsi-rawio.xml          |  37 ++++
 .../qemuxml2xmlout-hostdev-scsi-readonly.xml       |  38 ++++
 .../qemuxml2xmlout-hostdev-scsi-sgio.xml           |  37 ++++
 .../qemuxml2xmlout-hostdev-scsi-shareable.xml      |  38 ++++
 ...muxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml |  48 +++++
 .../qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml   |  42 ++++
 .../qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml    |  37 ++++
 .../qemuxml2xmlout-hostdev-usb-address.xml         |  35 ++++
 .../qemuxml2xmlout-hostdev-vfio.xml                |  35 ++++
 .../qemuxml2xmlout-hugepages-pages.xml             |  47 +++++
 .../qemuxml2xmlout-hugepages-pages2.xml            |  40 ++++
 .../qemuxml2xmlout-hugepages-pages3.xml            |  40 ++++
 .../qemuxml2xmlout-hugepages-shared.xml            |  47 +++++
 .../qemuxml2xmlout-hugepages.xml                   |  32 ++++
 .../qemuxml2xmlout-hyperv-off.xml                  |  31 +++
 .../qemuxml2xmlout-hyperv-panic.xml                |  27 +++
 tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml |  31 +++
 .../qemuxml2xmlout-input-usbmouse.xml              |  31 +++
 .../qemuxml2xmlout-input-usbtablet.xml             |  31 +++
 .../qemuxml2xmlout-interface-driver.xml            |  54 ++++++
 .../qemuxml2xmlout-interface-server.xml            | 134 +++++++++++++
 .../qemuxml2xmlout-iothreads-disk-virtio-ccw.xml   |  34 ++++
 .../qemuxml2xmlout-iothreads-disk.xml              |  42 ++++
 .../qemuxml2xmlout-iothreads-ids-partial.xml       |  35 ++++
 .../qemuxml2xmlout-iothreads-ids.xml               |  35 ++++
 .../qemuxml2xmlout-iothreads.xml                   |  31 +++
 .../qemuxml2xmlout-kvm-features-off.xml            |  29 +++
 .../qemuxml2xmlout-kvm-features.xml                |  29 +++
 .../qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml |  28 +++
 tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml  |  40 ++++
 .../qemuxml2xmlout-machine-core-off.xml            |  30 +++
 .../qemuxml2xmlout-machine-core-on.xml             |  30 +++
 .../qemuxml2xmlout-memory-hotplug-dimm.xml         |  56 ++++++
 .../qemuxml2xmlout-memory-hotplug-nonuma.xml       |  24 +++
 .../qemuxml2xmlout-memory-hotplug.xml              |  36 ++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml  |  34 ++++
 .../qemuxml2xmlout-misc-acpi.xml                   |  33 ++++
 .../qemuxml2xmlout-misc-disable-s3.xml             |  33 ++++
 .../qemuxml2xmlout-misc-disable-suspends.xml       |  34 ++++
 .../qemuxml2xmlout-misc-enable-s4.xml              |  33 ++++
 .../qemuxml2xmlout-misc-no-reboot.xml              |  30 +++
 .../qemuxml2xmlout-net-bandwidth.xml               |  76 ++++++++
 .../qemuxml2xmlout-net-bandwidth2.xml              |  65 +++++++
 .../qemuxml2xmlout-net-eth-ifname.xml              |  36 ++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml  |  35 ++++
 .../qemuxml2xmlout-net-hostdev-vfio.xml            |  43 +++++
 .../qemuxml2xmlout-net-hostdev.xml                 |  42 ++++
 .../qemuxml2xmlout-net-midonet.xml                 |  37 ++++
 .../qemuxml2xmlout-net-openvswitch.xml             |  42 ++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml  |  36 ++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml |  34 ++++
 .../qemuxml2xmlout-net-vhostuser.xml               |  45 +++++
 .../qemuxml2xmlout-net-virtio-device.xml           |  34 ++++
 .../qemuxml2xmlout-net-virtio-disable-offloads.xml |  37 ++++
 ...qemuxml2xmlout-net-virtio-network-portgroup.xml |  56 ++++++
 .../qemuxml2xmlout-net-virtio.xml                  |  34 ++++
 .../qemuxml2xmlout-nosharepages.xml                |  33 ++++
 ...emuxml2xmlout-numad-static-vcpu-no-numatune.xml |  32 ++++
 .../qemuxml2xmlout-numatune-memnode-no-memory.xml  |  32 ++++
 .../qemuxml2xmlout-panic-double.xml                |  30 +++
 .../qemuxml2xmlout-panic-isa.xml                   |  33 ++++
 .../qemuxml2xmlout-panic-no-address.xml            |  31 +++
 .../qemuxml2xmlout-panic-pseries.xml               |  30 +++
 .../qemuxml2xmlout-parallel-tcp.xml                |  35 ++++
 .../qemuxml2xmlout-pci-bridge.xml                  | 211 +++++++++++++++++++++
 .../qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml  |  51 +++++
 .../qemuxml2xmlout-pci-serial-dev-chardev.xml      |  39 ++++
 .../qemuxml2xmlout-pcie-root-port-too-many.xml     |  62 ++++++
 .../qemuxml2xmlout-pcie-root-port.xml              |  38 ++++
 .../qemuxml2xmlout-pcie-switch-downstream-port.xml |  46 +++++
 .../qemuxml2xmlout-pcie-switch-upstream-port.xml   |  39 ++++
 .../qemuxml2xmlout-pcihole64-none.xml              |  25 +++
 .../qemuxml2xmlout-pcihole64-q35.xml               |  35 ++++
 .../qemuxml2xmlout-pcihole64.xml                   |  25 +++
 .../qemuxml2xmlout-pmu-feature-off.xml             |  27 +++
 .../qemuxml2xmlout-pseries-nvram.xml               |  25 +++
 .../qemuxml2xmlout-pv-spinlock-disabled.xml        |  28 +++
 .../qemuxml2xmlout-pv-spinlock-enabled.xml         |  28 +++
 .../qemuxml2xmlout-reboot-timeout-disabled.xml     |  24 +++
 .../qemuxml2xmlout-reboot-timeout-enabled.xml      |  24 +++
 .../qemuxml2xmlout-seclabel-dac-none.xml           |  30 +++
 .../qemuxml2xmlout-seclabel-device-multiple.xml    |  34 ++++
 .../qemuxml2xmlout-seclabel-dynamic-baselabel.xml  |  32 ++++
 .../qemuxml2xmlout-seclabel-dynamic-none.xml       |  30 +++
 .../qemuxml2xmlout-seclabel-dynamic-override.xml   |  44 +++++
 .../qemuxml2xmlout-seclabel-static-labelskip.xml   |  36 ++++
 .../qemuxml2xmlout-seclabel-static.xml             |  32 ++++
 .../qemuxml2xmlout-serial-dev.xml                  |  38 ++++
 .../qemuxml2xmlout-serial-file.xml                 |  38 ++++
 .../qemuxml2xmlout-serial-many.xml                 |  40 ++++
 .../qemuxml2xmlout-serial-pty.xml                  |  36 ++++
 .../qemuxml2xmlout-serial-spiceport-nospice.xml    |  37 ++++
 .../qemuxml2xmlout-serial-spiceport.xml            |  44 +++++
 .../qemuxml2xmlout-serial-tcp-telnet.xml           |  40 ++++
 .../qemuxml2xmlout-serial-tcp.xml                  |  40 ++++
 .../qemuxml2xmlout-serial-udp.xml                  |  44 +++++
 .../qemuxml2xmlout-serial-unix.xml                 |  38 ++++
 .../qemuxml2xmlout-serial-vc.xml                   |  36 ++++
 tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml  |  54 ++++++
 .../qemuxml2xmlout-smbios-multiple-type2.xml       |  60 ++++++
 tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml |  53 ++++++
 tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml    |  33 ++++
 .../qemuxml2xmlout-sound-device.xml                |  44 +++++
 tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml  |  34 ++++
 .../qemuxml2xmlout-tap-vhost.xml                   |  54 ++++++
 .../qemuxml2xmlout-tpm-passthrough.xml             |  32 ++++
 .../qemuxml2xmlout-usb-redir.xml                   |  44 +++++
 .../qemuxml2xmlout-vcpu-placement-static.xml       |  39 ++++
 .../qemuxml2xmlout-vhost_queues.xml                |  53 ++++++
 .../qemuxml2xmlout-video-virtio-gpu-device.xml     |  33 ++++
 .../qemuxml2xmlout-video-virtio-gpu-virgl.xml      |  35 ++++
 .../qemuxml2xmlout-virtio-input-passthrough.xml    |  26 +++
 .../qemuxml2xmlout-virtio-input.xml                |  28 +++
 .../qemuxml2xmlout-virtio-lun.xml                  |  52 +++++
 .../qemuxml2xmlout-virtio-rng-egd.xml              |  29 +++
 .../qemuxml2xmlout-virtio-rng-random.xml           |  27 +++
 tests/qemuxml2xmltest.c                            | 189 +++++++++---------
 204 files changed, 7881 insertions(+), 102 deletions(-)
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gicv3.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-blkdeviotune.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune-device.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-cdrom.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-floppy.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-enable-with-timeout.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-multi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-network.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-order.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-guestfwd.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-catchup.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-localtime.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-timer-hyperv-rtc.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-utc.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-disabled.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-enabled.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-kvmclock.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-model-features.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-passthrough-features.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-kvmclock.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disjoint.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-memshared.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-zero-shares.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-copy_on_read.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-copy-on-read.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fat.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fmt-qcow.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi-auth.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-export.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6-export.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-unix.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-floppy.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-many.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
 rename tests/qemuxml2xmloutdata/{qemuxml2xmlout-disk-mirror.xml => qemuxml2xmlout-disk-mirror-inactive.xml} (100%)
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-lun-passthrough-sgio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-megasas.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-virtio-scsi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool-mode.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-usb.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-cmd_per_lun.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-num_queues.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-xenvbd.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-encrypted-disk.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-disabled.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-enabled.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-event_idx.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-floppy-drive-fat.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-pci-address.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-large-unit.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-rawio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-readonly.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-sgio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-shareable.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-usb-address.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-vfio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages2.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages3.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-shared.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-off.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-panic.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbmouse.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbtablet.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features-off.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-off.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-on.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-dimm.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nonuma.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-acpi.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-s3.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-suspends.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-enable-s4.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-no-reboot.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-ifname.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev-vfio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-midonet.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-openvswitch.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-vhostuser.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-device.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-disable-offloads.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-network-portgroup.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-nosharepages.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-static-vcpu-no-numatune.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode-no-memory.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-double.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-isa.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-no-address.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-parallel-tcp.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-too-many.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-none.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature-off.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-disabled.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-enabled.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-disabled.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-enabled.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dac-none.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-device-multiple.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-baselabel.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-override.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-dev.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-file.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-many.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-pty.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-telnet.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-udp.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-unix.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-vc.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios-multiple-type2.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-sound-device.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-tpm-passthrough.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input-passthrough.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-lun.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-egd.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml

-- 
2.5.0

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

Comments

Cole Robinson Feb. 5, 2016, 8:37 p.m. UTC | #1
On 02/05/2016 02:24 PM, Laine Stump wrote:
> On 01/28/2016 03:30 PM, Cole Robinson wrote:

>> Most qemuxml2xml tests expect that the input XML is unchanged after

>> parsing. This is unlike 99% of new qemu configs in the wild, which after

>> initial parsing end up with stable PCI device addresses. The xml2xml bit

>> doesn't currently hit that code path though, so most XML testing indeed

>> does not change.

>>

>> Future patches will add that PCI address bits, which means most test cases

>> will have different output. So let's do away with the hardcoded same vs

>> different test split, and always track a separate output file. Tests can

>> still have same input and output, it just necessitates 2 separate XML files.

>> ---

>>   .../qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml   |  49 +++++

> 

> If there's going to be a ton of new files added anyway, this is a good chance

> to shorten the names of all the files (and avoid needing to do it to so many

> more files later). I've always thought it was pointless to have a file called

> 

>    qemuxml2xmloutdata/qemuxml2xmlout-blah.xml

> 

> why not just:

> 

>    qemuxml2xmloutdata/blah.xml

> 

> ?? I recall there being problems with running make rpm (or maybe make

> distcheck?) because some filename in one of these directories was beyond the

> tarfile name length limit or something like that.

> 


Yes I agree. But I don't want to get bogged down in this discussion. After
these patches are resolved I'll start a thread to discuss it, since we should
just do it for all test cases in one go IMO.

> I went back and read Martin's opinion about adding all these files, and your

> response. It's true that we aren't *explicitly* testing the PCI address

> assignment directly in the xml2xml tests now. It does end up being tested in

> the xml2argvtests though (except for devices that are at fixed PCI addresses

> which don't show up on the qemu commandline, e.g.  builtin IDE controller in

> 440fx or builtin SATA on q35). Of course it would be a lot easier to see

> what's going on if the XML files could be compared, rather than trying to

> compare qemu commandlines and backtracking to find the offending device in the

> XML :-)

> 

> Do you know what percentage of these files end up being different between

> source and result after all your changes are done? If it's all/most of them,

> then I think it would be a lot of extra effort for no gain to setup symbolic

> links now only to have them broken a few commits later.

> 


Patch 8 touches 283 xml2xmlout files. There's 290 total. Basically any test
case with a device is going to be affected.

> (A bit of thinking out loud follows...)

> 

> Anyway, even once we add the PCI address assignment into the qemuxml2xmltest,

> we still may have a considerable number of tests that have the PCI address in

> the source xml already anyway. Also, I think too many of the tests have been

> created with the following formula:

> 

> 1) copy testfiles for some random existing test

> 2) add on a line or two that tests the new feature

> 

> This has the upside of testing combinations of items that might not otherwise

> be tested, but there's nothing methodical about it, and we're ending up

> testing the same bits hundreds of times in exactly the same way. *AND* (the

> most important) if something is purposefully changed in one of those bits that

> is unnecessarily copied to a couple hundred tests (e.g. the output now has a

> PCI address in the element), then that change must be accompanied by changes

> to hundreds of test output files.

> 

> It might be useful to eliminate a bunch of this duplication of tests. But of

> course that would be *very* tedious, and the potential for accidentally

> removing a useful and unique combination would be high (especially if we fell

> to the temptation of letting a newcomer do such a trimming as a "starter"

> project).

> 


Completely agreed, I alluded to this elsewhere. The test suite has massive
redundancy.

It's not hard to track what tests are actually hitting though, using gcov for
tracking code coverage. I just don't think anyone is really checking up on it.
This is something I'd like to look at and better document in the future, I
think test suite improvements could be a good source of bitesize/easyfix type
tasks.

> (anyway...)

> 

> It would be nice if we could move all the tests that are there merely for

> checking genericxml2xml over to that test in advance of this change in order

> to reduce the churn, but I understand your reluctance to do that - it will

> involve a lot more subjective decisions about what was the purpose of various

> test cases (and for some of those the only clue you may have is the name of

> the data file), so it seems like a large annoying bookkeeping job when what

> you really need is to make ARM work correctly :-)

> 


FWIW I like large annoying bookkeeping jobs :) But yeah I need to get 'Real
Work' done in the meantime. As you've pointed out there's lots of areas we can
improve in the test suite I'm trying to not get fully sucked down the rabbit
hole just yet. I do want to come back to it though

> Since we already have hundreds of test files, and this seems to be moving in

> the right direction (although taking a nasty side-step), I'm inclined to ACK

> this patch. We should maybe put it to some kind of informal vote, though, just

> to make sure everyone's concerns are properly addressed (and maybe someone

> will come up with a bright idea)


Thanks, I agree another ACK is a good idea.

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Cole Robinson Feb. 9, 2016, 3:33 p.m. UTC | #2
On 02/08/2016 10:27 AM, Martin Kletzander wrote:
> 

> I didn't mean to stall this series.  I'm fine with this going in,

> especially if we clean it up afterwards.

> 


No worries, the bits you raised are valid concerns.

> So if you also copy the missing files, of course (current list of test

> names for easier work and checking provided below), I can safely say ACK

> here.

> 

> Martin

> 

> disk-cdrom-empty

> disk-drive-boot-cdrom

> disk-drive-boot-disk

> disk-drive-cache-directsync

> disk-drive-cache-unsafe

> disk-drive-cache-v2-none

> disk-drive-cache-v2-wb

> disk-drive-cache-v2-wt

> disk-drive-error-policy-enospace

> disk-drive-error-policy-stop

> disk-drive-error-policy-wreport-rignore

> disk-drive-network-gluster

> disk-drive-network-rbd-auth

> disk-drive-network-rbd-ceph-env

> disk-drive-network-rbd-ipv6

> disk-drive-network-rbd

> disk-drive-network-sheepdog

> migrate

> misc-uuid

> nographics-vga

> qemu-ns-no-env

> restore-v2

> watchdog


Thanks for the ACK, I fixed this locally and pushed.

- Cole

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

Patch

diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml
new file mode 100644
index 0000000..4a31c8b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml
@@ -0,0 +1,49 @@ 
+<domain type='qemu'>
+  <name>aarch64test</name>
+  <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <kernel>/aarch64.kernel</kernel>
+    <initrd>/aarch64.initrd</initrd>
+    <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
+    <dtb>/aarch64.dtb</dtb>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <cpu mode='custom' match='exact'>
+    <model fallback='allow'>cortex-a53</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <disk type='file' device='disk'>
+      <source file='/aarch64.raw'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='virtio-mmio'/>
+    </disk>
+    <controller type='virtio-serial' index='0'/>
+    <interface type='user'>
+      <mac address='52:54:00:09:a4:37'/>
+      <model type='virtio'/>
+    </interface>
+    <console type='pty'>
+      <target type='virtio' port='0'/>
+    </console>
+    <memballoon model='virtio'>
+      <address type='virtio-mmio'/>
+    </memballoon>
+    <rng model='virtio'>
+      <backend model='random'>/dev/random</backend>
+    </rng>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic.xml
new file mode 100644
index 0000000..cb595e4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>aarch64test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <kernel>/aarch64.kernel</kernel>
+    <initrd>/aarch64.initrd</initrd>
+    <cmdline>console=ttyAMA0</cmdline>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <gic version='2'/>
+  </features>
+  <cpu mode='custom' match='exact'>
+    <model fallback='allow'>cortex-a53</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <interface type='user'>
+      <mac address='52:54:00:09:a4:37'/>
+      <model type='virtio'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gicv3.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gicv3.xml
new file mode 100644
index 0000000..72aaaf7
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gicv3.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>aarch64test</name>
+  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <kernel>/aarch64.kernel</kernel>
+    <initrd>/aarch64.initrd</initrd>
+    <cmdline>console=ttyAMA0</cmdline>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <gic version='3'/>
+  </features>
+  <cpu mode='custom' match='exact'>
+    <model fallback='allow'>cortex-a53</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <interface type='user'>
+      <mac address='52:54:00:09:a4:37'/>
+      <model type='virtio'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram.xml
new file mode 100644
index 0000000..0eee88c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram.xml
@@ -0,0 +1,42 @@ 
+<domain type='qemu'>
+  <name>test-bios</name>
+  <uuid>362d1fc1-df7d-193e-5c18-49a71bd1da66</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
+    <nvram>/usr/share/OVMF/OVMF_VARS.fd</nvram>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='tablet' bus='usb'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkdeviotune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkdeviotune.xml
new file mode 100644
index 0000000..1e1c0e5
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkdeviotune.xml
@@ -0,0 +1,45 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <iotune>
+        <total_bytes_sec>5000</total_bytes_sec>
+        <total_iops_sec>6000</total_iops_sec>
+      </iotune>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdb' bus='ide'/>
+      <iotune>
+        <read_bytes_sec>5000</read_bytes_sec>
+        <write_bytes_sec>5000</write_bytes_sec>
+        <total_iops_sec>7000</total_iops_sec>
+      </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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune-device.xml
new file mode 100644
index 0000000..3b8080d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune-device.xml
@@ -0,0 +1,48 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <blkiotune>
+    <weight>800</weight>
+    <device>
+      <path>/dev/sda</path>
+      <weight>400</weight>
+      <read_iops_sec>10000</read_iops_sec>
+      <write_iops_sec>10000</write_iops_sec>
+      <read_bytes_sec>10000</read_bytes_sec>
+      <write_bytes_sec>10000</write_bytes_sec>
+    </device>
+    <device>
+      <path>/dev/sdb</path>
+      <weight>900</weight>
+      <read_iops_sec>20000</read_iops_sec>
+      <write_iops_sec>20000</write_iops_sec>
+      <read_bytes_sec>20000</read_bytes_sec>
+      <write_bytes_sec>20000</write_bytes_sec>
+    </device>
+  </blkiotune>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune.xml
new file mode 100644
index 0000000..f7efcb9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-blkiotune.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <blkiotune>
+    <weight>800</weight>
+  </blkiotune>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-cdrom.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-cdrom.xml
new file mode 100644
index 0000000..9c0e667
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-cdrom.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='cdrom'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-floppy.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-floppy.xml
new file mode 100644
index 0000000..390bc67
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-floppy.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='fd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='floppy'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/firmware.img'/>
+      <target dev='fda' bus='fdc'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='fdc' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable.xml
new file mode 100644
index 0000000..8727c18
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-disable.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='cdrom'/>
+    <bootmenu enable='no'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='cdrom'>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-enable-with-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-enable-with-timeout.xml
new file mode 100644
index 0000000..82e366c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-menu-enable-with-timeout.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='cdrom'/>
+    <bootmenu enable='yes' timeout='3000'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='cdrom'>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-multi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-multi.xml
new file mode 100644
index 0000000..5e029bd
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-multi.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <boot dev='network'/>
+    <boot dev='fd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='cdrom'>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-network.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-network.xml
new file mode 100644
index 0000000..ad421da
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-network.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-order.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-order.xml
new file mode 100644
index 0000000..4a6fbd4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-boot-order.xml
@@ -0,0 +1,56 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <source file='/root/boot.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <boot order='1'/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='sheepdog' name='image'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+      <boot order='3'/>
+    </disk>
+    <disk type='file' device='floppy'>
+      <driver name='qemu' type='raw'/>
+      <source file='/dev/null'/>
+      <target dev='fdb' bus='fdc'/>
+      <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='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'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-guestfwd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-guestfwd.xml
new file mode 100644
index 0000000..b5e5c23
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-guestfwd.xml
@@ -0,0 +1,33 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <channel type='pipe'>
+      <source path='/tmp/guestfwd'/>
+      <target type='guestfwd' address='10.0.2.1' port='4600'/>
+    </channel>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio.xml
new file mode 100644
index 0000000..4ca270d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.foo'/>
+      <address type='virtio-serial' controller='1' bus='0' port='3'/>
+    </channel>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml
new file mode 100644
index 0000000..09094af
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml
@@ -0,0 +1,47 @@ 
+<domain type='qemu'>
+  <name>machine</name>
+  <uuid>2187c512-ff97-47d7-b67c-c02d3bdc219d</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <serial type='file'>
+      <source path='/tmp/serial.file'>
+        <seclabel model='dac' relabel='no'/>
+      </source>
+      <target port='0'/>
+    </serial>
+    <serial type='unix'>
+      <source mode='connect' path='/tmp/serial.sock'>
+        <seclabel model='dac' relabel='no'/>
+      </source>
+      <target port='1'/>
+    </serial>
+    <console type='file'>
+      <source path='/tmp/serial.file'>
+        <seclabel model='dac' relabel='no'/>
+      </source>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+    <rng model='virtio'>
+      <backend model='egd' type='pipe'>
+        <source path='/dev/null'/>
+      </backend>
+    </rng>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-catchup.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-catchup.xml
new file mode 100644
index 0000000..1fe968b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-catchup.xml
@@ -0,0 +1,39 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'>
+    <timer name='rtc' tickpolicy='catchup'>
+      <catchup slew='4636'/>
+    </timer>
+    <timer name='pit' tickpolicy='catchup'>
+      <catchup threshold='123'/>
+    </timer>
+    <timer name='hpet' tickpolicy='catchup'>
+      <catchup limit='2342'/>
+    </timer>
+  </clock>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-localtime.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-localtime.xml
new file mode 100644
index 0000000..642d276
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-localtime.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='localtime'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-timer-hyperv-rtc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-timer-hyperv-rtc.xml
new file mode 100644
index 0000000..c54af6a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-timer-hyperv-rtc.xml
@@ -0,0 +1,28 @@ 
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <pae/>
+  </features>
+  <clock offset='utc'>
+    <timer name='hypervclock' present='yes'/>
+  </clock>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/kvm</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-utc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-utc.xml
new file mode 100644
index 0000000..9da4df0
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-clock-utc.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml
new file mode 100644
index 0000000..3eaeffa
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml
new file mode 100644
index 0000000..31d2793
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml
@@ -0,0 +1,45 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <console type='pty'>
+      <target type='virtio' port='1'/>
+    </console>
+    <console type='pty'>
+      <target type='virtio' port='2'/>
+    </console>
+    <console type='pty'>
+      <target type='virtio' port='3'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-disabled.xml
new file mode 100644
index 0000000..59d50d3
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-disabled.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic eoi='off'/>
+    <pae/>
+  </features>
+  <cpu mode='custom' match='exact'>
+    <model fallback='allow'>qemu32</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-enabled.xml
new file mode 100644
index 0000000..c2c494b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-eoi-enabled.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic eoi='on'/>
+    <pae/>
+  </features>
+  <cpu mode='custom' match='exact'>
+    <model fallback='allow'>qemu32</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-kvmclock.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-kvmclock.xml
new file mode 100644
index 0000000..98689f3
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-kvmclock.xml
@@ -0,0 +1,26 @@ 
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu mode='host-passthrough'/>
+  <clock offset='utc'>
+    <timer name='kvmclock' present='no'/>
+  </clock>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-model-features.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-model-features.xml
new file mode 100644
index 0000000..530cc9a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-model-features.xml
@@ -0,0 +1,35 @@ 
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <title>A description of the test machine.</title>
+  <description>
+      A test of qemu&apos;s minimal configuration.
+      This test also tests the description and title elements.
+  </description>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='host-model'>
+    <model fallback='allow'/>
+    <feature policy='require' name='abm'/>
+    <feature policy='force' name='ds'/>
+    <feature policy='disable' name='invtsc'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-passthrough-features.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-passthrough-features.xml
new file mode 100644
index 0000000..fceb6a6
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-host-passthrough-features.xml
@@ -0,0 +1,39 @@ 
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <title>A description of the test machine.</title>
+  <description>
+      A test of qemu&apos;s minimal configuration.
+      This test also tests the description and title elements.
+  </description>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='host-passthrough'>
+    <feature policy='require' name='abm'/>
+    <feature policy='force' name='ds'/>
+    <feature policy='disable' name='invtsc'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-kvmclock.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-kvmclock.xml
new file mode 100644
index 0000000..003a1ed
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-kvmclock.xml
@@ -0,0 +1,28 @@ 
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu mode='custom' match='exact'>
+    <model fallback='allow'>core2duo</model>
+  </cpu>
+  <clock offset='utc'>
+    <timer name='kvmclock' present='no'/>
+  </clock>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disjoint.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disjoint.xml
new file mode 100644
index 0000000..08662d0
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-disjoint.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>16</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets='2' cores='4' threads='2'/>
+    <numa>
+      <cell id='0' cpus='0-3,8-11' memory='109550' unit='KiB'/>
+      <cell id='1' cpus='4-7,12-15' memory='109550' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-memshared.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-memshared.xml
new file mode 100644
index 0000000..244a615
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-memshared.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>16</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets='2' cores='4' threads='2'/>
+    <numa>
+      <cell id='0' cpus='0-7' memory='109550' unit='KiB' memAccess='shared'/>
+      <cell id='1' cpus='8-15' memory='109550' unit='KiB' memAccess='private'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
new file mode 100644
index 0000000..47580c9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <iothreads>4</iothreads>
+  <cputune>
+    <shares>2048</shares>
+    <period>1000000</period>
+    <quota>-1</quota>
+    <vcpupin vcpu='0' cpuset='0'/>
+    <vcpupin vcpu='1' cpuset='1'/>
+    <emulatorpin cpuset='1'/>
+    <vcpusched vcpus='0-1' scheduler='fifo' priority='0'/>
+    <iothreadsched iothreads='1-3' scheduler='rr' priority='0'/>
+  </cputune>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
new file mode 100644
index 0000000..855e084
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
@@ -0,0 +1,39 @@ 
+<domain type='kvm'>
+  <name>dummy2</name>
+  <uuid>4d92ec27-9ebf-400b-ae91-20c71c647c19</uuid>
+  <memory unit='KiB'>131072</memory>
+  <currentMemory unit='KiB'>65536</currentMemory>
+  <vcpu placement='auto' current='2'>6</vcpu>
+  <iothreads>2</iothreads>
+  <cputune>
+    <emulatorpin cpuset='1-3'/>
+    <iothreadpin iothread='1' cpuset='2'/>
+  </cputune>
+  <numatune>
+    <memory mode='strict' placement='auto'/>
+  </numatune>
+  <os>
+    <type arch='x86_64' machine='pc-q35-2.3'>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/bin/qemu-system-x86_64</emulator>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <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'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-zero-shares.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-zero-shares.xml
new file mode 100644
index 0000000..1e7f3bc
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-zero-shares.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <cputune>
+    <shares>0</shares>
+    <period>1000000</period>
+    <quota>-1</quota>
+    <vcpupin vcpu='0' cpuset='0'/>
+    <vcpupin vcpu='1' cpuset='1'/>
+    <emulatorpin cpuset='1'/>
+  </cputune>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml
new file mode 100644
index 0000000..951fef9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <cputune>
+    <shares>2048</shares>
+    <period>1000000</period>
+    <quota>-1</quota>
+    <vcpupin vcpu='0' cpuset='0'/>
+    <vcpupin vcpu='1' cpuset='1'/>
+    <emulatorpin cpuset='1'/>
+  </cputune>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
new file mode 100644
index 0000000..7889248
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
@@ -0,0 +1,39 @@ 
+<domain type='qemu' id='1'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source file='/tmp/HostVG/QEMUGuest1-snap'/>
+      <backingStore type='block' index='1'>
+        <format type='raw'/>
+        <source dev='/dev/HostVG/QEMUGuest1'/>
+        <backingStore/>
+      </backingStore>
+      <mirror type='block' job='active-commit'>
+        <format type='raw'/>
+        <source dev='/dev/HostVG/QEMUGuest1'/>
+      </mirror>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml
new file mode 100644
index 0000000..bbf5d55
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-aio.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none' io='native'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw' io='threads'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom.xml
new file mode 100644
index 0000000..04f4976
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source file='/root/boot.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-copy_on_read.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-copy_on_read.xml
new file mode 100644
index 0000000..9c40895
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-copy_on_read.xml
@@ -0,0 +1,53 @@ 
+<domain type='qemu'>
+  <name>test</name>
+  <uuid>468404ad-d49c-40f2-9e14-02294f9c1be3</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.13'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' copy_on_read='on'/>
+      <source file='/var/lib/libvirt/images/f14.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <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='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'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-copy-on-read.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-copy-on-read.xml
new file mode 100644
index 0000000..4e33edf
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-copy-on-read.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver copy_on_read='on'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fat.xml
new file mode 100644
index 0000000..b0d8bdc
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fat.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='dir' device='disk'>
+      <driver name='qemu' type='fat'/>
+      <source dir='/var/somefiles'/>
+      <target dev='hda' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fmt-qcow.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fmt-qcow.xml
new file mode 100644
index 0000000..d3fdab4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-fmt-qcow.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi-auth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi-auth.xml
new file mode 100644
index 0000000..5ac4abf
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi-auth.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <auth username='myname'>
+        <secret type='iscsi' usage='mycluster_myname'/>
+      </auth>
+      <source protocol='iscsi' name='iqn.1992-01.com.example'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vdb' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi.xml
new file mode 100644
index 0000000..31fc9f2
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-iscsi.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='iscsi' name='iqn.1992-01.com.example'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vdb' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-export.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-export.xml
new file mode 100644
index 0000000..36d8d73
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-export.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='nbd' name='bar'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6-export.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6-export.xml
new file mode 100644
index 0000000..04b7522
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6-export.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='nbd' name='bar'>
+        <host name='::1' port='6000'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml
new file mode 100644
index 0000000..48e9e9c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-ipv6.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='nbd'>
+        <host name='::1' port='6000'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-unix.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-unix.xml
new file mode 100644
index 0000000..7da39e6
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd-unix.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='nbd' name='bar'>
+        <host transport='unix' socket='/var/run/nbdsock'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd.xml
new file mode 100644
index 0000000..d7fd1fc
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-nbd.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='nbd'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-floppy.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-floppy.xml
new file mode 100644
index 0000000..8add406
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-floppy.xml
@@ -0,0 +1,43 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='floppy'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/fd0'/>
+      <target dev='fda' bus='fdc'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='floppy'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/firmware.img'/>
+      <target dev='fdb' bus='fdc'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='fdc' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-many.xml
new file mode 100644
index 0000000..f60aba3
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-many.xml
@@ -0,0 +1,48 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdb' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/data.img'/>
+      <target dev='hdc' bus='ide'/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/logs.img'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
new file mode 100644
index 0000000..d0b61cb
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
@@ -0,0 +1,58 @@ 
+<domain type='qemu' id='1'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <backingStore/>
+      <mirror type='block' job='copy' ready='yes'>
+        <source dev='/dev/HostVG/QEMUGuest1Copy'/>
+      </mirror>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <backingStore/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/data.img'/>
+      <backingStore/>
+      <mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
+        <format type='qcow2'/>
+        <source file='/tmp/copy.img'/>
+      </mirror>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/logs.img'/>
+      <backingStore/>
+      <mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'>
+        <format type='qcow2'/>
+        <source file='/tmp/logcopy.img'/>
+      </mirror>
+      <target dev='vdb' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-inactive.xml
similarity index 100%
rename from tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml
rename to tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-inactive.xml
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device.xml
new file mode 100644
index 0000000..fae9513
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/scsidisk.img'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
new file mode 100644
index 0000000..13004c1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-disk-vpd.xml
@@ -0,0 +1,41 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='cdrom'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='sda' bus='scsi'/>
+      <readonly/>
+      <vendor>SEAGATE</vendor>
+      <product>ST3146707LC</product>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='sdb' bus='scsi'/>
+      <readonly/>
+      <vendor>SEAGATE</vendor>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-lun-passthrough-sgio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-lun-passthrough-sgio.xml
new file mode 100644
index 0000000..676ab97
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-lun-passthrough-sgio.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='lun' rawio='no' sgio='unfiltered'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='lun' sgio='filtered'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-megasas.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-megasas.xml
new file mode 100644
index 0000000..d8e509f
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-megasas.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/scsidisk.img'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-virtio-scsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-virtio-scsi.xml
new file mode 100644
index 0000000..0699f51
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-virtio-scsi.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/scsidisk.img'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml
new file mode 100644
index 0000000..fa74b62
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/scsidisk.img'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool-mode.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool-mode.xml
new file mode 100644
index 0000000..4f7f3f1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool-mode.xml
@@ -0,0 +1,49 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='volume' device='cdrom'>
+      <source pool='pool-iscsi-auth' volume='unit:0:0:1' mode='host'>
+        <seclabel model='selinux' relabel='yes'>
+          <label>system_u:system_r:public_content_t:s0</label>
+        </seclabel>
+      </source>
+      <target dev='hda' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+    </disk>
+    <disk type='volume' device='cdrom'>
+      <source pool='pool-iscsi' volume='unit:0:0:2' mode='direct'>
+        <seclabel model='selinux' relabel='yes'>
+          <label>system_u:system_r:public_content_t:s0</label>
+        </seclabel>
+      </source>
+      <target dev='hdb' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/idedisk.img'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-usb.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-usb.xml
new file mode 100644
index 0000000..06d75aa
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-usb.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/usbdisk.img'/>
+      <target dev='sda' bus='usb'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </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
new file mode 100644
index 0000000..9a192b7
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-cmd_per_lun.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>8</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='sdb' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <driver cmd_per_lun='50'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml
new file mode 100644
index 0000000..a9c2840
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-ioeventfd.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>8</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='sdb' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <driver ioeventfd='on'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml
new file mode 100644
index 0000000..be1454e
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-max_sectors.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>8</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='sdb' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <driver max_sectors='512'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-num_queues.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-num_queues.xml
new file mode 100644
index 0000000..89ea310
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio-scsi-num_queues.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>8</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='sdb' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <driver queues='8'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio.xml
new file mode 100644
index 0000000..b843878
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-virtio.xml
@@ -0,0 +1,47 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/data.img'/>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/logs.img'/>
+      <target dev='vdb' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-xenvbd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-xenvbd.xml
new file mode 100644
index 0000000..088daff
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-xenvbd.xml
@@ -0,0 +1,47 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/data.img'/>
+      <target dev='xvda' bus='xen'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/tmp/logs.img'/>
+      <target dev='xvdg' bus='xen'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-encrypted-disk.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-encrypted-disk.xml
new file mode 100644
index 0000000..6de570a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-encrypted-disk.xml
@@ -0,0 +1,32 @@ 
+<domain type='kvm'>
+  <name>encryptdisk</name>
+  <uuid>496898a6-e6ff-f7c8-5dc2-3cf410945ee9</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>524288</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc-0.13'>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/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source file='/storage/guest_disks/encryptdisk'/>
+      <target dev='vda' bus='virtio'/>
+      <encryption format='qcow'>
+        <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
+      </encryption>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-disabled.xml
new file mode 100644
index 0000000..f416737
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-disabled.xml
@@ -0,0 +1,28 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic eoi='off'/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-enabled.xml
new file mode 100644
index 0000000..7c9db82
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-eoi-enabled.xml
@@ -0,0 +1,28 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic eoi='on'/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-event_idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-event_idx.xml
new file mode 100644
index 0000000..77c0845
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-event_idx.xml
@@ -0,0 +1,53 @@ 
+<domain type='qemu'>
+  <name>test</name>
+  <uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.13'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' event_idx='on'/>
+      <source file='/var/lib/libvirt/images/f14.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <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='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'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-floppy-drive-fat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-floppy-drive-fat.xml
new file mode 100644
index 0000000..4e0826f
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-floppy-drive-fat.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='fd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='dir' device='floppy'>
+      <driver name='qemu' type='fat'/>
+      <source dir='/var/somefiles'/>
+      <target dev='fda' bus='fdc'/>
+      <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='fdc' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml
new file mode 100644
index 0000000..bf78ca8
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='5903' autoport='no'>
+      <listen type='network' network='Bobsnetwork'/>
+    </graphics>
+    <video>
+      <model type='cirrus' vram='16384' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml
new file mode 100644
index 0000000..1bac0b5
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='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'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml
new file mode 100644
index 0000000..5f94052
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='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'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml
new file mode 100644
index 0000000..c13327a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml
@@ -0,0 +1,43 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+      <image compression='auto_glz'/>
+      <jpeg compression='auto'/>
+      <zlib compression='auto'/>
+      <playback compression='on'/>
+      <streaming mode='filter'/>
+    </graphics>
+    <video>
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+    </video>
+    <video>
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml
new file mode 100644
index 0000000..ac705f3
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+      <channel name='main' mode='secure'/>
+      <channel name='inputs' mode='insecure'/>
+    </graphics>
+    <video>
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+    </video>
+    <video>
+      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml
new file mode 100644
index 0000000..0c61ee5
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml
@@ -0,0 +1,47 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1' defaultMode='secure'>
+      <listen type='address' address='127.0.0.1'/>
+      <channel name='main' mode='secure'/>
+      <channel name='inputs' mode='insecure'/>
+      <image compression='auto_glz'/>
+      <jpeg compression='auto'/>
+      <zlib compression='auto'/>
+      <playback compression='on'/>
+      <streaming mode='filter'/>
+      <clipboard copypaste='no'/>
+      <filetransfer enable='no'/>
+    </graphics>
+    <video>
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+    </video>
+    <video>
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml
new file mode 100644
index 0000000..e350142
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <model type='cirrus' vram='16384' heads='1'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml
new file mode 100644
index 0000000..e350142
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <model type='cirrus' vram='16384' heads='1'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml
new file mode 100644
index 0000000..afa4b5a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml
@@ -0,0 +1,29 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='5900' autoport='no' websocket='5700' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <model type='cirrus' vram='16384' heads='1'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml
new file mode 100644
index 0000000..3313469
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'>
+      <listen type='address' address='2001:1:2:3:4:5:1234:1234'/>
+    </graphics>
+    <video>
+      <model type='cirrus' vram='16384' heads='1'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-pci-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-pci-address.xml
new file mode 100644
index 0000000..77b484d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-pci-address.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='pci' managed='yes'>
+      <source>
+        <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
+      </source>
+    </hostdev>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-large-unit.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-large-unit.xml
new file mode 100644
index 0000000..e0846e9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-large-unit.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source>
+        <adapter name='scsi_host0'/>
+        <address bus='0' target='0' unit='1074872354'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml
new file mode 100644
index 0000000..ed2bf25
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi-auth.xml
@@ -0,0 +1,48 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source protocol='iscsi' name='iqn.1992-01.com.example'>
+        <host name='example.org' port='3260'/>
+        <auth username='myname'>
+          <secret type='iscsi' usage='mycluster_myname'/>
+        </auth>
+      </source>
+      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
+    </hostdev>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
+        <host name='example.org' port='3260'/>
+        <auth username='myname'>
+          <secret type='iscsi' usage='mycluster_myname'/>
+        </auth>
+      </source>
+      <address type='drive' controller='0' bus='0' target='0' unit='5'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml
new file mode 100644
index 0000000..056151e
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi-iscsi.xml
@@ -0,0 +1,42 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source protocol='iscsi' name='iqn.1992-01.com.example'>
+        <host name='example.org' port='3260'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
+    </hostdev>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
+        <host name='example.org' port='3260'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='0' unit='5'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi.xml
new file mode 100644
index 0000000..f545d74
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-lsi.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source>
+        <adapter name='scsi_host0'/>
+        <address bus='0' target='0' unit='0'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='0' unit='7'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-rawio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-rawio.xml
new file mode 100644
index 0000000..466b9e6
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-rawio.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered' rawio='yes'>
+      <source>
+        <adapter name='scsi_host0'/>
+        <address bus='0' target='0' unit='0'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-readonly.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-readonly.xml
new file mode 100644
index 0000000..69c0b0d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-readonly.xml
@@ -0,0 +1,38 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source>
+        <adapter name='scsi_host0'/>
+        <address bus='0' target='0' unit='0'/>
+      </source>
+      <readonly/>
+      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-sgio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-sgio.xml
new file mode 100644
index 0000000..3ad679b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-sgio.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered'>
+      <source>
+        <adapter name='scsi_host0'/>
+        <address bus='0' target='0' unit='0'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-shareable.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-shareable.xml
new file mode 100644
index 0000000..effd5f3
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-shareable.xml
@@ -0,0 +1,38 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source>
+        <adapter name='scsi_host0'/>
+        <address bus='0' target='0' unit='0'/>
+      </source>
+      <shareable/>
+      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml
new file mode 100644
index 0000000..33577ab
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi-auth.xml
@@ -0,0 +1,48 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source protocol='iscsi' name='iqn.1992-01.com.example'>
+        <host name='example.org' port='3260'/>
+        <auth username='myname'>
+          <secret type='iscsi' usage='mycluster_myname'/>
+        </auth>
+      </source>
+      <address type='drive' controller='0' bus='0' target='2' unit='4'/>
+    </hostdev>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
+        <host name='example.org' port='3260'/>
+        <auth username='myname'>
+          <secret type='iscsi' usage='mycluster_myname'/>
+        </auth>
+      </source>
+      <address type='drive' controller='0' bus='0' target='2' unit='5'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml
new file mode 100644
index 0000000..e612eec
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-iscsi.xml
@@ -0,0 +1,42 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source protocol='iscsi' name='iqn.1992-01.com.example'>
+        <host name='example.org' port='3260'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='2' unit='4'/>
+    </hostdev>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
+        <host name='example.org' port='3260'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='2' unit='5'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml
new file mode 100644
index 0000000..6f302be
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-virtio-scsi.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='scsi' managed='yes'>
+      <source>
+        <adapter name='scsi_host0'/>
+        <address bus='0' target='0' unit='0'/>
+      </source>
+      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-usb-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-usb-address.xml
new file mode 100644
index 0000000..a196886
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-usb-address.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='usb' managed='no'>
+      <source>
+        <address bus='14' device='6'/>
+      </source>
+    </hostdev>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-vfio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-vfio.xml
new file mode 100644
index 0000000..7161561
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-vfio.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='pci' managed='yes'>
+      <driver name='vfio'/>
+      <source>
+        <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
+      </source>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages.xml
new file mode 100644
index 0000000..24665a4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages.xml
@@ -0,0 +1,47 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <memoryBacking>
+    <hugepages>
+      <page size='2048' unit='KiB' nodeset='1'/>
+      <page size='1048576' unit='KiB' nodeset='0,2-3'/>
+    </hugepages>
+  </memoryBacking>
+  <vcpu placement='static'>4</vcpu>
+  <numatune>
+    <memory mode='strict' nodeset='0-3'/>
+    <memnode cellid='3' mode='strict' nodeset='3'/>
+  </numatune>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
+      <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
+      <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages2.xml
new file mode 100644
index 0000000..5b10307
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages2.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>SomeDummyHugepagesGuest</name>
+  <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <memoryBacking>
+    <hugepages>
+      <page size='2048' unit='KiB'/>
+    </hugepages>
+  </memoryBacking>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='262144' unit='KiB'/>
+      <cell id='1' cpus='1' memory='786432' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages3.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages3.xml
new file mode 100644
index 0000000..d6f9703
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-pages3.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>SomeDummyHugepagesGuest</name>
+  <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <memoryBacking>
+    <hugepages>
+      <page size='1048576' unit='KiB' nodeset='1'/>
+    </hugepages>
+  </memoryBacking>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='262144' unit='KiB'/>
+      <cell id='1' cpus='1' memory='786432' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-shared.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-shared.xml
new file mode 100644
index 0000000..709a0f9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-shared.xml
@@ -0,0 +1,47 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <memoryBacking>
+    <hugepages>
+      <page size='2048' unit='KiB' nodeset='1'/>
+      <page size='1048576' unit='KiB' nodeset='0,2-3'/>
+    </hugepages>
+  </memoryBacking>
+  <vcpu placement='static'>4</vcpu>
+  <numatune>
+    <memory mode='strict' nodeset='0-3'/>
+    <memnode cellid='3' mode='strict' nodeset='3'/>
+  </numatune>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB' memAccess='shared'/>
+      <cell id='2' cpus='2' memory='1048576' unit='KiB' memAccess='private'/>
+      <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages.xml
new file mode 100644
index 0000000..0eb59df
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <memoryBacking>
+    <hugepages/>
+  </memoryBacking>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-off.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-off.xml
new file mode 100644
index 0000000..1067f64
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-off.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <hyperv>
+      <relaxed state='off'/>
+      <vapic state='off'/>
+      <spinlocks state='off'/>
+    </hyperv>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-panic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-panic.xml
new file mode 100644
index 0000000..0cafc07
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv-panic.xml
@@ -0,0 +1,27 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+    <panic model='hyperv'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml
new file mode 100644
index 0000000..2b8f332
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hyperv.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <hyperv>
+      <relaxed state='on'/>
+      <vapic state='on'/>
+      <spinlocks state='on' retries='12287'/>
+    </hyperv>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbmouse.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbmouse.xml
new file mode 100644
index 0000000..2ff76e1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbmouse.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='usb'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbtablet.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbtablet.xml
new file mode 100644
index 0000000..096c082
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-input-usbtablet.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='tablet' bus='usb'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml
new file mode 100644
index 0000000..e853de5
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml
@@ -0,0 +1,54 @@ 
+<domain type='qemu'>
+  <name>test</name>
+  <uuid>15d091de-0181-456b-9554-e4382dc1f1ab</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.13'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' event_idx='on'/>
+      <source file='/var/lib/libvirt/images/f14.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <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='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'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml
new file mode 100644
index 0000000..a92aff4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml
@@ -0,0 +1,134 @@ 
+<domain type='kvm'>
+  <name>gentoo</name>
+  <uuid>a75aca4b-a02f-2bcb-4a91-c93cd848c34b</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <memoryBacking>
+    <hugepages>
+      <page size='1048576' unit='KiB' nodeset='0-3'/>
+    </hugepages>
+  </memoryBacking>
+  <vcpu placement='static'>4</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type>
+    <boot dev='hd'/>
+    <boot dev='cdrom'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
+      <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
+      <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <pm>
+    <suspend-to-mem enabled='yes'/>
+    <suspend-to-disk enabled='yes'/>
+  </pm>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <disk type='file' device='floppy'>
+      <driver name='qemu' type='raw' cache='none'/>
+      <source file='/var/lib/libvirt/images/fd.img'/>
+      <target dev='fda' bus='fdc'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source file='/var/lib/libvirt/images/gentoo.qcow2'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source file='/var/lib/libvirt/images/OtherDemo.img'/>
+      <target dev='vdb' bus='virtio'/>
+      <encryption format='qcow'>
+        <secret type='passphrase' uuid='e78d4b51-a2af-485f-b0f5-afca709a80f4'/>
+      </encryption>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw' cache='none'/>
+      <source file='/home/zippy/tmp/install-amd64-minimal-20140619.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <shareable/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <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'>
+      <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='0x08' function='0x0'/>
+    </controller>
+    <controller type='fdc' index='0'/>
+    <interface type='network'>
+      <mac address='52:54:00:d6:c0:0b'/>
+      <source network='default'/>
+      <bandwidth>
+        <inbound average='100'/>
+        <outbound average='100'/>
+      </bandwidth>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <interface type='server'>
+      <mac address='52:54:00:22:c9:42'/>
+      <source address='127.0.0.1' port='1234'/>
+      <bandwidth>
+        <inbound average='1234'/>
+        <outbound average='5678'/>
+      </bandwidth>
+      <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+    </interface>
+    <interface type='client'>
+      <mac address='52:54:00:8c:b1:f8'/>
+      <source address='127.0.0.1' port='1234'/>
+      <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <serial type='pty'>
+      <target port='1'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <channel type='unix'>
+      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/gentoo.org.qemu.guest_agent.0'/>
+      <target type='virtio' name='org.qemu.guest_agent.0'/>
+      <address type='virtio-serial' controller='0' bus='0' port='1'/>
+    </channel>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes'/>
+    <sound model='ich6'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </sound>
+    <video>
+      <model type='cirrus' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' 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
new file mode 100644
index 0000000..242ea8a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <iothreads>2</iothreads>
+  <os>
+    <type arch='s390x' machine='s390-ccw'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw' iothread='1'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='virtio'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw' iothread='2'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdb' bus='virtio'/>
+      <address type='ccw' cssid='0x0' ssid='0x0' devno='0x0007'/>
+    </disk>
+    <controller type='usb' index='0' model='none'/>
+    <memballoon model='virtio'>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x000a'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
new file mode 100644
index 0000000..cf50a2b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
@@ -0,0 +1,42 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <iothreads>2</iothreads>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw' iothread='1'/>
+      <source file='/var/lib/libvirt/images/iothrtest1.img'/>
+      <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw' iothread='2'/>
+      <source file='/var/lib/libvirt/images/iothrtest2.img'/>
+      <target dev='vdc' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
new file mode 100644
index 0000000..f0ca119
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <iothreads>4</iothreads>
+  <iothreadids>
+    <iothread id='5'/>
+    <iothread id='6'/>
+  </iothreadids>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids.xml
new file mode 100644
index 0000000..32e0075
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='2'/>
+    <iothread id='4'/>
+  </iothreadids>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
new file mode 100644
index 0000000..5f18b92
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <iothreads>2</iothreads>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features-off.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features-off.xml
new file mode 100644
index 0000000..5e54e78
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features-off.xml
@@ -0,0 +1,29 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <kvm>
+      <hidden state='off'/>
+    </kvm>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features.xml
new file mode 100644
index 0000000..8837596
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvm-features.xml
@@ -0,0 +1,29 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <kvm>
+      <hidden state='on'/>
+    </kvm>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml
new file mode 100644
index 0000000..15b474b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-kvmclock.xml
@@ -0,0 +1,28 @@ 
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <pae/>
+  </features>
+  <clock offset='utc'>
+    <timer name='kvmclock' present='no'/>
+  </clock>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/kvm</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml
new file mode 100644
index 0000000..2093556
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-lease.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219200</memory>
+  <currentMemory unit='KiB'>219200</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <source file='/root/boot.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <lease>
+      <lockspace>somearea</lockspace>
+      <key>thequickbrownfoxjumpedoverthelazydog</key>
+      <target path='/some/lease/path' offset='1024'/>
+    </lease>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-off.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-off.xml
new file mode 100644
index 0000000..be84ca4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-off.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory dumpCore='off' unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-on.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-on.xml
new file mode 100644
index 0000000..58784ba
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-machine-core-on.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory dumpCore='on' unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-dimm.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-dimm.xml
new file mode 100644
index 0000000..48d5904
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-dimm.xml
@@ -0,0 +1,56 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
+  <memory unit='KiB'>1267710</memory>
+  <currentMemory unit='KiB'>1267710</currentMemory>
+  <vcpu placement='static' cpuset='0-1'>2</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <idmap>
+    <uid start='0' target='1000' count='10'/>
+    <gid start='0' target='1000' count='10'/>
+  </idmap>
+  <cpu>
+    <topology sockets='2' cores='1' threads='1'/>
+    <numa>
+      <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+    <memory model='dimm'>
+      <target>
+        <size unit='KiB'>523264</size>
+        <node>0</node>
+      </target>
+    </memory>
+    <memory model='dimm'>
+      <source>
+        <nodemask>1-3</nodemask>
+        <pagesize unit='KiB'>2048</pagesize>
+      </source>
+      <target>
+        <size unit='KiB'>524287</size>
+        <node>0</node>
+      </target>
+    </memory>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nonuma.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nonuma.xml
new file mode 100644
index 0000000..c83a6a5
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nonuma.xml
@@ -0,0 +1,24 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <maxMemory slots='9' unit='KiB'>1233456789</maxMemory>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug.xml
new file mode 100644
index 0000000..90bd43e
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static' cpuset='0-1'>2</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <topology sockets='2' cores='1' threads='1'/>
+    <numa>
+      <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml
new file mode 100644
index 0000000..bfdd1aa
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-minimal.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <title>A description of the test machine.</title>
+  <description>
+      A test of qemu&apos;s minimal configuration.
+      This test also tests the description and title elements.
+  </description>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-acpi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-acpi.xml
new file mode 100644
index 0000000..800a0a9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-acpi.xml
@@ -0,0 +1,33 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-s3.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-s3.xml
new file mode 100644
index 0000000..3619c24
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-s3.xml
@@ -0,0 +1,33 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <pm>
+    <suspend-to-mem enabled='no'/>
+  </pm>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-suspends.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-suspends.xml
new file mode 100644
index 0000000..30276e0
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-disable-suspends.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <pm>
+    <suspend-to-mem enabled='no'/>
+    <suspend-to-disk enabled='no'/>
+  </pm>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-enable-s4.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-enable-s4.xml
new file mode 100644
index 0000000..ac8b3f0
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-enable-s4.xml
@@ -0,0 +1,33 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <pm>
+    <suspend-to-disk enabled='yes'/>
+  </pm>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-no-reboot.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-no-reboot.xml
new file mode 100644
index 0000000..6dba315
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-misc-no-reboot.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>destroy</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml
new file mode 100644
index 0000000..daecc8b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml
@@ -0,0 +1,76 @@ 
+<domain type='kvm'>
+  <name>f14-60</name>
+  <uuid>38644c45-5227-a936-3b38-bc4f72c355bb</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.13'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-kvm</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source file='/var/lib/libvirt/images/f14-6.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source file='/home/zippy/tmp/Fedora-14-x86_64-Live-KDE.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <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='0x06' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <interface type='network'>
+      <mac address='52:54:00:24:a5:9f'/>
+      <source network='default'/>
+      <bandwidth>
+        <inbound average='1000' peak='4000' burst='1024'/>
+        <outbound average='128' peak='256' burst='32768'/>
+      </bandwidth>
+      <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='tablet' bus='usb'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes'/>
+    <sound model='ac97'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </sound>
+    <video>
+      <model type='vga' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml
new file mode 100644
index 0000000..10e15ee
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml
@@ -0,0 +1,65 @@ 
+<domain type='kvm'>
+  <name>f14-60</name>
+  <uuid>38644c45-5227-a936-3b38-bc4f72c355bb</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.13'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-kvm</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source file='/var/lib/libvirt/images/f14-6.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='virtio-serial' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <interface type='network'>
+      <mac address='52:54:00:24:a5:9f'/>
+      <source network='default'/>
+      <bandwidth>
+        <inbound floor='200'/>
+      </bandwidth>
+      <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='tablet' bus='usb'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes'/>
+    <sound model='ac97'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </sound>
+    <video>
+      <model type='vga' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-ifname.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-ifname.xml
new file mode 100644
index 0000000..d1810b5
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-ifname.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='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'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml
new file mode 100644
index 0000000..5e88efb
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='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'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev-vfio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev-vfio.xml
new file mode 100644
index 0000000..d4e4476
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev-vfio.xml
@@ -0,0 +1,43 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='hostdev' managed='yes'>
+      <mac address='00:11:22:33:44:55'/>
+      <driver name='vfio'/>
+      <source>
+        <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x1'/>
+      </source>
+      <vlan>
+        <tag id='42'/>
+      </vlan>
+      <virtualport type='802.1Qbg'>
+        <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
+      </virtualport>
+      <model type='rtl8139'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev.xml
new file mode 100644
index 0000000..8cf6254
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-hostdev.xml
@@ -0,0 +1,42 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='hostdev' managed='yes'>
+      <mac address='00:11:22:33:44:55'/>
+      <source>
+        <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x1'/>
+      </source>
+      <vlan>
+        <tag id='42'/>
+      </vlan>
+      <virtualport type='802.1Qbg'>
+        <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
+      </virtualport>
+      <model type='rtl8139'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-midonet.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-midonet.xml
new file mode 100644
index 0000000..f108cad
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-midonet.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='bridge'>
+      <mac address='00:11:22:33:44:55'/>
+      <source bridge='midonet'/>
+      <virtualport type='midonet'>
+        <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
+      </virtualport>
+      <model type='virtio'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-openvswitch.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-openvswitch.xml
new file mode 100644
index 0000000..2902cb2
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-openvswitch.xml
@@ -0,0 +1,42 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='network'>
+      <mac address='00:11:22:33:44:55'/>
+      <source network='ovs-net'/>
+      <vlan trunk='yes'>
+        <tag id='42'/>
+        <tag id='48'/>
+        <tag id='456'/>
+      </vlan>
+      <virtualport type='openvswitch'>
+        <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f' profileid='bob'/>
+      </virtualport>
+      <model type='rtl8139'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml
new file mode 100644
index 0000000..239510d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-udp.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='udp'>
+      <mac address='52:54:00:8c:b9:05'/>
+      <source address='192.168.10.1' port='5555'>
+        <local address='192.168.10.1' port='5556'/>
+      </source>
+      <model type='rtl8139'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml
new file mode 100644
index 0000000..17d7adc
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='user'>
+      <mac address='00:11:22:33:44:55'/>
+      <model type='rtl8139'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-vhostuser.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-vhostuser.xml
new file mode 100644
index 0000000..3771563
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-vhostuser.xml
@@ -0,0 +1,45 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='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'/>
+    </interface>
+    <interface type='vhostuser'>
+      <mac address='52:54:00:ee:96:6c'/>
+      <source type='unix' path='/tmp/vhost1.sock' mode='client'/>
+      <model type='virtio'/>
+    </interface>
+    <interface type='server'>
+      <mac address='52:54:00:95:db:c0'/>
+      <source port='2015'/>
+      <model type='rtl8139'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-device.xml
new file mode 100644
index 0000000..5d631fd
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-device.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='user'>
+      <mac address='00:11:22:33:44:55'/>
+      <model type='virtio'/>
+      <driver txmode='iothread'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-disable-offloads.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-disable-offloads.xml
new file mode 100644
index 0000000..30297e6
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-disable-offloads.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest7'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='user'>
+      <mac address='00:22:44:66:88:aa'/>
+      <model type='virtio'/>
+      <driver>
+        <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>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-network-portgroup.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-network-portgroup.xml
new file mode 100644
index 0000000..8445feb
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-network-portgroup.xml
@@ -0,0 +1,56 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='network' trustGuestRxFilters='yes'>
+      <mac address='00:11:22:33:44:55'/>
+      <source network='rednet' portgroup='bob'/>
+      <vlan>
+        <tag id='4095'/>
+      </vlan>
+      <virtualport type='802.1Qbg'>
+        <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
+      </virtualport>
+      <model type='virtio'/>
+    </interface>
+    <interface type='network' trustGuestRxFilters='no'>
+      <mac address='10:11:22:33:44:55'/>
+      <source network='blue' portgroup='sam'/>
+      <virtualport>
+        <parameters instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f' interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
+      </virtualport>
+      <model type='rtl8139'/>
+    </interface>
+    <interface type='network'>
+      <mac address='22:11:22:33:44:55'/>
+      <source network='blue' portgroup='sam'/>
+      <virtualport type='802.1Qbh'>
+        <parameters profileid='testhis99'/>
+      </virtualport>
+      <model type='rtl8139'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio.xml
new file mode 100644
index 0000000..422649c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='user'>
+      <mac address='00:11:22:33:44:55'/>
+      <model type='virtio'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-nosharepages.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-nosharepages.xml
new file mode 100644
index 0000000..021642a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-nosharepages.xml
@@ -0,0 +1,33 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219200</memory>
+  <currentMemory unit='KiB'>219200</currentMemory>
+  <memoryBacking>
+    <nosharepages/>
+  </memoryBacking>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-static-vcpu-no-numatune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-static-vcpu-no-numatune.xml
new file mode 100644
index 0000000..d85ba6b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-static-vcpu-no-numatune.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <topology sockets='2' cores='1' threads='1'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode-no-memory.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode-no-memory.xml
new file mode 100644
index 0000000..b9f7ca4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode-no-memory.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest</name>
+  <uuid>9f4b6512-e73a-4a25-93e8-5307802821ce</uuid>
+  <memory unit='KiB'>65536</memory>
+  <currentMemory unit='KiB'>65536</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <numatune>
+    <memnode cellid='0' mode='preferred' nodeset='3'/>
+  </numatune>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='32768' unit='KiB'/>
+      <cell id='1' cpus='1' memory='32768' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/kvm</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-double.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-double.xml
new file mode 100644
index 0000000..5908ab3
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-double.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+    <panic model='hyperv'/>
+    <panic model='isa'>
+      <address type='isa' iobase='0x505'/>
+    </panic>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-isa.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-isa.xml
new file mode 100644
index 0000000..767d615
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-isa.xml
@@ -0,0 +1,33 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='fdc' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+    <panic model='isa'>
+      <address type='isa' iobase='0x505'/>
+    </panic>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-no-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-no-address.xml
new file mode 100644
index 0000000..c3c7551
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-no-address.xml
@@ -0,0 +1,31 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='fdc' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+    <panic model='isa'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml
new file mode 100644
index 0000000..8fcd644
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <currentMemory unit='KiB'>524288</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>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/bin/qemu-system-ppc64</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <serial type='pty'>
+      <target port='0'/>
+      <address type='spapr-vio'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+      <address type='spapr-vio'/>
+    </console>
+    <memballoon model='none'/>
+    <panic model='pseries'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-parallel-tcp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-parallel-tcp.xml
new file mode 100644
index 0000000..99d2110
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-parallel-tcp.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <parallel type='tcp'>
+      <source mode='bind' host='127.0.0.1' service='9999'/>
+      <protocol type='raw'/>
+      <target port='0'/>
+    </parallel>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml
new file mode 100644
index 0000000..683c269
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml
@@ -0,0 +1,211 @@ 
+<domain type='qemu'>
+  <name>fdr-br</name>
+  <uuid>3ec6cbe1-b5a2-4515-b800-31a61855df41</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='pc-1.2'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/iso/f18kde.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <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='pci' index='1' model='pci-bridge'/>
+    <controller type='pci' index='2' model='pci-bridge'/>
+    <interface type='network'>
+      <mac address='52:54:00:f1:95:51'/>
+      <source network='default'/>
+      <model type='rtl8139'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:5c:c6:1a'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:39:97:ac'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:45:28:cb'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:ee:b9:a8'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:a9:f7:17'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:df:2b:f3'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:78:94:b4'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:6b:9b:06'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:17:df:bc'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:3b:d0:51'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:8d:2d:17'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:a7:66:af'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:54:ab:d7'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:1f:99:90'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:c8:43:87'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:df:22:b2'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:d2:9a:47'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:86:05:e2'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:8c:1c:c2'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:48:58:92'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:99:e5:bf'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:b1:8c:25'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:60:e0:d0'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:37:00:6a'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:c7:c8:ad'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:4e:a7:cf'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:00:79:69'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:47:00:6f'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:2a:8c:8b'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:ec:d5:e3'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='network'>
+      <mac address='52:54:00:7e:6e:c8'/>
+      <source network='default'/>
+      <model type='e1000'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <model type='cirrus' vram='16384' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml
new file mode 100644
index 0000000..6ad1134
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-rom.xml
@@ -0,0 +1,51 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest2</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <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='pci' index='0' model='pci-root'/>
+    <interface type='user'>
+      <mac address='52:54:00:24:a5:9f'/>
+      <model type='virtio'/>
+      <rom bar='on'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:24:a5:9e'/>
+      <model type='virtio'/>
+      <rom file='/etc/fake/bootrom.bin'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <hostdev mode='subsystem' type='pci' managed='yes'>
+      <source>
+        <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
+      </source>
+      <rom bar='off'/>
+    </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'/>
+    </hostdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml
new file mode 100644
index 0000000..10d3a48
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-serial-dev-chardev.xml
@@ -0,0 +1,39 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='dev'>
+      <source path='/dev/ttyS2'/>
+      <target type='pci-serial' port='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </serial>
+    <console type='dev'>
+      <source path='/dev/ttyS2'/>
+      <target type='serial' port='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-too-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-too-many.xml
new file mode 100644
index 0000000..98be1cd
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-too-many.xml
@@ -0,0 +1,62 @@ 
+<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
new file mode 100644
index 0000000..795f8dd
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
@@ -0,0 +1,38 @@ 
+<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'>
+      <model name='ioh3420'/>
+      <target chassis='40' port='0x1a'/>
+    </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'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml
new file mode 100644
index 0000000..b781675
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml
@@ -0,0 +1,46 @@ 
+<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-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='8' model='pcie-switch-downstream-port'>
+      <model name='xio3130-downstream'/>
+      <target chassis='30' port='0x27'/>
+    </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'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml
new file mode 100644
index 0000000..4205f8a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml
@@ -0,0 +1,39 @@ 
+<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-switch-upstream-port'/>
+    <controller type='pci' index='6' model='pcie-switch-upstream-port'>
+      <model name='x3130-upstream'/>
+    </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'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-none.xml
new file mode 100644
index 0000000..bcc5b3c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-none.xml
@@ -0,0 +1,25 @@ 
+<domain type='qemu'>
+  <name>foo</name>
+  <uuid>c84fc647-6198-4ff9-bf81-d65a1f8f5ec0</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='pc-1.2'>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>
+    <controller type='pci' index='0' model='pci-root'>
+      <pcihole64 unit='KiB'>0</pcihole64>
+    </controller>
+    <controller type='usb' index='0'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml
new file mode 100644
index 0000000..a967bf4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml
@@ -0,0 +1,35 @@ 
+<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'>
+      <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'/>
+    <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-pcihole64.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64.xml
new file mode 100644
index 0000000..931f513
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64.xml
@@ -0,0 +1,25 @@ 
+<domain type='qemu'>
+  <name>foo</name>
+  <uuid>3c7c30b5-7866-4b05-8a29-efebccba52a0</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='pc-1.2'>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>
+    <controller type='pci' index='0' model='pci-root'>
+      <pcihole64 unit='KiB'>1048576</pcihole64>
+    </controller>
+    <controller type='usb' index='0'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature-off.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature-off.xml
new file mode 100644
index 0000000..1eb5a83
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature-off.xml
@@ -0,0 +1,27 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <pmu state='off'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml
new file mode 100644
index 0000000..2da2832
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml
@@ -0,0 +1,25 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <currentMemory unit='KiB'>524288</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>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/bin/qemu-system-ppc64</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='none'/>
+    <nvram>
+      <address type='spapr-vio' reg='0x4000'/>
+    </nvram>
+    <panic model='pseries'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-disabled.xml
new file mode 100644
index 0000000..693b71c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-disabled.xml
@@ -0,0 +1,28 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <pae/>
+    <pvspinlock state='off'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-enabled.xml
new file mode 100644
index 0000000..0b8c9af
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pv-spinlock-enabled.xml
@@ -0,0 +1,28 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <pae/>
+    <pvspinlock state='on'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-disabled.xml
new file mode 100644
index 0000000..8fa2a7e
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-disabled.xml
@@ -0,0 +1,24 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+    <bios rebootTimeout='-1'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-enabled.xml
new file mode 100644
index 0000000..92707f4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-reboot-timeout-enabled.xml
@@ -0,0 +1,24 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+    <bios rebootTimeout='128'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dac-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dac-none.xml
new file mode 100644
index 0000000..ac42473
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dac-none.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </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
new file mode 100644
index 0000000..88ea2e0
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-device-multiple.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'>
+        <seclabel model='selinux' relabel='yes'>
+          <label>system_u:system_r:svirt_custom_t:s0:c192,c392</label>
+        </seclabel>
+        <seclabel model='dac' relabel='no'/>
+      </source>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-baselabel.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-baselabel.xml
new file mode 100644
index 0000000..ec7b314
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-baselabel.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+  <seclabel type='dynamic' model='selinux' relabel='yes'>
+    <baselabel>system_u:system_r:svirt_custom_t:s0</baselabel>
+  </seclabel>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none.xml
new file mode 100644
index 0000000..4872b91
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none.xml
@@ -0,0 +1,30 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </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
new file mode 100644
index 0000000..ceab337
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-override.xml
@@ -0,0 +1,44 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'>
+        <seclabel model='selinux' relabel='no'/>
+      </source>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest2'>
+        <seclabel model='selinux' relabel='yes'>
+          <label>system_u:system_r:public_content_t:s0</label>
+        </seclabel>
+      </source>
+      <target dev='hdb' bus='ide'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+  <seclabel type='dynamic' model='selinux' relabel='yes'>
+    <baselabel>system_u:system_r:svirt_custom_t:s0</baselabel>
+  </seclabel>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
new file mode 100644
index 0000000..b850af1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu' id='1'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'>
+        <seclabel model='selinux' labelskip='yes'/>
+      </source>
+      <backingStore/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+  <seclabel type='static' model='selinux' relabel='yes'>
+    <label>system_u:system_r:svirt_custom_t:s0:c192,c392</label>
+    <imagelabel>system_u:system_r:svirt_custom_t:s0:c192,c392</imagelabel>
+  </seclabel>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static.xml
new file mode 100644
index 0000000..32c83bd
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+  <seclabel type='static' model='selinux' relabel='no'>
+    <label>system_u:system_r:svirt_custom_t:s0:c192,c392</label>
+  </seclabel>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-dev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-dev.xml
new file mode 100644
index 0000000..aa03ab8
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-dev.xml
@@ -0,0 +1,38 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='dev'>
+      <source path='/dev/ttyS2'/>
+      <target port='0'/>
+    </serial>
+    <console type='dev'>
+      <source path='/dev/ttyS2'/>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-file.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-file.xml
new file mode 100644
index 0000000..a7596ad
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-file.xml
@@ -0,0 +1,38 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='file'>
+      <source path='/tmp/serial.log'/>
+      <target port='0'/>
+    </serial>
+    <console type='file'>
+      <source path='/tmp/serial.log'/>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-many.xml
new file mode 100644
index 0000000..75d77ad
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-many.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <serial type='file'>
+      <source path='/tmp/serial.log'/>
+      <target port='1'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-pty.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-pty.xml
new file mode 100644
index 0000000..7be7259
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-pty.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml
new file mode 100644
index 0000000..970ef7f
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml
@@ -0,0 +1,37 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='spiceport'>
+      <source channel='org.qemu.console.serial.0'/>
+      <target port='0'/>
+    </serial>
+    <console type='spiceport'>
+      <source channel='org.qemu.console.serial.0'/>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml
new file mode 100644
index 0000000..1127db1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml
@@ -0,0 +1,44 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='spiceport'>
+      <source channel='org.qemu.console.serial.0'/>
+      <target port='0'/>
+    </serial>
+    <console type='spiceport'>
+      <source channel='org.qemu.console.serial.0'/>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='tablet' bus='usb'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-telnet.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-telnet.xml
new file mode 100644
index 0000000..48037bb
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-telnet.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='tcp'>
+      <source mode='bind' host='127.0.0.1' service='9999'/>
+      <protocol type='telnet'/>
+      <target port='0'/>
+    </serial>
+    <console type='tcp'>
+      <source mode='bind' host='127.0.0.1' service='9999'/>
+      <protocol type='telnet'/>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp.xml
new file mode 100644
index 0000000..ba0c289
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp.xml
@@ -0,0 +1,40 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='tcp'>
+      <source mode='connect' host='127.0.0.1' service='9999'/>
+      <protocol type='raw'/>
+      <target port='0'/>
+    </serial>
+    <console type='tcp'>
+      <source mode='connect' host='127.0.0.1' service='9999'/>
+      <protocol type='raw'/>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-udp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-udp.xml
new file mode 100644
index 0000000..61661e7
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-udp.xml
@@ -0,0 +1,44 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='udp'>
+      <source mode='bind' host='127.0.0.1' service='9999'/>
+      <source mode='connect' host='127.0.0.1' service='9998'/>
+      <target port='0'/>
+    </serial>
+    <serial type='udp'>
+      <source mode='connect' service='9999'/>
+      <target port='1'/>
+    </serial>
+    <console type='udp'>
+      <source mode='bind' host='127.0.0.1' service='9999'/>
+      <source mode='connect' host='127.0.0.1' service='9998'/>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-unix.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-unix.xml
new file mode 100644
index 0000000..6789e2d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-unix.xml
@@ -0,0 +1,38 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='unix'>
+      <source mode='connect' path='/tmp/serial.sock'/>
+      <target port='0'/>
+    </serial>
+    <console type='unix'>
+      <source mode='connect' path='/tmp/serial.sock'/>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-vc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-vc.xml
new file mode 100644
index 0000000..69ce1ba
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-vc.xml
@@ -0,0 +1,36 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <serial type='vc'>
+      <target port='0'/>
+    </serial>
+    <console type='vc'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
new file mode 100644
index 0000000..5bc4904
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
@@ -0,0 +1,54 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <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='shmem1'>
+      <size unit='M'>128</size>
+    </shmem>
+    <shmem name='shmem2'>
+      <size unit='M'>256</size>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </shmem>
+    <shmem name='shmem3'>
+      <size unit='M'>512</size>
+      <server/>
+    </shmem>
+    <shmem name='shmem4'>
+      <size unit='M'>1024</size>
+      <server path='/tmp/shmem4-sock'/>
+    </shmem>
+    <shmem name='shmem5'>
+      <size unit='M'>2048</size>
+      <server path='/tmp/shmem5-sock'/>
+      <msi ioeventfd='off'/>
+    </shmem>
+    <shmem name='shmem6'>
+      <size unit='M'>4096</size>
+      <server path='/tmp/shmem6-sock'/>
+      <msi vectors='16'/>
+    </shmem>
+    <shmem name='shmem7'>
+      <size unit='M'>8192</size>
+      <server path='/tmp/shmem7-sock'/>
+      <msi vectors='32' ioeventfd='on'/>
+    </shmem>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios-multiple-type2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios-multiple-type2.xml
new file mode 100644
index 0000000..60c4af2
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios-multiple-type2.xml
@@ -0,0 +1,60 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <sysinfo type='smbios'>
+    <bios>
+      <entry name='vendor'>LENOVO</entry>
+      <entry name='version'>6FET82WW (3.12 )</entry>
+    </bios>
+    <system>
+      <entry name='manufacturer'>Fedora</entry>
+      <entry name='product'>Virt-Manager</entry>
+      <entry name='version'>0.8.2-3.fc14</entry>
+      <entry name='serial'>32dfcb37-5af1-552b-357c-be8c3aa38310</entry>
+      <entry name='uuid'>c7a5fdbd-edaf-9455-926a-d65c16db1809</entry>
+      <entry name='sku'>1234567890</entry>
+      <entry name='family'>Red Hat</entry>
+    </system>
+    <baseBoard>
+      <entry name='manufacturer'>Hewlett-Packard</entry>
+      <entry name='product'>0B4Ch</entry>
+      <entry name='version'>D</entry>
+      <entry name='serial'>CZC1065993</entry>
+      <entry name='asset'>CZC1065993</entry>
+      <entry name='location'>Upside down</entry>
+    </baseBoard>
+    <baseBoard>
+      <entry name='manufacturer'>Lenovo</entry>
+      <entry name='product'>20BE0061MC</entry>
+      <entry name='version'>0B98401 Pro</entry>
+      <entry name='serial'>W1KS427111E</entry>
+      <entry name='location'>Not Available</entry>
+    </baseBoard>
+  </sysinfo>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+    <smbios mode='sysinfo'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml
new file mode 100644
index 0000000..0fbb0a8
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smbios.xml
@@ -0,0 +1,53 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <sysinfo type='smbios'>
+    <bios>
+      <entry name='vendor'>LENOVO</entry>
+      <entry name='version'>6FET82WW (3.12 )</entry>
+    </bios>
+    <system>
+      <entry name='manufacturer'>Fedora</entry>
+      <entry name='product'>Virt-Manager</entry>
+      <entry name='version'>0.8.2-3.fc14</entry>
+      <entry name='serial'>32dfcb37-5af1-552b-357c-be8c3aa38310</entry>
+      <entry name='uuid'>c7a5fdbd-edaf-9455-926a-d65c16db1809</entry>
+      <entry name='sku'>1234567890</entry>
+      <entry name='family'>Red Hat</entry>
+    </system>
+    <baseBoard>
+      <entry name='manufacturer'>Hewlett-Packard</entry>
+      <entry name='product'>0B4Ch</entry>
+      <entry name='version'>D</entry>
+      <entry name='serial'>CZC1065993</entry>
+      <entry name='asset'>CZC1065993</entry>
+      <entry name='location'>Upside down</entry>
+    </baseBoard>
+  </sysinfo>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+    <smbios mode='sysinfo'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml
new file mode 100644
index 0000000..9ac578b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-smp.xml
@@ -0,0 +1,33 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static' current='1'>2</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <topology sockets='2' cores='1' threads='1'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound-device.xml
new file mode 100644
index 0000000..dbae994
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound-device.xml
@@ -0,0 +1,44 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <sound model='pcspk'/>
+    <sound model='es1370'/>
+    <sound model='sb16'/>
+    <sound model='ac97'/>
+    <sound model='ich6'/>
+    <sound model='ich6'>
+      <codec type='micro'/>
+      <codec type='duplex'/>
+    </sound>
+    <sound model='ich9'/>
+    <sound model='ich9'>
+      <codec type='micro'/>
+      <codec type='duplex'/>
+    </sound>
+    <sound model='usb'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml
new file mode 100644
index 0000000..ccffe4a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-sound.xml
@@ -0,0 +1,34 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <sound model='pcspk'/>
+    <sound model='es1370'/>
+    <sound model='sb16'/>
+    <sound model='ac97'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml
new file mode 100644
index 0000000..7d85fd8
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml
@@ -0,0 +1,54 @@ 
+<domain type='qemu'>
+  <name>test</name>
+  <uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.13'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' event_idx='on'/>
+      <source file='/var/lib/libvirt/images/f14.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <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='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'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tpm-passthrough.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tpm-passthrough.xml
new file mode 100644
index 0000000..12ad8cf
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tpm-passthrough.xml
@@ -0,0 +1,32 @@ 
+<domain type='qemu'>
+  <name>TPM-VM</name>
+  <uuid>11d7cd22-da89-3094-6212-079a48a309a1</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>512288</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.12'>hvm</type>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <tpm model='tpm-tis'>
+      <backend type='passthrough'>
+        <device path='/dev/tpm0'/>
+      </backend>
+    </tpm>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir.xml
new file mode 100644
index 0000000..4702697
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir.xml
@@ -0,0 +1,44 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0' model='ich9-ehci1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-uhci1'>
+      <master startport='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-uhci2'>
+      <master startport='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
+    </controller>
+    <controller type='usb' index='0' model='ich9-uhci3'>
+      <master startport='4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <redirdev bus='usb' type='tcp'>
+      <source mode='connect' host='localhost' service='4000'/>
+      <protocol type='raw'/>
+    </redirdev>
+    <redirdev bus='usb' type='spicevmc'>
+      <address type='usb' bus='0' port='4'/>
+    </redirdev>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
new file mode 100644
index 0000000..9cd00c0
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
@@ -0,0 +1,39 @@ 
+<domain type='kvm'>
+  <name>dummy2</name>
+  <uuid>4d92ec27-9ebf-400b-ae91-20c71c647c19</uuid>
+  <memory unit='KiB'>131072</memory>
+  <currentMemory unit='KiB'>65536</currentMemory>
+  <vcpu placement='static' current='2'>6</vcpu>
+  <iothreads>2</iothreads>
+  <cputune>
+    <emulatorpin cpuset='1-3'/>
+    <iothreadpin iothread='1' cpuset='2'/>
+  </cputune>
+  <numatune>
+    <memory mode='strict' placement='auto'/>
+  </numatune>
+  <os>
+    <type arch='x86_64' machine='pc-q35-2.3'>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/bin/qemu-system-x86_64</emulator>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <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'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml
new file mode 100644
index 0000000..2355133
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml
@@ -0,0 +1,53 @@ 
+<domain type='qemu'>
+  <name>test</name>
+  <uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.13'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' event_idx='on'/>
+      <source file='/var/lib/libvirt/images/f14.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <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='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'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml
new file mode 100644
index 0000000..e3d28bb
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml
@@ -0,0 +1,33 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <video>
+      <model type='virtio' heads='1'/>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml
new file mode 100644
index 0000000..47a93b1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml
@@ -0,0 +1,35 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <video>
+      <model type='virtio' heads='1'>
+        <acceleration accel3d='yes'/>
+      </model>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input-passthrough.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input-passthrough.xml
new file mode 100644
index 0000000..79270ab
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input-passthrough.xml
@@ -0,0 +1,26 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='passthrough' bus='virtio'>
+      <source evdev='/dev/input/event1234'/>
+    </input>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input.xml
new file mode 100644
index 0000000..4f5e3e9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-input.xml
@@ -0,0 +1,28 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='virtio'/>
+    <input type='keyboard' bus='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </input>
+    <input type='tablet' bus='virtio'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-lun.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-lun.xml
new file mode 100644
index 0000000..63dbfda
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-lun.xml
@@ -0,0 +1,52 @@ 
+<domain type='qemu'>
+  <name>test</name>
+  <uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.13'>hvm</type>
+    <boot dev='cdrom'/>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='lun' rawio='yes'>
+      <driver name='qemu' type='qcow2'/>
+      <source dev='/dev/sdfake'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='block' device='lun'>
+      <driver name='qemu' type='qcow2'/>
+      <source dev='/dev/sdfake2'/>
+      <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <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='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'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-egd.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-egd.xml
new file mode 100644
index 0000000..64a0eed
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-egd.xml
@@ -0,0 +1,29 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+    <rng model='virtio'>
+      <backend model='egd' type='tcp'>
+        <source mode='connect' host='1.2.3.4' service='1234'/>
+        <protocol type='raw'/>
+      </backend>
+    </rng>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml
new file mode 100644
index 0000000..71bd21a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-rng-random.xml
@@ -0,0 +1,27 @@ 
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+    <rng model='virtio'>
+      <rate bytes='123' period='1234'/>
+      <backend model='random'>/dev/hwrng</backend>
+    </rng>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 19e6c1b..fa6ca73 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -181,7 +181,6 @@  testInfoFree(struct testInfo *info)
 static int
 testInfoSet(struct testInfo *info,
             const char *name,
-            bool different,
             int when)
 {
     if (!(info->qemuCaps = virQEMUCapsNew()))
@@ -196,46 +195,35 @@  testInfoSet(struct testInfo *info,
         goto error;
 
     if (when & WHEN_INACTIVE) {
-        if (different) {
-            if (virAsprintf(&info->outInactiveName,
-                           "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-inactive.xml",
-                           abs_srcdir, name) < 0)
-                goto error;
+        if (virAsprintf(&info->outInactiveName,
+                        "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-inactive.xml",
+                        abs_srcdir, name) < 0)
+            goto error;
 
-            if (!virFileExists(info->outInactiveName)) {
-                VIR_FREE(info->outInactiveName);
+        if (!virFileExists(info->outInactiveName)) {
+            VIR_FREE(info->outInactiveName);
 
-                if (virAsprintf(&info->outInactiveName,
-                                "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
-                                abs_srcdir, name) < 0)
-                    goto error;
-            }
-        } else {
-            if (VIR_STRDUP(info->outInactiveName, info->inName) < 0)
+            if (virAsprintf(&info->outInactiveName,
+                            "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
+                            abs_srcdir, name) < 0)
                 goto error;
         }
     }
 
     if (when & WHEN_ACTIVE) {
-        if (different) {
-            if (virAsprintf(&info->outActiveName,
-                           "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-active.xml",
-                           abs_srcdir, name) < 0)
-                goto error;
+        if (virAsprintf(&info->outActiveName,
+                        "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-active.xml",
+                        abs_srcdir, name) < 0)
+            goto error;
 
-            if (!virFileExists(info->outActiveName)) {
-                VIR_FREE(info->outActiveName);
+        if (!virFileExists(info->outActiveName)) {
+            VIR_FREE(info->outActiveName);
 
-                if (virAsprintf(&info->outActiveName,
-                                "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
-                                abs_srcdir, name) < 0)
-                    goto error;
-            }
-        } else {
-            if (VIR_STRDUP(info->outActiveName, info->inName) < 0)
+            if (virAsprintf(&info->outActiveName,
+                            "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
+                            abs_srcdir, name) < 0)
                 goto error;
         }
-
     }
 
     return 0;
@@ -258,9 +246,9 @@  mymain(void)
     /* TODO: test with format probing disabled too */
     driver.config->allowDiskFormatProbing = true;
 
-# define DO_TEST_FULL(name, is_different, when)                                \
+# define DO_TEST_FULL(name, when)                                              \
     do {                                                                       \
-        if (testInfoSet(&info, name, is_different, when) < 0) {                \
+        if (testInfoSet(&info, name, when) < 0) {                             \
             VIR_TEST_DEBUG("Failed to generate test data for '%s'", name);    \
             return -1;                                                         \
         }                                                                      \
@@ -284,10 +272,7 @@  mymain(void)
     } while (0)
 
 # define DO_TEST(name) \
-    DO_TEST_FULL(name, false, WHEN_BOTH)
-
-# define DO_TEST_DIFFERENT(name) \
-    DO_TEST_FULL(name, true, WHEN_BOTH)
+    DO_TEST_FULL(name, WHEN_BOTH)
 
     /* Unset or set all envvars here that are copied in qemudBuildCommandLine
      * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
@@ -297,15 +282,15 @@  mymain(void)
     DO_TEST("minimal");
     DO_TEST("machine-core-on");
     DO_TEST("machine-core-off");
-    DO_TEST_DIFFERENT("default-kvm-host-arch");
-    DO_TEST_DIFFERENT("default-qemu-host-arch");
+    DO_TEST("default-kvm-host-arch");
+    DO_TEST("default-qemu-host-arch");
     DO_TEST("boot-cdrom");
     DO_TEST("boot-network");
     DO_TEST("boot-floppy");
     DO_TEST("boot-multi");
     DO_TEST("boot-menu-enable-with-timeout");
     DO_TEST("boot-menu-disable");
-    DO_TEST_DIFFERENT("boot-menu-disable-with-timeout");
+    DO_TEST("boot-menu-disable-with-timeout");
     DO_TEST("boot-order");
 
     DO_TEST("reboot-timeout-enabled");
@@ -313,7 +298,7 @@  mymain(void)
 
     DO_TEST("clock-utc");
     DO_TEST("clock-localtime");
-    DO_TEST_DIFFERENT("cpu-empty");
+    DO_TEST("cpu-empty");
     DO_TEST("cpu-kvmclock");
     DO_TEST("cpu-host-kvmclock");
     DO_TEST("cpu-host-passthrough-features");
@@ -336,7 +321,7 @@  mymain(void)
     DO_TEST("kvm-features");
     DO_TEST("kvm-features-off");
 
-    DO_TEST_DIFFERENT("pmu-feature");
+    DO_TEST("pmu-feature");
     DO_TEST("pmu-feature-off");
 
     DO_TEST("hugepages");
@@ -391,10 +376,10 @@  mymain(void)
     DO_TEST("disk-virtio-scsi-max_sectors");
     DO_TEST("disk-virtio-scsi-ioeventfd");
     DO_TEST("disk-scsi-megasas");
-    DO_TEST_DIFFERENT("disk-mirror-old");
-    DO_TEST_FULL("disk-mirror", false, WHEN_ACTIVE);
-    DO_TEST_FULL("disk-mirror", true, WHEN_INACTIVE);
-    DO_TEST_FULL("disk-active-commit", false, WHEN_ACTIVE);
+    DO_TEST("disk-mirror-old");
+    DO_TEST_FULL("disk-mirror", WHEN_ACTIVE);
+    DO_TEST_FULL("disk-mirror", WHEN_INACTIVE);
+    DO_TEST_FULL("disk-active-commit", WHEN_ACTIVE);
     DO_TEST("graphics-listen-network");
     DO_TEST("graphics-vnc");
     DO_TEST("graphics-vnc-websocket");
@@ -445,11 +430,11 @@  mymain(void)
     DO_TEST("serial-spiceport-nospice");
     DO_TEST("parallel-tcp");
     DO_TEST("console-compat");
-    DO_TEST_DIFFERENT("console-compat2");
+    DO_TEST("console-compat2");
     DO_TEST("console-virtio-many");
     DO_TEST("channel-guestfwd");
     DO_TEST("channel-virtio");
-    DO_TEST_DIFFERENT("channel-virtio-state");
+    DO_TEST("channel-virtio-state");
 
     DO_TEST("hostdev-usb-address");
     DO_TEST("hostdev-pci-address");
@@ -458,13 +443,13 @@  mymain(void)
     DO_TEST("pci-serial-dev-chardev");
 
     DO_TEST("encrypted-disk");
-    DO_TEST_DIFFERENT("memtune");
-    DO_TEST_DIFFERENT("memtune-unlimited");
+    DO_TEST("memtune");
+    DO_TEST("memtune-unlimited");
     DO_TEST("blkiotune");
     DO_TEST("blkiotune-device");
     DO_TEST("cputune");
     DO_TEST("cputune-zero-shares");
-    DO_TEST_DIFFERENT("cputune-iothreadsched");
+    DO_TEST("cputune-iothreadsched");
     DO_TEST("cputune-iothreadsched-zeropriority");
     DO_TEST("cputune-numatune");
     DO_TEST("vcpu-placement-static");
@@ -473,7 +458,7 @@  mymain(void)
     DO_TEST("iothreads");
     DO_TEST("iothreads-ids");
     DO_TEST("iothreads-ids-partial");
-    DO_TEST_DIFFERENT("cputune-iothreads");
+    DO_TEST("cputune-iothreads");
     DO_TEST("iothreads-disk");
     DO_TEST("iothreads-disk-virtio-ccw");
     DO_TEST("lease");
@@ -484,66 +469,66 @@  mymain(void)
     DO_TEST("virtio-lun");
 
     DO_TEST("usb-redir");
-    DO_TEST_DIFFERENT("usb-redir-filter");
-    DO_TEST_DIFFERENT("usb-redir-filter-version");
+    DO_TEST("usb-redir-filter");
+    DO_TEST("usb-redir-filter-version");
     DO_TEST("blkdeviotune");
-    DO_TEST_DIFFERENT("controller-usb-order");
+    DO_TEST("controller-usb-order");
 
-    DO_TEST_FULL("seclabel-dynamic-baselabel", false, WHEN_INACTIVE);
-    DO_TEST_FULL("seclabel-dynamic-override", false, WHEN_INACTIVE);
-    DO_TEST_FULL("seclabel-dynamic-labelskip", true, WHEN_INACTIVE);
-    DO_TEST_FULL("seclabel-dynamic-relabel", true, WHEN_INACTIVE);
+    DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE);
+    DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE);
+    DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE);
+    DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE);
     DO_TEST("seclabel-static");
-    DO_TEST_FULL("seclabel-static-labelskip", false, WHEN_ACTIVE);
-    DO_TEST_DIFFERENT("seclabel-none");
+    DO_TEST_FULL("seclabel-static-labelskip", WHEN_ACTIVE);
+    DO_TEST("seclabel-none");
     DO_TEST("seclabel-dac-none");
     DO_TEST("seclabel-dynamic-none");
     DO_TEST("seclabel-device-multiple");
-    DO_TEST_FULL("seclabel-dynamic-none-relabel", true, WHEN_INACTIVE);
+    DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE);
     DO_TEST("numad-static-vcpu-no-numatune");
     DO_TEST("disk-scsi-lun-passthrough-sgio");
 
     DO_TEST("disk-scsi-disk-vpd");
-    DO_TEST_DIFFERENT("disk-source-pool");
+    DO_TEST("disk-source-pool");
     DO_TEST("disk-source-pool-mode");
 
-    DO_TEST_DIFFERENT("disk-drive-discard");
+    DO_TEST("disk-drive-discard");
 
     DO_TEST("virtio-rng-random");
     DO_TEST("virtio-rng-egd");
 
     DO_TEST("pseries-nvram");
-    DO_TEST_DIFFERENT("pseries-panic-missing");
-    DO_TEST_DIFFERENT("pseries-panic-no-address");
+    DO_TEST("pseries-panic-missing");
+    DO_TEST("pseries-panic-no-address");
 
     /* These tests generate different XML */
-    DO_TEST_DIFFERENT("balloon-device-auto");
-    DO_TEST_DIFFERENT("balloon-device-period");
-    DO_TEST_DIFFERENT("channel-virtio-auto");
-    DO_TEST_DIFFERENT("console-compat-auto");
-    DO_TEST_DIFFERENT("disk-scsi-device-auto");
-    DO_TEST_DIFFERENT("console-virtio");
-    DO_TEST_DIFFERENT("serial-target-port-auto");
-    DO_TEST_DIFFERENT("graphics-listen-network2");
-    DO_TEST_DIFFERENT("graphics-spice-timeout");
-    DO_TEST_DIFFERENT("numad-auto-vcpu-no-numatune");
-    DO_TEST_DIFFERENT("numad-auto-memory-vcpu-no-cpuset-and-placement");
-    DO_TEST_DIFFERENT("numad-auto-memory-vcpu-cpuset");
-    DO_TEST_DIFFERENT("usb-ich9-ehci-addr");
-
-    DO_TEST_DIFFERENT("metadata");
-    DO_TEST_DIFFERENT("metadata-duplicate");
+    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("console-virtio");
+    DO_TEST("serial-target-port-auto");
+    DO_TEST("graphics-listen-network2");
+    DO_TEST("graphics-spice-timeout");
+    DO_TEST("numad-auto-vcpu-no-numatune");
+    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("metadata");
+    DO_TEST("metadata-duplicate");
 
     DO_TEST("tpm-passthrough");
     DO_TEST("pci-bridge");
-    DO_TEST_DIFFERENT("pci-bridge-many-disks");
-    DO_TEST_DIFFERENT("pci-autoadd-addr");
-    DO_TEST_DIFFERENT("pci-autoadd-idx");
-    DO_TEST_DIFFERENT("pcie-root");
-    DO_TEST_DIFFERENT("q35");
-    DO_TEST_DIFFERENT("q35-usb2");
-    DO_TEST_DIFFERENT("q35-usb2-multi");
-    DO_TEST_DIFFERENT("q35-usb2-reorder");
+    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");
@@ -558,7 +543,7 @@  mymain(void)
     DO_TEST("hostdev-scsi-sgio");
     DO_TEST("hostdev-scsi-rawio");
 
-    DO_TEST_DIFFERENT("hostdev-scsi-autogen-address");
+    DO_TEST("hostdev-scsi-autogen-address");
     DO_TEST("hostdev-scsi-large-unit");
 
     DO_TEST("hostdev-scsi-lsi-iscsi");
@@ -566,39 +551,39 @@  mymain(void)
     DO_TEST("hostdev-scsi-virtio-iscsi");
     DO_TEST("hostdev-scsi-virtio-iscsi-auth");
 
-    DO_TEST_DIFFERENT("s390-defaultconsole");
+    DO_TEST("s390-defaultconsole");
 
     DO_TEST("pcihole64");
-    DO_TEST_DIFFERENT("pcihole64-gib");
+    DO_TEST("pcihole64-gib");
     DO_TEST("pcihole64-none");
     DO_TEST("pcihole64-q35");
 
-    DO_TEST_DIFFERENT("panic");
+    DO_TEST("panic");
     DO_TEST("panic-isa");
     DO_TEST("panic-pseries");
     DO_TEST("panic-double");
     DO_TEST("panic-no-address");
 
-    DO_TEST_DIFFERENT("disk-backing-chains");
+    DO_TEST("disk-backing-chains");
 
     DO_TEST("chardev-label");
 
-    DO_TEST_DIFFERENT("cpu-numa1");
-    DO_TEST_DIFFERENT("cpu-numa2");
-    DO_TEST_DIFFERENT("cpu-numa-no-memory-element");
-    DO_TEST_DIFFERENT("cpu-numa-disordered");
+    DO_TEST("cpu-numa1");
+    DO_TEST("cpu-numa2");
+    DO_TEST("cpu-numa-no-memory-element");
+    DO_TEST("cpu-numa-disordered");
     DO_TEST("cpu-numa-disjoint");
     DO_TEST("cpu-numa-memshared");
 
-    DO_TEST_DIFFERENT("numatune-auto-prefer");
-    DO_TEST_DIFFERENT("numatune-memnode");
+    DO_TEST("numatune-auto-prefer");
+    DO_TEST("numatune-memnode");
     DO_TEST("numatune-memnode-no-memory");
 
     DO_TEST("bios-nvram");
-    DO_TEST_DIFFERENT("bios-nvram-os-interleave");
+    DO_TEST("bios-nvram-os-interleave");
 
     DO_TEST("tap-vhost");
-    DO_TEST_DIFFERENT("tap-vhost-incorrect");
+    DO_TEST("tap-vhost-incorrect");
     DO_TEST("shmem");
     DO_TEST("smbios");
     DO_TEST("smbios-multiple-type2");