[libvirt] [PATCH 0/9] qemu: Reflect USB controller model in guest XML

Patches 1-3 take care of some tiny nits; patches 4-7 clean up the test suite and add some new test cases that cover the code changed by subsequent patches. Patch 8 implements the feature advertised in the subject :) Patch 9 gets rid of some code that's no longer necessary after the changes. Andrea Bolognani (9): tests: qemuxml2argv: Remove useless GIC flags tests: qemuxml2argv: Fix usb-too-long-port-path-invalid tests: qemuxml2xml: Fix disk-mirror tests: qemuxml2xml: Use WHEN_BOTH for most tests tests: qemuxml2xml: Pass capabilities to DO_TEST() tests: qemuxml2xml: Use DO_TEST() for most tests tests: qemuxml2xml: Add some USB test cases qemu: domain: Reflect USB controller model in guest XML qemu: command: Simplify USB controller model selection src/qemu/qemu_command.c | 60 +- src/qemu/qemu_domain.c | 20 + tests/qemuxml2argvtest.c | 16 +- .../qemuxml2xmlout-ppc64-usb-controller-legacy.xml | 31 + .../qemuxml2xmlout-ppc64-usb-controller.xml | 31 + .../qemuxml2xmlout-usb-controller-default-q35.xml | 37 + .../qemuxml2xmlout-usb-controller-explicit-q35.xml | 37 + .../qemuxml2xmlout-usb-controller.xml | 27 + .../qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml | 25 + .../qemuxml2xmlout-usb-piix3-controller.xml | 27 + tests/qemuxml2xmltest.c | 932 ++++++++++----------- 11 files changed, 728 insertions(+), 515 deletions(-) create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-explicit-q35.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-piix3-controller.xml -- 2.7.4

DO_TEST_FAILURE() doesn't take a GIC version, but the GIC flag was passed anyway. Get rid of all such occurrences. --- tests/qemuxml2argvtest.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a5d51a8..f3df06b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1871,7 +1871,7 @@ mymain(void) DO_TEST_GIC("aarch64-gic-v2", GIC_BOTH, QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACH_VIRT_GIC_VERSION); - DO_TEST_FAILURE("aarch64-gic-v3", GIC_NONE, + DO_TEST_FAILURE("aarch64-gic-v3", QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT); DO_TEST_GIC("aarch64-gic-v3", GIC_NONE, QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, @@ -1885,7 +1885,7 @@ mymain(void) DO_TEST_GIC("aarch64-gic-v3", GIC_BOTH, QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACH_VIRT_GIC_VERSION); - DO_TEST_FAILURE("aarch64-gic-host", GIC_NONE, + DO_TEST_FAILURE("aarch64-gic-host", QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT); DO_TEST_GIC("aarch64-gic-host", GIC_NONE, QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, @@ -1899,13 +1899,13 @@ mymain(void) DO_TEST_GIC("aarch64-gic-host", GIC_BOTH, QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACH_VIRT_GIC_VERSION); - DO_TEST_PARSE_ERROR("aarch64-gic-invalid", GIC_NONE, + DO_TEST_PARSE_ERROR("aarch64-gic-invalid", QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACH_VIRT_GIC_VERSION); - DO_TEST_FAILURE("aarch64-gic-not-virt", GIC_NONE, + DO_TEST_FAILURE("aarch64-gic-not-virt", QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACH_VIRT_GIC_VERSION); - DO_TEST_FAILURE("aarch64-gic-not-arm", GIC_NONE, + DO_TEST_FAILURE("aarch64-gic-not-arm", QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACH_VIRT_GIC_VERSION); -- 2.7.4

The test case uses DO_TEST_PARSE_FLAGS_ERROR(), but doesn't pass any parse flag. Use DO_TEST_PARSE_ERROR() instead. --- tests/qemuxml2argvtest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f3df06b..751d692 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2064,9 +2064,9 @@ mymain(void) DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET); DO_TEST("usb-long-port-path", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_USB_HUB); - DO_TEST_PARSE_FLAGS_ERROR("usb-too-long-port-path-invalid", - QEMU_CAPS_CHARDEV, - QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_USB_HUB); + DO_TEST_PARSE_ERROR("usb-too-long-port-path-invalid", + QEMU_CAPS_CHARDEV, + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_USB_HUB); DO_TEST("acpi-table", NONE); DO_TEST("intel-iommu", QEMU_CAPS_DEVICE_PCI_BRIDGE, -- 2.7.4

Instead of testing it twice using WHEN_ACTIVE and WHEN_INACTIVE separately, just use WHEN_BOTH. --- tests/qemuxml2xmltest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5f04b8b..2af8245 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -477,8 +477,7 @@ mymain(void) QEMU_CAPS_SCSI_MPTSAS1068, QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-mirror-old"); - DO_TEST_FULL("disk-mirror", WHEN_ACTIVE, GIC_NONE, NONE); - DO_TEST_FULL("disk-mirror", WHEN_INACTIVE, GIC_NONE, NONE); + DO_TEST_FULL("disk-mirror", WHEN_BOTH, GIC_NONE, NONE); DO_TEST_FULL("disk-active-commit", WHEN_ACTIVE, GIC_NONE, NONE); DO_TEST("graphics-listen-network"); DO_TEST("graphics-vnc"); -- 2.7.4

It's not really broken. Maybe s/Fix/clean up/? On Fri, Jul 29, 2016 at 07:46:23PM +0200, Andrea Bolognani wrote:
Instead of testing it twice using WHEN_ACTIVE and WHEN_INACTIVE separately, just use WHEN_BOTH. --- tests/qemuxml2xmltest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5f04b8b..2af8245 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -477,8 +477,7 @@ mymain(void) QEMU_CAPS_SCSI_MPTSAS1068, QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-mirror-old"); - DO_TEST_FULL("disk-mirror", WHEN_ACTIVE, GIC_NONE, NONE); - DO_TEST_FULL("disk-mirror", WHEN_INACTIVE, GIC_NONE, NONE); + DO_TEST_FULL("disk-mirror", WHEN_BOTH, GIC_NONE, NONE); DO_TEST_FULL("disk-active-commit", WHEN_ACTIVE, GIC_NONE, NONE); DO_TEST("graphics-listen-network"); DO_TEST("graphics-vnc"); -- 2.7.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

A bunch of cases were only being tested for WHEN_ACTIVE or WHEN_INACTIVE. Use WHEN_BOTH for all except the very few that actually require the existing setup. --- tests/qemuxml2xmltest.c | 96 ++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 2af8245..aaceb6f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -450,29 +450,29 @@ mymain(void) DO_TEST("disk-drive-network-rbd-ipv6"); DO_TEST("disk-drive-network-rbd-ceph-env"); DO_TEST("disk-drive-network-sheepdog"); - DO_TEST_FULL("disk-scsi-device", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-scsi-device", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_LSI); DO_TEST("disk-scsi-vscsi"); - DO_TEST_FULL("disk-scsi-virtio-scsi", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-scsi-virtio-scsi", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-virtio-scsi-num_queues", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-virtio-scsi-num_queues", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-virtio-scsi-cmd_per_lun", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-virtio-scsi-cmd_per_lun", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-virtio-scsi-max_sectors", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-virtio-scsi-max_sectors", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-virtio-scsi-ioeventfd", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-virtio-scsi-ioeventfd", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-scsi-megasas", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-scsi-megasas", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_MEGASAS); - DO_TEST_FULL("disk-scsi-mptsas1068", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-scsi-mptsas1068", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_MPTSAS1068, QEMU_CAPS_SCSI_DISK_WWN); @@ -568,7 +568,7 @@ mymain(void) DO_TEST("cputune-iothreadsched"); DO_TEST("cputune-iothreadsched-zeropriority"); DO_TEST("cputune-numatune"); - DO_TEST_FULL("vcpu-placement-static", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("vcpu-placement-static", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE); DO_TEST("smp"); @@ -577,12 +577,12 @@ mymain(void) DO_TEST("iothreads-ids-partial"); DO_TEST("cputune-iothreads"); DO_TEST("iothreads-disk"); - DO_TEST_FULL("iothreads-disk-virtio-ccw", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("iothreads-disk-virtio-ccw", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); - DO_TEST_FULL("iothreads-virtio-scsi-pci", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("iothreads-virtio-scsi-pci", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("iothreads-virtio-scsi-ccw", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("iothreads-virtio-scsi-ccw", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); @@ -613,11 +613,11 @@ mymain(void) DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, GIC_NONE, NONE); DO_TEST("numad-static-vcpu-no-numatune"); - DO_TEST_FULL("disk-scsi-lun-passthrough-sgio", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-scsi-lun-passthrough-sgio", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); - DO_TEST_FULL("disk-scsi-disk-vpd", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-scsi-disk-vpd", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); @@ -638,7 +638,7 @@ mymain(void) DO_TEST("balloon-device-period"); DO_TEST("channel-virtio-auto"); DO_TEST("console-compat-auto"); - DO_TEST_FULL("disk-scsi-device-auto", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("disk-scsi-device-auto", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_LSI); DO_TEST("console-virtio"); @@ -655,38 +655,38 @@ mymain(void) DO_TEST("metadata"); DO_TEST("metadata-duplicate"); - DO_TEST_FULL("pci-bridge", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pci-bridge", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-bridge-many-disks", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pci-bridge-many-disks", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-autoadd-addr", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pci-autoadd-addr", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-autoadd-idx", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pci-autoadd-idx", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE); DO_TEST("pci-autofill-addr"); - DO_TEST_FULL("q35", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("q35", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("q35-usb2", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("q35-usb2", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("q35-usb2-multi", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("q35-usb2-multi", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("q35-usb2-reorder", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("q35-usb2-reorder", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI, @@ -694,45 +694,45 @@ mymain(void) QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pcie-root", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pcie-root", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pcie-root-port", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pcie-root-port", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pcie-switch-upstream-port", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pcie-switch-upstream-port", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pcie-switch-downstream-port", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pcie-switch-downstream-port", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pci-expander-bus", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pci-expander-bus", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_PXB); - DO_TEST_FULL("pcie-expander-bus", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pcie-expander-bus", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_DEVICE_X3130_UPSTREAM, QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM, QEMU_CAPS_DEVICE_PXB_PCIE); - DO_TEST_FULL("autoindex", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("autoindex", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420, @@ -742,47 +742,47 @@ mymain(void) QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_NEC_USB_XHCI); - DO_TEST_FULL("hostdev-scsi-lsi", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-lsi", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-virtio-scsi", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-virtio-scsi", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-readonly", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-readonly", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-shareable", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-shareable", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-sgio", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-sgio", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-rawio", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-rawio", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-autogen-address", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-autogen-address", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-large-unit", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-large-unit", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-lsi-iscsi", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-lsi-iscsi", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-lsi-iscsi-auth", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-lsi-iscsi-auth", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-virtio-iscsi", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-virtio-iscsi", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-virtio-iscsi-auth", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("hostdev-scsi-virtio-iscsi-auth", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("s390-defaultconsole", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("s390-defaultconsole", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST_FULL("s390-panic", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); @@ -794,7 +794,7 @@ mymain(void) DO_TEST("pcihole64"); DO_TEST("pcihole64-gib"); DO_TEST("pcihole64-none"); - DO_TEST_FULL("pcihole64-q35", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("pcihole64-q35", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI, @@ -832,17 +832,17 @@ mymain(void) DO_TEST("smbios"); DO_TEST("smbios-multiple-type2"); - DO_TEST_FULL("aarch64-aavmf-virtio-mmio", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("aarch64-aavmf-virtio-mmio", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST_FULL("aarch64-virtio-pci-default", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("aarch64-virtio-pci-default", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM, QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("aarch64-virtio-pci-manual-addresses", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("aarch64-virtio-pci-manual-addresses", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM, @@ -888,7 +888,7 @@ mymain(void) DO_TEST("video-qxl-heads"); DO_TEST("video-qxl-noheads"); - DO_TEST_FULL("intel-iommu", WHEN_ACTIVE, GIC_NONE, + DO_TEST_FULL("intel-iommu", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE); -- 2.7.4

This will allow us to remove most DO_TEST_FULL() usages. For the time being, just add the extra argument to all DO_TEST() calls. --- tests/qemuxml2xmltest.c | 528 ++++++++++++++++++++++++------------------------ 1 file changed, 264 insertions(+), 264 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index aaceb6f..86ce870 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -353,8 +353,8 @@ mymain(void) # define NONE QEMU_CAPS_LAST -# define DO_TEST(name) \ - DO_TEST_FULL(name, WHEN_BOTH, GIC_NONE, NONE) +# define DO_TEST(name, ...) \ + DO_TEST_FULL(name, WHEN_BOTH, GIC_NONE, __VA_ARGS__) @@ -363,97 +363,97 @@ mymain(void) * values for these envvars */ setenv("PATH", "/bin", 1); - DO_TEST("minimal"); - DO_TEST("machine-core-on"); - DO_TEST("machine-core-off"); - 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("boot-menu-disable-with-timeout"); - DO_TEST("boot-order"); - - DO_TEST("reboot-timeout-enabled"); - DO_TEST("reboot-timeout-disabled"); - - DO_TEST("clock-utc"); - DO_TEST("clock-localtime"); - DO_TEST("cpu-empty"); - DO_TEST("cpu-kvmclock"); - DO_TEST("cpu-host-kvmclock"); - DO_TEST("cpu-host-passthrough-features"); - DO_TEST("cpu-host-model-features"); - DO_TEST("clock-catchup"); - DO_TEST("kvmclock"); - DO_TEST("clock-timer-hyperv-rtc"); - - DO_TEST("cpu-eoi-disabled"); - DO_TEST("cpu-eoi-enabled"); - DO_TEST("eoi-disabled"); - DO_TEST("eoi-enabled"); - DO_TEST("pv-spinlock-disabled"); - DO_TEST("pv-spinlock-enabled"); - - DO_TEST("hyperv"); - DO_TEST("hyperv-off"); - DO_TEST("hyperv-panic"); - - DO_TEST("kvm-features"); - DO_TEST("kvm-features-off"); - - DO_TEST("pmu-feature"); - DO_TEST("pmu-feature-off"); - - DO_TEST("hugepages"); - DO_TEST("hugepages-pages"); - DO_TEST("hugepages-pages2"); - DO_TEST("hugepages-pages3"); - DO_TEST("hugepages-shared"); - DO_TEST("nosharepages"); - DO_TEST("restore-v2"); - DO_TEST("migrate"); - DO_TEST("qemu-ns-no-env"); - DO_TEST("disk-aio"); - DO_TEST("disk-cdrom"); - DO_TEST("disk-cdrom-empty"); - DO_TEST("disk-floppy"); - DO_TEST("disk-many"); - DO_TEST("disk-usb-device"); - DO_TEST("disk-virtio"); - DO_TEST("floppy-drive-fat"); - DO_TEST("disk-drive-boot-disk"); - DO_TEST("disk-drive-boot-cdrom"); - DO_TEST("disk-drive-error-policy-stop"); - DO_TEST("disk-drive-error-policy-enospace"); - DO_TEST("disk-drive-error-policy-wreport-rignore"); - DO_TEST("disk-drive-fmt-qcow"); - DO_TEST("disk-drive-copy-on-read"); - DO_TEST("disk-drive-cache-v2-wt"); - DO_TEST("disk-drive-cache-v2-wb"); - DO_TEST("disk-drive-cache-v2-none"); - DO_TEST("disk-drive-cache-directsync"); - DO_TEST("disk-drive-cache-unsafe"); - DO_TEST("disk-drive-network-nbd"); - DO_TEST("disk-drive-network-nbd-export"); - DO_TEST("disk-drive-network-nbd-ipv6"); - DO_TEST("disk-drive-network-nbd-ipv6-export"); - DO_TEST("disk-drive-network-nbd-unix"); - DO_TEST("disk-drive-network-iscsi"); - DO_TEST("disk-drive-network-iscsi-auth"); - DO_TEST("disk-drive-network-gluster"); - DO_TEST("disk-drive-network-rbd"); - DO_TEST("disk-drive-network-rbd-auth"); - DO_TEST("disk-drive-network-rbd-ipv6"); - DO_TEST("disk-drive-network-rbd-ceph-env"); - DO_TEST("disk-drive-network-sheepdog"); + DO_TEST("minimal", NONE); + DO_TEST("machine-core-on", NONE); + DO_TEST("machine-core-off", NONE); + DO_TEST("default-kvm-host-arch", NONE); + DO_TEST("default-qemu-host-arch", NONE); + DO_TEST("boot-cdrom", NONE); + DO_TEST("boot-network", NONE); + DO_TEST("boot-floppy", NONE); + DO_TEST("boot-multi", NONE); + DO_TEST("boot-menu-enable-with-timeout", NONE); + DO_TEST("boot-menu-disable", NONE); + DO_TEST("boot-menu-disable-with-timeout", NONE); + DO_TEST("boot-order", NONE); + + DO_TEST("reboot-timeout-enabled", NONE); + DO_TEST("reboot-timeout-disabled", NONE); + + DO_TEST("clock-utc", NONE); + DO_TEST("clock-localtime", NONE); + DO_TEST("cpu-empty", NONE); + DO_TEST("cpu-kvmclock", NONE); + DO_TEST("cpu-host-kvmclock", NONE); + DO_TEST("cpu-host-passthrough-features", NONE); + DO_TEST("cpu-host-model-features", NONE); + DO_TEST("clock-catchup", NONE); + DO_TEST("kvmclock", NONE); + DO_TEST("clock-timer-hyperv-rtc", NONE); + + DO_TEST("cpu-eoi-disabled", NONE); + DO_TEST("cpu-eoi-enabled", NONE); + DO_TEST("eoi-disabled", NONE); + DO_TEST("eoi-enabled", NONE); + DO_TEST("pv-spinlock-disabled", NONE); + DO_TEST("pv-spinlock-enabled", NONE); + + DO_TEST("hyperv", NONE); + DO_TEST("hyperv-off", NONE); + DO_TEST("hyperv-panic", NONE); + + DO_TEST("kvm-features", NONE); + DO_TEST("kvm-features-off", NONE); + + DO_TEST("pmu-feature", NONE); + DO_TEST("pmu-feature-off", NONE); + + DO_TEST("hugepages", NONE); + DO_TEST("hugepages-pages", NONE); + DO_TEST("hugepages-pages2", NONE); + DO_TEST("hugepages-pages3", NONE); + DO_TEST("hugepages-shared", NONE); + DO_TEST("nosharepages", NONE); + DO_TEST("restore-v2", NONE); + DO_TEST("migrate", NONE); + DO_TEST("qemu-ns-no-env", NONE); + DO_TEST("disk-aio", NONE); + DO_TEST("disk-cdrom", NONE); + DO_TEST("disk-cdrom-empty", NONE); + DO_TEST("disk-floppy", NONE); + DO_TEST("disk-many", NONE); + DO_TEST("disk-usb-device", NONE); + DO_TEST("disk-virtio", NONE); + DO_TEST("floppy-drive-fat", NONE); + DO_TEST("disk-drive-boot-disk", NONE); + DO_TEST("disk-drive-boot-cdrom", NONE); + DO_TEST("disk-drive-error-policy-stop", NONE); + DO_TEST("disk-drive-error-policy-enospace", NONE); + DO_TEST("disk-drive-error-policy-wreport-rignore", NONE); + DO_TEST("disk-drive-fmt-qcow", NONE); + DO_TEST("disk-drive-copy-on-read", NONE); + DO_TEST("disk-drive-cache-v2-wt", NONE); + DO_TEST("disk-drive-cache-v2-wb", NONE); + DO_TEST("disk-drive-cache-v2-none", NONE); + DO_TEST("disk-drive-cache-directsync", NONE); + DO_TEST("disk-drive-cache-unsafe", NONE); + DO_TEST("disk-drive-network-nbd", NONE); + DO_TEST("disk-drive-network-nbd-export", NONE); + DO_TEST("disk-drive-network-nbd-ipv6", NONE); + DO_TEST("disk-drive-network-nbd-ipv6-export", NONE); + DO_TEST("disk-drive-network-nbd-unix", NONE); + DO_TEST("disk-drive-network-iscsi", NONE); + DO_TEST("disk-drive-network-iscsi-auth", NONE); + DO_TEST("disk-drive-network-gluster", NONE); + DO_TEST("disk-drive-network-rbd", NONE); + DO_TEST("disk-drive-network-rbd-auth", NONE); + DO_TEST("disk-drive-network-rbd-ipv6", NONE); + DO_TEST("disk-drive-network-rbd-ceph-env", NONE); + DO_TEST("disk-drive-network-sheepdog", NONE); DO_TEST_FULL("disk-scsi-device", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_LSI); - DO_TEST("disk-scsi-vscsi"); + DO_TEST("disk-scsi-vscsi", NONE); DO_TEST_FULL("disk-scsi-virtio-scsi", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); @@ -476,107 +476,107 @@ mymain(void) QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_MPTSAS1068, QEMU_CAPS_SCSI_DISK_WWN); - DO_TEST("disk-mirror-old"); + DO_TEST("disk-mirror-old", NONE); DO_TEST_FULL("disk-mirror", WHEN_BOTH, GIC_NONE, NONE); DO_TEST_FULL("disk-active-commit", WHEN_ACTIVE, GIC_NONE, NONE); - DO_TEST("graphics-listen-network"); - DO_TEST("graphics-vnc"); - DO_TEST("graphics-vnc-websocket"); - DO_TEST("graphics-vnc-sasl"); - DO_TEST("graphics-vnc-tls"); - DO_TEST("graphics-vnc-no-listen-attr"); - DO_TEST("graphics-vnc-remove-generated-socket"); + DO_TEST("graphics-listen-network", NONE); + DO_TEST("graphics-vnc", NONE); + DO_TEST("graphics-vnc-websocket", NONE); + DO_TEST("graphics-vnc-sasl", NONE); + DO_TEST("graphics-vnc-tls", NONE); + DO_TEST("graphics-vnc-no-listen-attr", NONE); + DO_TEST("graphics-vnc-remove-generated-socket", NONE); cfg->vncAutoUnixSocket = true; - DO_TEST("graphics-vnc-auto-socket-cfg"); + DO_TEST("graphics-vnc-auto-socket-cfg", NONE); cfg->vncAutoUnixSocket = false; - DO_TEST("graphics-vnc-socket"); - DO_TEST("graphics-vnc-auto-socket"); - - DO_TEST("graphics-sdl"); - DO_TEST("graphics-sdl-fullscreen"); - DO_TEST("graphics-spice"); - DO_TEST("graphics-spice-compression"); - DO_TEST("graphics-spice-qxl-vga"); - DO_TEST("graphics-spice-socket"); - DO_TEST("graphics-spice-auto-socket"); + DO_TEST("graphics-vnc-socket", NONE); + DO_TEST("graphics-vnc-auto-socket", NONE); + + DO_TEST("graphics-sdl", NONE); + DO_TEST("graphics-sdl-fullscreen", NONE); + DO_TEST("graphics-spice", NONE); + DO_TEST("graphics-spice-compression", NONE); + DO_TEST("graphics-spice-qxl-vga", NONE); + DO_TEST("graphics-spice-socket", NONE); + DO_TEST("graphics-spice-auto-socket", NONE); cfg->spiceAutoUnixSocket = true; - DO_TEST("graphics-spice-auto-socket-cfg"); + DO_TEST("graphics-spice-auto-socket-cfg", NONE); cfg->spiceAutoUnixSocket = false; DO_TEST_FULL("nographics-vga", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DISPLAY); - DO_TEST("input-usbmouse"); - DO_TEST("input-usbtablet"); - DO_TEST("misc-acpi"); - DO_TEST("misc-disable-s3"); - DO_TEST("misc-disable-suspends"); - DO_TEST("misc-enable-s4"); - DO_TEST("misc-no-reboot"); - DO_TEST("misc-uuid"); - DO_TEST("net-vhostuser"); - DO_TEST("net-user"); - DO_TEST("net-virtio"); - DO_TEST("net-virtio-device"); - DO_TEST("net-virtio-disable-offloads"); - DO_TEST("net-eth"); - DO_TEST("net-eth-ifname"); - DO_TEST("net-eth-hostip"); - DO_TEST("net-virtio-network-portgroup"); - DO_TEST("net-hostdev"); - DO_TEST("net-hostdev-vfio"); - DO_TEST("net-midonet"); - DO_TEST("net-openvswitch"); - DO_TEST("sound"); - DO_TEST("sound-device"); - DO_TEST("watchdog"); - DO_TEST("net-bandwidth"); - DO_TEST("net-bandwidth2"); - - DO_TEST("serial-vc"); - DO_TEST("serial-pty"); - DO_TEST("serial-dev"); - DO_TEST("serial-file"); - DO_TEST("serial-unix"); - DO_TEST("serial-tcp"); - DO_TEST("serial-udp"); - DO_TEST("serial-tcp-telnet"); - DO_TEST("serial-many"); - DO_TEST("serial-spiceport"); - DO_TEST("serial-spiceport-nospice"); - DO_TEST("parallel-tcp"); - DO_TEST("console-compat"); - DO_TEST("console-compat2"); - DO_TEST("console-virtio-many"); - DO_TEST("channel-guestfwd"); - DO_TEST("channel-virtio"); - DO_TEST("channel-virtio-state"); - - DO_TEST("hostdev-usb-address"); - DO_TEST("hostdev-pci-address"); - DO_TEST("hostdev-vfio"); - DO_TEST("pci-rom"); - DO_TEST("pci-serial-dev-chardev"); - - DO_TEST("encrypted-disk"); - DO_TEST("encrypted-disk-usage"); - DO_TEST("luks-disks"); - DO_TEST("memtune"); - DO_TEST("memtune-unlimited"); - DO_TEST("blkiotune"); - DO_TEST("blkiotune-device"); - DO_TEST("cputune"); - DO_TEST("cputune-zero-shares"); - DO_TEST("cputune-iothreadsched"); - DO_TEST("cputune-iothreadsched-zeropriority"); - DO_TEST("cputune-numatune"); + DO_TEST("input-usbmouse", NONE); + DO_TEST("input-usbtablet", NONE); + DO_TEST("misc-acpi", NONE); + DO_TEST("misc-disable-s3", NONE); + DO_TEST("misc-disable-suspends", NONE); + DO_TEST("misc-enable-s4", NONE); + DO_TEST("misc-no-reboot", NONE); + DO_TEST("misc-uuid", NONE); + DO_TEST("net-vhostuser", NONE); + DO_TEST("net-user", NONE); + DO_TEST("net-virtio", NONE); + DO_TEST("net-virtio-device", NONE); + DO_TEST("net-virtio-disable-offloads", NONE); + DO_TEST("net-eth", NONE); + DO_TEST("net-eth-ifname", NONE); + DO_TEST("net-eth-hostip", NONE); + DO_TEST("net-virtio-network-portgroup", NONE); + DO_TEST("net-hostdev", NONE); + DO_TEST("net-hostdev-vfio", NONE); + DO_TEST("net-midonet", NONE); + DO_TEST("net-openvswitch", NONE); + DO_TEST("sound", NONE); + DO_TEST("sound-device", NONE); + DO_TEST("watchdog", NONE); + DO_TEST("net-bandwidth", NONE); + DO_TEST("net-bandwidth2", NONE); + + DO_TEST("serial-vc", NONE); + DO_TEST("serial-pty", NONE); + DO_TEST("serial-dev", NONE); + DO_TEST("serial-file", NONE); + DO_TEST("serial-unix", NONE); + DO_TEST("serial-tcp", NONE); + DO_TEST("serial-udp", NONE); + DO_TEST("serial-tcp-telnet", NONE); + DO_TEST("serial-many", NONE); + DO_TEST("serial-spiceport", NONE); + DO_TEST("serial-spiceport-nospice", NONE); + DO_TEST("parallel-tcp", NONE); + DO_TEST("console-compat", NONE); + DO_TEST("console-compat2", NONE); + DO_TEST("console-virtio-many", NONE); + DO_TEST("channel-guestfwd", NONE); + DO_TEST("channel-virtio", NONE); + DO_TEST("channel-virtio-state", NONE); + + DO_TEST("hostdev-usb-address", NONE); + DO_TEST("hostdev-pci-address", NONE); + DO_TEST("hostdev-vfio", NONE); + DO_TEST("pci-rom", NONE); + DO_TEST("pci-serial-dev-chardev", NONE); + + DO_TEST("encrypted-disk", NONE); + DO_TEST("encrypted-disk-usage", NONE); + DO_TEST("luks-disks", NONE); + DO_TEST("memtune", NONE); + DO_TEST("memtune-unlimited", NONE); + DO_TEST("blkiotune", NONE); + DO_TEST("blkiotune-device", NONE); + DO_TEST("cputune", NONE); + DO_TEST("cputune-zero-shares", NONE); + DO_TEST("cputune-iothreadsched", NONE); + DO_TEST("cputune-iothreadsched-zeropriority", NONE); + DO_TEST("cputune-numatune", NONE); DO_TEST_FULL("vcpu-placement-static", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST("smp"); - DO_TEST("iothreads"); - DO_TEST("iothreads-ids"); - DO_TEST("iothreads-ids-partial"); - DO_TEST("cputune-iothreads"); - DO_TEST("iothreads-disk"); + DO_TEST("smp", NONE); + DO_TEST("iothreads", NONE); + DO_TEST("iothreads-ids", NONE); + DO_TEST("iothreads-ids-partial", NONE); + DO_TEST("cputune-iothreads", NONE); + DO_TEST("iothreads-disk", NONE); DO_TEST_FULL("iothreads-disk-virtio-ccw", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST_FULL("iothreads-virtio-scsi-pci", WHEN_BOTH, GIC_NONE, @@ -586,32 +586,32 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); - DO_TEST("lease"); - DO_TEST("event_idx"); - DO_TEST("vhost_queues"); - DO_TEST("interface-driver"); - DO_TEST("interface-server"); - DO_TEST("virtio-lun"); - - DO_TEST("usb-port-missing"); - DO_TEST("usb-redir"); - DO_TEST("usb-redir-filter"); - DO_TEST("usb-redir-filter-version"); - DO_TEST("blkdeviotune"); - DO_TEST("controller-usb-order"); + DO_TEST("lease", NONE); + DO_TEST("event_idx", NONE); + DO_TEST("vhost_queues", NONE); + DO_TEST("interface-driver", NONE); + DO_TEST("interface-server", NONE); + DO_TEST("virtio-lun", NONE); + + DO_TEST("usb-port-missing", NONE); + DO_TEST("usb-redir", NONE); + DO_TEST("usb-redir-filter", NONE); + DO_TEST("usb-redir-filter-version", NONE); + DO_TEST("blkdeviotune", NONE); + DO_TEST("controller-usb-order", NONE); DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, GIC_NONE, NONE); DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE, GIC_NONE, NONE); DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE, GIC_NONE, NONE); DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE, GIC_NONE, NONE); - DO_TEST("seclabel-static"); + DO_TEST("seclabel-static", NONE); DO_TEST_FULL("seclabel-static-labelskip", WHEN_ACTIVE, GIC_NONE, NONE); - DO_TEST("seclabel-none"); - DO_TEST("seclabel-dac-none"); - DO_TEST("seclabel-dynamic-none"); - DO_TEST("seclabel-device-multiple"); + DO_TEST("seclabel-none", NONE); + DO_TEST("seclabel-dac-none", NONE); + DO_TEST("seclabel-dynamic-none", NONE); + DO_TEST("seclabel-device-multiple", NONE); DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, GIC_NONE, NONE); - DO_TEST("numad-static-vcpu-no-numatune"); + DO_TEST("numad-static-vcpu-no-numatune", NONE); DO_TEST_FULL("disk-scsi-lun-passthrough-sgio", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, @@ -621,39 +621,39 @@ mymain(void) QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); - DO_TEST("disk-source-pool"); - DO_TEST("disk-source-pool-mode"); + DO_TEST("disk-source-pool", NONE); + DO_TEST("disk-source-pool-mode", NONE); - DO_TEST("disk-drive-discard"); - DO_TEST("disk-drive-detect-zeroes"); + DO_TEST("disk-drive-discard", NONE); + DO_TEST("disk-drive-detect-zeroes", NONE); - DO_TEST("virtio-rng-random"); - DO_TEST("virtio-rng-egd"); + DO_TEST("virtio-rng-random", NONE); + DO_TEST("virtio-rng-egd", NONE); - DO_TEST("pseries-nvram"); - DO_TEST("pseries-panic-missing"); - DO_TEST("pseries-panic-no-address"); + DO_TEST("pseries-nvram", NONE); + DO_TEST("pseries-panic-missing", NONE); + DO_TEST("pseries-panic-no-address", NONE); - DO_TEST("balloon-device-auto"); - DO_TEST("balloon-device-period"); - DO_TEST("channel-virtio-auto"); - DO_TEST("console-compat-auto"); + DO_TEST("balloon-device-auto", NONE); + DO_TEST("balloon-device-period", NONE); + DO_TEST("channel-virtio-auto", NONE); + DO_TEST("console-compat-auto", NONE); DO_TEST_FULL("disk-scsi-device-auto", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_LSI); - 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("disk-copy_on_read"); - DO_TEST("tpm-passthrough"); - - DO_TEST("metadata"); - DO_TEST("metadata-duplicate"); + DO_TEST("console-virtio", NONE); + DO_TEST("serial-target-port-auto", NONE); + DO_TEST("graphics-listen-network2", NONE); + DO_TEST("graphics-spice-timeout", NONE); + DO_TEST("numad-auto-vcpu-no-numatune", NONE); + DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE); + DO_TEST("numad-auto-memory-vcpu-cpuset", NONE); + DO_TEST("usb-ich9-ehci-addr", NONE); + DO_TEST("disk-copy_on_read", NONE); + DO_TEST("tpm-passthrough", NONE); + + DO_TEST("metadata", NONE); + DO_TEST("metadata-duplicate", NONE); DO_TEST_FULL("pci-bridge", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE); @@ -663,7 +663,7 @@ mymain(void) QEMU_CAPS_DEVICE_PCI_BRIDGE); DO_TEST_FULL("pci-autoadd-idx", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST("pci-autofill-addr"); + DO_TEST("pci-autofill-addr", NONE); DO_TEST_FULL("q35", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, @@ -791,9 +791,9 @@ mymain(void) DO_TEST_FULL("s390-panic-no-address", WHEN_BOTH, GIC_NONE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); - DO_TEST("pcihole64"); - DO_TEST("pcihole64-gib"); - DO_TEST("pcihole64-none"); + DO_TEST("pcihole64", NONE); + DO_TEST("pcihole64-gib", NONE); + DO_TEST("pcihole64-none", NONE); DO_TEST_FULL("pcihole64-q35", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, @@ -802,35 +802,35 @@ mymain(void) QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_Q35_PCI_HOLE64_SIZE); - DO_TEST("panic"); - DO_TEST("panic-isa"); - DO_TEST("panic-pseries"); - DO_TEST("panic-double"); - DO_TEST("panic-no-address"); + DO_TEST("panic", NONE); + DO_TEST("panic-isa", NONE); + DO_TEST("panic-pseries", NONE); + DO_TEST("panic-double", NONE); + DO_TEST("panic-no-address", NONE); - DO_TEST("disk-backing-chains"); + DO_TEST("disk-backing-chains", NONE); - DO_TEST("chardev-label"); + DO_TEST("chardev-label", NONE); - 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("cpu-numa1", NONE); + DO_TEST("cpu-numa2", NONE); + DO_TEST("cpu-numa-no-memory-element", NONE); + DO_TEST("cpu-numa-disordered", NONE); + DO_TEST("cpu-numa-disjoint", NONE); + DO_TEST("cpu-numa-memshared", NONE); - DO_TEST("numatune-auto-prefer"); - DO_TEST("numatune-memnode"); - DO_TEST("numatune-memnode-no-memory"); + DO_TEST("numatune-auto-prefer", NONE); + DO_TEST("numatune-memnode", NONE); + DO_TEST("numatune-memnode-no-memory", NONE); - DO_TEST("bios-nvram"); - DO_TEST("bios-nvram-os-interleave"); + DO_TEST("bios-nvram", NONE); + DO_TEST("bios-nvram-os-interleave", NONE); - DO_TEST("tap-vhost"); - DO_TEST("tap-vhost-incorrect"); - DO_TEST("shmem"); - DO_TEST("smbios"); - DO_TEST("smbios-multiple-type2"); + DO_TEST("tap-vhost", NONE); + DO_TEST("tap-vhost-incorrect", NONE); + DO_TEST("shmem", NONE); + DO_TEST("smbios", NONE); + DO_TEST("smbios-multiple-type2", NONE); DO_TEST_FULL("aarch64-aavmf-virtio-mmio", WHEN_BOTH, GIC_NONE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, @@ -870,23 +870,23 @@ mymain(void) DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V3, NONE); DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST("memory-hotplug"); - DO_TEST("memory-hotplug-nonuma"); - DO_TEST("memory-hotplug-dimm"); - DO_TEST("net-udp"); + DO_TEST("memory-hotplug", NONE); + DO_TEST("memory-hotplug-nonuma", NONE); + DO_TEST("memory-hotplug-dimm", NONE); + DO_TEST("net-udp", NONE); - DO_TEST("video-virtio-gpu-device"); - DO_TEST("video-virtio-gpu-virgl"); - DO_TEST("video-virtio-gpu-spice-gl"); - DO_TEST("virtio-input"); - DO_TEST("virtio-input-passthrough"); + DO_TEST("video-virtio-gpu-device", NONE); + DO_TEST("video-virtio-gpu-virgl", NONE); + DO_TEST("video-virtio-gpu-spice-gl", NONE); + DO_TEST("virtio-input", NONE); + DO_TEST("virtio-input-passthrough", NONE); virObjectUnref(cfg); - DO_TEST("acpi-table"); + DO_TEST("acpi-table", NONE); - DO_TEST("video-qxl-heads"); - DO_TEST("video-qxl-noheads"); + DO_TEST("video-qxl-heads", NONE); + DO_TEST("video-qxl-noheads", NONE); DO_TEST_FULL("intel-iommu", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DEVICE_PCI_BRIDGE, -- 2.7.4

On Fri, Jul 29, 2016 at 07:46:25PM +0200, Andrea Bolognani wrote:
This will allow us to remove most DO_TEST_FULL() usages. For the time being, just add the extra argument to all DO_TEST() calls. ---
An alternative would be to add DO_TEST_CAPS with that semantics, but we already have enough DO_TEST macros. Jan

Now that DO_TEST() can be passed capabilities, there is little need to use DO_TEST_FULL() instead of DO_TEST(). --- tests/qemuxml2xmltest.c | 353 ++++++++++++++++++++++-------------------------- 1 file changed, 158 insertions(+), 195 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 86ce870..9a9bf5a 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -450,34 +450,26 @@ mymain(void) DO_TEST("disk-drive-network-rbd-ipv6", NONE); DO_TEST("disk-drive-network-rbd-ceph-env", NONE); DO_TEST("disk-drive-network-sheepdog", NONE); - DO_TEST_FULL("disk-scsi-device", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_SCSI_LSI); + DO_TEST("disk-scsi-device", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_LSI); DO_TEST("disk-scsi-vscsi", NONE); - DO_TEST_FULL("disk-scsi-virtio-scsi", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-virtio-scsi-num_queues", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-virtio-scsi-cmd_per_lun", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-virtio-scsi-max_sectors", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-virtio-scsi-ioeventfd", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("disk-scsi-megasas", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_SCSI_MEGASAS); - DO_TEST_FULL("disk-scsi-mptsas1068", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_SCSI_MPTSAS1068, - QEMU_CAPS_SCSI_DISK_WWN); + DO_TEST("disk-scsi-virtio-scsi", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); + DO_TEST("disk-virtio-scsi-num_queues", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); + DO_TEST("disk-virtio-scsi-cmd_per_lun", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); + DO_TEST("disk-virtio-scsi-max_sectors", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); + DO_TEST("disk-virtio-scsi-ioeventfd", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); + DO_TEST("disk-scsi-megasas", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_MEGASAS); + DO_TEST("disk-scsi-mptsas1068", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_MPTSAS1068, + QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-mirror-old", NONE); - DO_TEST_FULL("disk-mirror", WHEN_BOTH, GIC_NONE, NONE); + DO_TEST("disk-mirror", NONE); DO_TEST_FULL("disk-active-commit", WHEN_ACTIVE, GIC_NONE, NONE); DO_TEST("graphics-listen-network", NONE); DO_TEST("graphics-vnc", NONE); @@ -503,7 +495,7 @@ mymain(void) DO_TEST("graphics-spice-auto-socket-cfg", NONE); cfg->spiceAutoUnixSocket = false; - DO_TEST_FULL("nographics-vga", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DISPLAY); + DO_TEST("nographics-vga", QEMU_CAPS_DISPLAY); DO_TEST("input-usbmouse", NONE); DO_TEST("input-usbtablet", NONE); DO_TEST("misc-acpi", NONE); @@ -568,8 +560,8 @@ mymain(void) DO_TEST("cputune-iothreadsched", NONE); DO_TEST("cputune-iothreadsched-zeropriority", NONE); DO_TEST("cputune-numatune", NONE); - DO_TEST_FULL("vcpu-placement-static", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("vcpu-placement-static", + QEMU_CAPS_DEVICE_PCI_BRIDGE); DO_TEST("smp", NONE); DO_TEST("iothreads", NONE); @@ -577,15 +569,13 @@ mymain(void) DO_TEST("iothreads-ids-partial", NONE); DO_TEST("cputune-iothreads", NONE); DO_TEST("iothreads-disk", NONE); - DO_TEST_FULL("iothreads-disk-virtio-ccw", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); - DO_TEST_FULL("iothreads-virtio-scsi-pci", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("iothreads-virtio-scsi-ccw", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, - QEMU_CAPS_VIRTIO_CCW, - QEMU_CAPS_VIRTIO_S390); + DO_TEST("iothreads-disk-virtio-ccw", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("iothreads-virtio-scsi-pci", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI); + DO_TEST("iothreads-virtio-scsi-ccw", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390); DO_TEST("lease", NONE); DO_TEST("event_idx", NONE); DO_TEST("vhost_queues", NONE); @@ -613,14 +603,12 @@ mymain(void) DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, GIC_NONE, NONE); DO_TEST("numad-static-vcpu-no-numatune", NONE); - DO_TEST_FULL("disk-scsi-lun-passthrough-sgio", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, - QEMU_CAPS_SCSI_DISK_WWN); - DO_TEST_FULL("disk-scsi-disk-vpd", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, - QEMU_CAPS_SCSI_DISK_WWN); + DO_TEST("disk-scsi-lun-passthrough-sgio", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); + DO_TEST("disk-scsi-disk-vpd", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); DO_TEST("disk-source-pool", NONE); DO_TEST("disk-source-pool-mode", NONE); @@ -638,9 +626,8 @@ mymain(void) DO_TEST("balloon-device-period", NONE); DO_TEST("channel-virtio-auto", NONE); DO_TEST("console-compat-auto", NONE); - DO_TEST_FULL("disk-scsi-device-auto", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_SCSI_LSI); + DO_TEST("disk-scsi-device-auto", + QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SCSI_LSI); DO_TEST("console-virtio", NONE); DO_TEST("serial-target-port-auto", NONE); DO_TEST("graphics-listen-network2", NONE); @@ -655,152 +642,129 @@ mymain(void) DO_TEST("metadata", NONE); DO_TEST("metadata-duplicate", NONE); - DO_TEST_FULL("pci-bridge", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-bridge-many-disks", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-autoadd-addr", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-autoadd-idx", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-bridge", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-bridge-many-disks", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-autoadd-addr", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-autoadd-idx", + QEMU_CAPS_DEVICE_PCI_BRIDGE); DO_TEST("pci-autofill-addr", NONE); - DO_TEST_FULL("q35", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("q35-usb2", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("q35-usb2-multi", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("q35-usb2-reorder", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - - DO_TEST_FULL("pcie-root", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pcie-root-port", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pcie-switch-upstream-port", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pcie-switch-downstream-port", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); - DO_TEST_FULL("pci-expander-bus", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PXB); - DO_TEST_FULL("pcie-expander-bus", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_DEVICE_X3130_UPSTREAM, - QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM, - QEMU_CAPS_DEVICE_PXB_PCIE); - DO_TEST_FULL("autoindex", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_DEVICE_X3130_UPSTREAM, - QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_NEC_USB_XHCI); - - DO_TEST_FULL("hostdev-scsi-lsi", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-virtio-scsi", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-readonly", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - - DO_TEST_FULL("hostdev-scsi-shareable", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-sgio", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-rawio", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - - DO_TEST_FULL("hostdev-scsi-autogen-address", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-large-unit", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - - DO_TEST_FULL("hostdev-scsi-lsi-iscsi", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-lsi-iscsi-auth", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-virtio-iscsi", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - DO_TEST_FULL("hostdev-scsi-virtio-iscsi-auth", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, - QEMU_CAPS_DEVICE_SCSI_GENERIC); - - DO_TEST_FULL("s390-defaultconsole", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); - DO_TEST_FULL("s390-panic", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); - DO_TEST_FULL("s390-panic-missing", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); - DO_TEST_FULL("s390-panic-no-address", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("q35", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION, + QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); + DO_TEST("q35-usb2", + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_ICH9_AHCI, + QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); + DO_TEST("q35-usb2-multi", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION, + QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); + DO_TEST("q35-usb2-reorder", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION, + QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); + + DO_TEST("pcie-root", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_DEVICE_QXL); + DO_TEST("pcie-root-port", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_DEVICE_QXL); + DO_TEST("pcie-switch-upstream-port", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_DEVICE_QXL); + DO_TEST("pcie-switch-downstream-port", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_DEVICE_QXL); + DO_TEST("pci-expander-bus", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_PXB); + DO_TEST("pcie-expander-bus", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_DEVICE_X3130_UPSTREAM, + QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM, QEMU_CAPS_DEVICE_PXB_PCIE); + DO_TEST("autoindex", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_DEVICE_X3130_UPSTREAM, + QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM, QEMU_CAPS_ICH9_AHCI, + QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1, + QEMU_CAPS_NEC_USB_XHCI); + + DO_TEST("hostdev-scsi-lsi", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-virtio-scsi", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-readonly", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + + DO_TEST("hostdev-scsi-shareable", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-sgio", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-rawio", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + + DO_TEST("hostdev-scsi-autogen-address", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-large-unit", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + + DO_TEST("hostdev-scsi-lsi-iscsi", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-lsi-iscsi-auth", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-virtio-iscsi", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-virtio-iscsi-auth", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); + + DO_TEST("s390-defaultconsole", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-panic", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-panic-missing", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-panic-no-address", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST("pcihole64", NONE); DO_TEST("pcihole64-gib", NONE); DO_TEST("pcihole64-none", NONE); - DO_TEST_FULL("pcihole64-q35", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL, - QEMU_CAPS_Q35_PCI_HOLE64_SIZE); + DO_TEST("pcihole64-q35", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_Q35_PCI_HOLE64_SIZE); DO_TEST("panic", NONE); DO_TEST("panic-isa", NONE); @@ -832,17 +796,17 @@ mymain(void) DO_TEST("smbios", NONE); DO_TEST("smbios-multiple-type2", NONE); - DO_TEST_FULL("aarch64-aavmf-virtio-mmio", WHEN_BOTH, GIC_NONE, + DO_TEST("aarch64-aavmf-virtio-mmio", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST_FULL("aarch64-virtio-pci-default", WHEN_BOTH, GIC_NONE, + DO_TEST("aarch64-virtio-pci-default", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM, QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FULL("aarch64-virtio-pci-manual-addresses", WHEN_BOTH, GIC_NONE, + DO_TEST("aarch64-virtio-pci-manual-addresses", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM, @@ -888,9 +852,8 @@ mymain(void) DO_TEST("video-qxl-heads", NONE); DO_TEST("video-qxl-noheads", NONE); - DO_TEST_FULL("intel-iommu", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE); + DO_TEST("intel-iommu", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE); qemuTestDriverFree(&driver); -- 2.7.4

On Fri, Jul 29, 2016 at 07:46:26PM +0200, Andrea Bolognani wrote:
Now that DO_TEST() can be passed capabilities, there is little need to use DO_TEST_FULL() instead of DO_TEST(). --- tests/qemuxml2xmltest.c | 353 ++++++++++++++++++++++-------------------------- 1 file changed, 158 insertions(+), 195 deletions(-)
@@ -655,152 +642,129 @@ mymain(void) DO_TEST("metadata", NONE); DO_TEST("metadata-duplicate", NONE);
- DO_TEST_FULL("pci-bridge", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-bridge-many-disks", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-autoadd-addr", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); - DO_TEST_FULL("pci-autoadd-idx", WHEN_BOTH, GIC_NONE, - QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-bridge", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-bridge-many-disks", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-autoadd-addr", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-autoadd-idx", + QEMU_CAPS_DEVICE_PCI_BRIDGE); DO_TEST("pci-autofill-addr", NONE);
Now you can fit some of the tests on a single line. Jan

On Thu, 2016-08-04 at 13:09 +0200, Ján Tomko wrote:
+ DO_TEST("pci-bridge", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-bridge-many-disks", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-autoadd-addr", + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("pci-autoadd-idx", + QEMU_CAPS_DEVICE_PCI_BRIDGE); Now you can fit some of the tests on a single line.
I think always having the caps on a separate line makes it easier to tell at a glance whether caps are used or not, so I'd rather leave it the way it is if that's okay with you. -- Andrea Bolognani / Red Hat / Virtualization

All these configurations are already covered for qemuxml2argv, but there were no equivalent tests for qemuxml2xml. --- .../qemuxml2xmlout-ppc64-usb-controller-legacy.xml | 31 ++++++++++++++++++ .../qemuxml2xmlout-ppc64-usb-controller.xml | 31 ++++++++++++++++++ .../qemuxml2xmlout-usb-controller-default-q35.xml | 37 ++++++++++++++++++++++ .../qemuxml2xmlout-usb-controller-explicit-q35.xml | 37 ++++++++++++++++++++++ .../qemuxml2xmlout-usb-controller.xml | 27 ++++++++++++++++ .../qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml | 25 +++++++++++++++ .../qemuxml2xmlout-usb-piix3-controller.xml | 27 ++++++++++++++++ tests/qemuxml2xmltest.c | 16 ++++++++++ 8 files changed, 231 insertions(+) create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-explicit-q35.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-piix3-controller.xml diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.xml new file mode 100644 index 0000000..33e7810 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.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='ppc64' machine='pseries'>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-system-ppc64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </memballoon> + <panic model='pseries'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml new file mode 100644 index 0000000..33e7810 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.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='ppc64' machine='pseries'>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-system-ppc64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </memballoon> + <panic model='pseries'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml new file mode 100644 index 0000000..8c4f1f5 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml @@ -0,0 +1,37 @@ +<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'>1</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> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='2' model='pci-bridge'> + <model name='pci-bridge'/> + <target chassisNr='56'/> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </controller> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='1' model='dmi-to-pci-bridge'> + <model name='i82801b11-bridge'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-explicit-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-explicit-q35.xml new file mode 100644 index 0000000..540e817 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-explicit-q35.xml @@ -0,0 +1,37 @@ +<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'>1</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> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='2' model='pci-bridge'> + <model name='pci-bridge'/> + <target chassisNr='56'/> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </controller> + <controller type='usb' index='0' model='nec-xhci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='1' model='dmi-to-pci-bridge'> + <model name='i82801b11-bridge'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller.xml new file mode 100644 index 0000000..d37b985 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller.xml @@ -0,0 +1,27 @@ +<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'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml new file mode 100644 index 0000000..37e5e50 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml @@ -0,0 +1,25 @@ +<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='none'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-piix3-controller.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-piix3-controller.xml new file mode 100644 index 0000000..a565953 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-piix3-controller.xml @@ -0,0 +1,27 @@ +<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='piix3-uhci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 9a9bf5a..fb1c477 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -583,6 +583,22 @@ mymain(void) DO_TEST("interface-server", NONE); DO_TEST("virtio-lun", NONE); + DO_TEST("usb-none", NONE); + DO_TEST("usb-controller", NONE); + DO_TEST("usb-piix3-controller", + QEMU_CAPS_PIIX3_USB_UHCI); + DO_TEST("usb-controller-default-q35", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PIIX3_USB_UHCI, + QEMU_CAPS_NEC_USB_XHCI); + DO_TEST("usb-controller-explicit-q35", + QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PIIX3_USB_UHCI, + QEMU_CAPS_NEC_USB_XHCI); + DO_TEST("ppc64-usb-controller", + QEMU_CAPS_PCI_OHCI); + DO_TEST("ppc64-usb-controller-legacy", + QEMU_CAPS_PIIX3_USB_UHCI); DO_TEST("usb-port-missing", NONE); DO_TEST("usb-redir", NONE); DO_TEST("usb-redir-filter", NONE); -- 2.7.4

On Fri, Jul 29, 2016 at 07:46:27PM +0200, Andrea Bolognani wrote:
All these configurations are already covered for qemuxml2argv, but there were no equivalent tests for qemuxml2xml. --- .../qemuxml2xmlout-ppc64-usb-controller-legacy.xml | 31 ++++++++++++++++++ .../qemuxml2xmlout-ppc64-usb-controller.xml | 31 ++++++++++++++++++ .../qemuxml2xmlout-usb-controller-default-q35.xml | 37 ++++++++++++++++++++++ .../qemuxml2xmlout-usb-controller-explicit-q35.xml | 37 ++++++++++++++++++++++ .../qemuxml2xmlout-usb-controller.xml | 27 ++++++++++++++++ .../qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml | 25 +++++++++++++++ .../qemuxml2xmlout-usb-piix3-controller.xml | 27 ++++++++++++++++ tests/qemuxml2xmltest.c | 16 ++++++++++ 8 files changed, 231 insertions(+) create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-explicit-q35.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-piix3-controller.xml
ACK to patches 1 to 7. Jan

When the user doesn't specify any model for a USB controller, we use an architecture-dependent default, but we don't reflect it in the guest XML. Pick the default USB controller model when parsing the guest XML instead of when creating the QEMU command line, so that our choice is saved back to disk. --- src/qemu/qemu_domain.c | 20 ++++++++++++++++++++ .../qemuxml2xmlout-ppc64-usb-controller.xml | 2 +- .../qemuxml2xmlout-usb-controller-default-q35.xml | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9b439df..ffa7fa7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2573,6 +2573,26 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, virDomainNumaGetNodeCount(def->numa)); goto cleanup; } + } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && + cont->model == -1) { + /* Pick a suitable default model for the USB controller if none + * has been selected by the user. + * + * We rely on device availability instead of setting the model + * unconditionally because, for some machine types, there's a + * chance we will get away with using the legacy USB controller + * when the relevant device is not available. + * + * See qemuBuildControllerDevCommandLine() */ + if (ARCH_IS_PPC64(def->os.arch)) { + /* Default USB controller for ppc64 is pci-ohci */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI; + } else { + /* Default USB controller for anything else is piix3-uhci */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI; + } } } diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml index 33e7810..30932e5 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml @@ -19,7 +19,7 @@ <on_crash>restart</on_crash> <devices> <emulator>/usr/libexec/qemu-system-ppc64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='pci-ohci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <controller type='pci' index='0' model='pci-root'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml index 8c4f1f5..082a92e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml @@ -20,7 +20,7 @@ <target chassisNr='56'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> </controller> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> <controller type='sata' index='0'> -- 2.7.4

On Fri, Jul 29, 2016 at 07:46:28PM +0200, Andrea Bolognani wrote:
When the user doesn't specify any model for a USB controller, we use an architecture-dependent default, but we don't reflect it in the guest XML.
Pick the default USB controller model when parsing the guest XML instead of when creating the QEMU command line, so that our choice is saved back to disk. --- src/qemu/qemu_domain.c | 20 ++++++++++++++++++++ .../qemuxml2xmlout-ppc64-usb-controller.xml | 2 +- .../qemuxml2xmlout-usb-controller-default-q35.xml | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9b439df..ffa7fa7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2573,6 +2573,26 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, virDomainNumaGetNodeCount(def->numa)); goto cleanup; } + } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && + cont->model == -1) { + /* Pick a suitable default model for the USB controller if none + * has been selected by the user. + * + * We rely on device availability instead of setting the model + * unconditionally because, for some machine types, there's a + * chance we will get away with using the legacy USB controller + * when the relevant device is not available. + * + * See qemuBuildControllerDevCommandLine() */ + if (ARCH_IS_PPC64(def->os.arch)) { + /* Default USB controller for ppc64 is pci-ohci */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
<thinking_out_loud> So, if I understand correctly, if we left the model for PPC64 at -1: [A] before 8156493 Fix USB model defaults for ppc64 [v1.3.1-rc1~47] we pass -usb on the command line, drop the controller from migration XML and possibly re-add it on the destination [B] after that commit we pass -device pci-usb-ohci, lose that information in migration [C] after 192a53e0 send default USB controller in xml [v1.3.5-rc1~459] We use -device pci-usb-ohci, passing the address to the destination Migration between [A] and anything else is AFAIK broken since the address used by -usb never matches the one we pick for the -device, https://bugzilla.redhat.com/show_bug.cgi?id=1357468 Migration between [C] and [B] should just work as long as hotplugging did not change the order of the devices and the controller auto-added on the destination gets the same address as the one that was removed. </thinking_out_loud> Is it possible to create a -device syntax that will match the -usb command line generated by [A] (e.g. by specifying a 0000:00.00 PCI addr)? This change should fix migration from [B] and [C] and back: * model=-1 coming from those hosts will get adjusted to OHCI on parsing * we should not format model=-1 when migrating back to those hosts
+ } else { + /* Default USB controller for anything else is piix3-uhci */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI;
For non-PPC64, migration was not broken before. Ancient QEMUs not supporting QEMU_CAPS_PIIX3_USB_UHCI will still get model=-1 (or not, I doubt anyone will run new libvirt with them). Should we set it unconditionally for i440fx machines? Everything else gets the model changed to PIIX3-UHCI. Of course, this breaks migration to pre-0.9.x libvirt which did not support USB controllers. I am okay with that, but you might want to get a second opinion on that. ACK Jan

On Thu, 2016-08-04 at 14:32 +0200, Ján Tomko wrote:
+ } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && + cont->model == -1) { + /* Pick a suitable default model for the USB controller if none + * has been selected by the user. + * + * We rely on device availability instead of setting the model + * unconditionally because, for some machine types, there's a + * chance we will get away with using the legacy USB controller + * when the relevant device is not available. + * + * See qemuBuildControllerDevCommandLine() */ + if (ARCH_IS_PPC64(def->os.arch)) { + /* Default USB controller for ppc64 is pci-ohci */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI; <thinking_out_loud> So, if I understand correctly, if we left the model for PPC64 at -1: [A] before 8156493 Fix USB model defaults for ppc64 [v1.3.1-rc1~47] we pass -usb on the command line, drop the controller from migration XML and possibly re-add it on the destination [B] after that commit we pass -device pci-usb-ohci, lose that information in migration [C] after 192a53e0 send default USB controller in xml [v1.3.5-rc1~459] We use -device pci-usb-ohci, passing the address to the destination Migration between [A] and anything else is AFAIK broken since the address used by -usb never matches the one we pick for the -device, https://bugzilla.redhat.com/show_bug.cgi?id=1357468 Migration between [C] and [B] should just work as long as hotplugging did not change the order of the devices and the controller auto-added on the destination gets the same address as the one that was removed.
You mean between [B] and [C]? When migrating between [C] and [B], the destination will receive the <controller> element, including the PCI address, so it should have no problem just using it.
</thinking_out_loud> Is it possible to create a -device syntax that will match the -usb command line generated by [A] (e.g. by specifying a 0000:00.00 PCI addr)?
Yes, something like -device pci-ohci,id=usb,bus=pci.0,addr=0x0 will work for QEMU, but we have no way of representing that in the guest configuration: <address type='pci' domain='0x0000' bus='0x00' slot='0x00' function='0x0'/> will result in libvirt assigning a new PCI address for the device in recent libvirt versions, and an outright error in older libvirt versions, including [A]. Assuming that we made it possible to specify such an address, it would be impossible for the target of the migration to make out whether the migration is coming from [A] or [B] - one of the two would be broken anyway.
This change should fix migration from [B] and [C] and back: * model=-1 coming from those hosts will get adjusted to OHCI on parsing * we should not format model=-1 when migrating back to those hosts
Migration between [B] and [C] should already work in both directions AFAICT. Can you give me an example where it wouldn't?
+ } else { + /* Default USB controller for anything else is piix3-uhci */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI; For non-PPC64, migration was not broken before. Ancient QEMUs not supporting QEMU_CAPS_PIIX3_USB_UHCI will still get model=-1 (or not, I doubt anyone will run new libvirt with them). Should we set it unconditionally for i440fx machines? Everything else gets the model changed to PIIX3-UHCI.
I think we still want to make a last-ditch effort to provide some sort, any sort, of USB controller. Or rather, that we have to. Honestly, I'd rather just drop the -usb handling altogether and expect users not to mix modern-day libvirt with QEMU versions from 5+ years ago.
Of course, this breaks migration to pre-0.9.x libvirt which did not support USB controllers. I am okay with that, but you might want to get a second opinion on that.
How far back can you reasonably expect to migrate a guest? How would you even migrate a guest that uses USB controllers to a version of libvirt that doesn't support USB controllers? -- Andrea Bolognani / Red Hat / Virtualization

On Thu, Aug 04, 2016 at 04:44:34PM +0200, Andrea Bolognani wrote:
On Thu, 2016-08-04 at 14:32 +0200, Ján Tomko wrote:
+ } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && + cont->model == -1) { + /* Pick a suitable default model for the USB controller if none + * has been selected by the user. + * + * We rely on device availability instead of setting the model + * unconditionally because, for some machine types, there's a + * chance we will get away with using the legacy USB controller + * when the relevant device is not available. + * + * See qemuBuildControllerDevCommandLine() */ + if (ARCH_IS_PPC64(def->os.arch)) { + /* Default USB controller for ppc64 is pci-ohci */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI; <thinking_out_loud> So, if I understand correctly, if we left the model for PPC64 at -1: [A] before 8156493 Fix USB model defaults for ppc64 [v1.3.1-rc1~47] we pass -usb on the command line, drop the controller from migration XML and possibly re-add it on the destination [B] after that commit we pass -device pci-usb-ohci, lose that information in migration [C] after 192a53e0 send default USB controller in xml [v1.3.5-rc1~459] We use -device pci-usb-ohci, passing the address to the destination Migration between [A] and anything else is AFAIK broken since the address used by -usb never matches the one we pick for the -device, https://bugzilla.redhat.com/show_bug.cgi?id=1357468 Migration between [C] and [B] should just work as long as hotplugging did not change the order of the devices and the controller auto-added on the destination gets the same address as the one that was removed.
You mean between [B] and [C]? When migrating between [C] and [B], the destination will receive the <controller> element, including the PCI address, so it should have no problem just using it.
Yes, [C] -> [B] should always work(TM).
</thinking_out_loud> Is it possible to create a -device syntax that will match the -usb command line generated by [A] (e.g. by specifying a 0000:00.00 PCI addr)?
Yes, something like
-device pci-ohci,id=usb,bus=pci.0,addr=0x0
will work for QEMU, but we have no way of representing that in the guest configuration:
<address type='pci' domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
will result in libvirt assigning a new PCI address for the device in recent libvirt versions, and an outright error in older libvirt versions, including [A].
Assuming that we made it possible to specify such an address, it would be impossible for the target of the migration to make out whether the migration is coming from [A] or [B] - one of the two would be broken anyway.
Okay, seems [B] has a higher chance of working.
This change should fix migration from [B] and [C] and back: * model=-1 coming from those hosts will get adjusted to OHCI on parsing * we should not format model=-1 when migrating back to those hosts
Migration between [B] and [C] should already work in both directions AFAICT. Can you give me an example where it wouldn't?
The use case described by the [C] commit: giving the USB controller an address after another device, then unplugging that device. [B] on destination will not get the controller address and assign the earliest free slot, which does not match.
+ } else { + /* Default USB controller for anything else is piix3-uhci */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI; For non-PPC64, migration was not broken before. Ancient QEMUs not supporting QEMU_CAPS_PIIX3_USB_UHCI will still get model=-1 (or not, I doubt anyone will run new libvirt with them). Should we set it unconditionally for i440fx machines? Everything else gets the model changed to PIIX3-UHCI.
I think we still want to make a last-ditch effort to provide some sort, any sort, of USB controller. Or rather, that we have to. Honestly, I'd rather just drop the -usb handling altogether and expect users not to mix modern-day libvirt with QEMU versions from 5+ years ago.
It seems QEMU_CAPS_PIIX3_USB_UHCI was introduced by this QEMU commit: commit 556cd09885bec3f69ba78228fe4e46dc1dad145b Author: Markus Armbruster <armbru@redhat.com> AuthorDate: 2009-12-09 17:07:53 +0100 Commit: Anthony Liguori <aliguori@us.ibm.com> CommitDate: 2009-12-12 07:59:38 -0600 qdev: Replace device names containing whitespace Device names with whitespace require quoting in the shell and in the monitor. Some of the offenders are also overly long. Some have a more convenient alias, some don't. The place for verbose device names is DeviceInfo member desc. The name should be short & sweet. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> contains: v0.13.0-rc0~2041 While I think we could safely drop support for that for x86_64, I would prefer if it would be accompanied with an exact version that is dropped, just like we did with 0.12.0. That way we could possibly drop more code. But this is also executed for non-x86 architectures. We either do or do not add the <controller>, but emit -usb anyway. This could be broken by patch 9/9.
Of course, this breaks migration to pre-0.9.x libvirt which did not support USB controllers. I am okay with that, but you might want to get a second opinion on that.
How far back can you reasonably expect to migrate a guest?
I would expect us not to break it if we can avoid it. Since we now drop the controller only for model =-1 and i440fx machine, changing the condition to also accept the i440fx model would allow us to migrate from newest libvirt to ancient libvirt not supporting USB controllers. When migrating back, we would auto-add the correct model since it happens at parse time and ABIStabilityCheck would be happy. Please extend that condition to include PIIX3 model. If we ever want to drop it, we can just delete the whole thing from qemuDomainDefFormatBuf.
How would you even migrate a guest that uses USB controllers to a version of libvirt that doesn't support USB controllers?
We were autoadding -usb to the command line even if libvirt did not support <controller type='usb'>. So passing it in XML unconditionally fails when being parsed on the destination, but if it's dropped, the destination libvirt just assumes it's there and emits -usb. (might even be -device .., I did not look back that far). See: commit 409b5f549530e7b3a33f4505f2cad2e26896107c qemu: Emit compatible XML when migrating a domain contains: v0.9.12-rc2~22 So, ACK to this patch if you either: * extend qemuDomainDefFormatBuf to also drop PIIX3 from migratable XML * or get someone else to say: "Let's break this!" For 9/9 I think we should not error out on controller model -1 just yet, since we do not pick it on XML parsing in all cases. Jan

On Mon, 2016-08-08 at 18:30 +0200, Ján Tomko wrote: > > I think we still want to make a last-ditch effort to provide > > some sort, any sort, of USB controller. Or rather, that we > > have to. Honestly, I'd rather just drop the -usb handling > > altogether and expect users not to mix modern-day libvirt > > with QEMU versions from 5+ years ago. > > It seems QEMU_CAPS_PIIX3_USB_UHCI was introduced by this QEMU commit: > > commit 556cd09885bec3f69ba78228fe4e46dc1dad145b > Author: Markus Armbruster <armbru@redhat.com> > AuthorDate: 2009-12-09 17:07:53 +0100 > Commit: Anthony Liguori <aliguori@us.ibm.com> > CommitDate: 2009-12-12 07:59:38 -0600 > > qdev: Replace device names containing whitespace > > Device names with whitespace require quoting in the shell and in the > monitor. Some of the offenders are also overly long. Some have a > more convenient alias, some don't. > > The place for verbose device names is DeviceInfo member desc. The > name should be short & sweet. > > Signed-off-by: Markus Armbruster <armbru@redhat.com> > Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> > > contains: v0.13.0-rc0~2041 > > While I think we could safely drop support for that for x86_64, > I would prefer if it would be accompanied with an exact version that is > dropped, just like we did with 0.12.0. That way we could possibly drop > more code. 0.12.0 was chosen as our cut-off version because it aligns with currently-supported enterprise Linux releases, eg. RHEL/CentOS 6, Ubuntu 12.04 and SLES 11. I don't think we should drop newer versions while the OS vendors keep supporting them. So we'll be stuck with 0.12.0 for a while :) > But this is also executed for non-x86 architectures. > We either do or do not add the <controller>, but emit -usb anyway. > This could be broken by patch 9/9. > > > > Of course, this breaks migration to pre-0.9.x libvirt which did not > > > support USB controllers. I am okay with that, but you might want to get > > > a second opinion on that. > > > > How far back can you reasonably expect to migrate a guest? > > I would expect us not to break it if we can avoid it. > > Since we now drop the controller only for model =-1 and i440fx machine, > changing the condition to also accept the i440fx model would allow us > to migrate from newest libvirt to ancient libvirt not supporting USB > controllers. When migrating back, we would auto-add the correct > model since it happens at parse time and ABIStabilityCheck would be > happy. > > Please extend that condition to include PIIX3 model. If we ever want > to drop it, we can just delete the whole thing from qemuDomainDefFormatBuf. Okay, that would work since we make sure that piix3-usb-uhci is always assigned a PCI address of 00:01.2 and -usb will use that address. > > How > > would you even migrate a guest that uses USB controllers to a > > version of libvirt that doesn't support USB controllers? > > We were autoadding -usb to the command line even if libvirt did not > support <controller type='usb'>. So passing it in XML unconditionally > fails when being parsed on the destination, but if it's dropped, the > destination libvirt just assumes it's there and emits -usb. (might even > be -device .., I did not look back that far). > > See: > commit 409b5f549530e7b3a33f4505f2cad2e26896107c > qemu: Emit compatible XML when migrating a domain > contains: v0.9.12-rc2~22 > > So, ACK to this patch if you either: > * extend qemuDomainDefFormatBuf to also drop PIIX3 from migratable XML I see. I will do that. > * or get someone else to say: "Let's break this!" > > For 9/9 I think we should not error out on controller model -1 just yet, > since we do not pick it on XML parsing in all cases. I think you're referring to this chunk: @@ -2396,10 +2395,9 @@ qemuBuildUSBControllerDevStr(const virDomainDef *domainDef, model = def->model; if (model == -1) { - if ARCH_IS_PPC64(domainDef->os.arch) - model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI; - else - model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI; + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("no model provided for USB controller")); + return -1; } Note that the previous code didn't really add anything but complexity: immediately afterwards, the QEMU capabilities are checked to see whether pci-ohci or piix3-usb-uhci are available - but if they are, then we'd already have set the model accordingly in qemuDomainDeviceDefPostParse(). I'll push both a fixed 8/9 and 9/9 in a while. -- Andrea Bolognani / Red Hat / Virtualization

Since we now pick the default USB controller model when parsing the guest XML, we can get rid of some duplicated code so that the default model selection happens in one place only. Add some comments as well. --- src/qemu/qemu_command.c | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5325f48..d53620c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2387,8 +2387,7 @@ qemuControllerModelUSBToCaps(int model) static int -qemuBuildUSBControllerDevStr(const virDomainDef *domainDef, - virDomainControllerDefPtr def, +qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def, virQEMUCapsPtr qemuCaps, virBuffer *buf) { @@ -2398,10 +2397,9 @@ qemuBuildUSBControllerDevStr(const virDomainDef *domainDef, model = def->model; if (model == -1) { - if ARCH_IS_PPC64(domainDef->os.arch) - model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI; - else - model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI; + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("no model provided for USB controller")); + return -1; } smodel = qemuControllerModelUSBTypeToString(model); @@ -2630,7 +2628,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, break; case VIR_DOMAIN_CONTROLLER_TYPE_USB: - if (qemuBuildUSBControllerDevStr(domainDef, def, qemuCaps, &buf) == -1) + if (qemuBuildUSBControllerDevStr(def, qemuCaps, &buf) == -1) goto error; if (nusbcontroller) @@ -3010,30 +3008,29 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && cont->model == -1 && - !qemuDomainMachineIsQ35(def)) { - bool need_legacy = false; - - /* We're not using legacy usb controller for q35 */ - if (ARCH_IS_PPC64(def->os.arch)) { - /* For ppc64 the legacy was OHCI */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) - need_legacy = true; - } else { - /* For anything else, we used PIIX3_USB_UHCI */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) - need_legacy = true; - } - - if (need_legacy) { - if (usblegacy) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Multiple legacy USB controllers are " - "not supported")); - return -1; - } - usblegacy = true; - continue; + !qemuDomainMachineIsQ35(def) && + !qemuDomainMachineIsVirt(def)) { + + /* An appropriate default USB controller model should already + * have been selected in qemuDomainDeviceDefPostParse(); if + * we still have no model by now, we have to fall back to the + * legacy USB controller. + * + * Note that we *don't* want to end up with the legacy USB + * controller for q35 and virt machines, so we go ahead and + * fail in qemuBuildControllerDevStr(); on the other hand, + * for s390 machines we want to ignore any USB controller + * (see 548ba43028 for the full story), so we skip + * qemuBuildControllerDevStr() but we don't ultimately end + * up adding the legacy USB controller */ + if (usblegacy) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Multiple legacy USB controllers are " + "not supported")); + return -1; } + usblegacy = true; + continue; } virCommandAddArg(cmd, "-device"); @@ -3045,6 +3042,9 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, } } + /* We haven't added any USB controller yet, but we haven't been asked + * not to add one either. Add a legacy USB controller, unless we're + * creating a kind of guest we want to keep legacy-free */ if (usbcontroller == 0 && !qemuDomainMachineIsQ35(def) && !qemuDomainMachineIsVirt(def) && -- 2.7.4

On Fri, Jul 29, 2016 at 07:46:29PM +0200, Andrea Bolognani wrote:
Since we now pick the default USB controller model when parsing the guest XML, we can get rid of some duplicated code so that the default model selection happens in one place only.
Add some comments as well. --- src/qemu/qemu_command.c | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5325f48..d53620c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2387,8 +2387,7 @@ qemuControllerModelUSBToCaps(int model)
static int -qemuBuildUSBControllerDevStr(const virDomainDef *domainDef, - virDomainControllerDefPtr def, +qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def, virQEMUCapsPtr qemuCaps, virBuffer *buf) { @@ -2398,10 +2397,9 @@ qemuBuildUSBControllerDevStr(const virDomainDef *domainDef, model = def->model;
if (model == -1) { - if ARCH_IS_PPC64(domainDef->os.arch) - model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI; - else - model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI; + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("no model provided for USB controller")); + return -1; }
smodel = qemuControllerModelUSBTypeToString(model); @@ -2630,7 +2628,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, break;
case VIR_DOMAIN_CONTROLLER_TYPE_USB: - if (qemuBuildUSBControllerDevStr(domainDef, def, qemuCaps, &buf) == -1) + if (qemuBuildUSBControllerDevStr(def, qemuCaps, &buf) == -1) goto error;
if (nusbcontroller) @@ -3010,30 +3008,29 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && cont->model == -1 && - !qemuDomainMachineIsQ35(def)) { - bool need_legacy = false; - - /* We're not using legacy usb controller for q35 */ - if (ARCH_IS_PPC64(def->os.arch)) { - /* For ppc64 the legacy was OHCI */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) - need_legacy = true; - } else { - /* For anything else, we used PIIX3_USB_UHCI */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) - need_legacy = true; - } - - if (need_legacy) { - if (usblegacy) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Multiple legacy USB controllers are " - "not supported")); - return -1; - } - usblegacy = true; - continue; + !qemuDomainMachineIsQ35(def) && + !qemuDomainMachineIsVirt(def)) { + + /* An appropriate default USB controller model should already + * have been selected in qemuDomainDeviceDefPostParse(); if + * we still have no model by now, we have to fall back to the + * legacy USB controller. + * + * Note that we *don't* want to end up with the legacy USB + * controller for q35 and virt machines, so we go ahead and + * fail in qemuBuildControllerDevStr(); on the other hand, + * for s390 machines we want to ignore any USB controller + * (see 548ba43028 for the full story), so we skip + * qemuBuildControllerDevStr() but we don't ultimately end + * up adding the legacy USB controller */
I wish this comment weren't necessary. ACK Jan
+ if (usblegacy) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Multiple legacy USB controllers are " + "not supported")); + return -1; } + usblegacy = true; + continue; }
virCommandAddArg(cmd, "-device"); @@ -3045,6 +3042,9 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, } }
+ /* We haven't added any USB controller yet, but we haven't been asked + * not to add one either. Add a legacy USB controller, unless we're + * creating a kind of guest we want to keep legacy-free */ if (usbcontroller == 0 && !qemuDomainMachineIsQ35(def) && !qemuDomainMachineIsVirt(def) && -- 2.7.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
Andrea Bolognani
-
Ján Tomko