[PATCH 00/31] qemu capability testing cleanups and improvements (part 3)

This series applies on top of 'part2' fetch everything from my repo: git fetch https://gitlab.com/pipo.sk/libvirt.git ppc-send In this part: - caps code is refactored to simplify error paths - vircapstest is removed - qemumemlocktest is converted to use real caps - qemuhotplugtest is converted to use real caps - ppc64 fake caps invocation is dropped from qemuxml2xml/argv tests - always present ppc64 caps are drooped - ppc64 fake emulators are removed Peter Krempa (31): qemu: capabilities: Drop 'kvmVersion' field libxlCapsInitGuests: Rework insane use of ternary operators virCapabilitiesAllocMachines: Use NULL-terminated list as argument and return count virQEMUCapsGetMachineTypesCaps: Remove return value virQEMUCapsInitGuestFromBinary: Refactor cleanup virQEMUCapsInitGuestFromBinary: Remove return value virQEMUCapsInitGuest: Refactor cleanup and remove return value virCapabilitiesFreeMachines: Remove unused function vircapstest: Remove 'qemu' testing tests: vircaps: Remove pointless testing of virCapabilitiesHostNUMAGetCpus tests: Remove 'vircapstest' testutilsqemu: Extract fetching of real virQEMUCaps into testQemuGetRealCaps testQemuGetRealCaps: Integrate fetching of QMP schema qemumemlocktest: Use real capabilities qemuhotplugtest: Don't fetch capabilities when they are not used qemuhotplugtestdomain: Move all i686 test cases to x86_64 qemuhotplugtest: Enable 'lsilogic' SCSI controller qemuhotplugtest: Assert QEMU_CAPS_SET_ACTION qemuhotplugtest: Refactor calling of testQemuHotplugCpuPrepare qemuhotplugtest: Use real 'latest' capabilities for hotplug testing qemuhotplugtest: Make the test more useful by validating used commands against QMP schema qemuxml2argvtest: Modernize all 'ppc64' remaining test cases qemuxml2xmltest: Modernize all remaining 'ppc64' test cases qemuxml2argvtest: Add '4.2.0' version of 'pseries-features' test case qemuxml2argvtest: Drop negative test cases for 'pseries' machine features qemuValidateDomainDefPSeriesFeature: Remove obsolete checks qemu: capabilities: Retire obsolete 'pseries' capabilities qemuValidateDomainDefPSeriesFeature: Simplify machine validation logic qemuValidateDomainDefPSeriesFeature: Simplify feature validation qemuxml2argvtest: Use real capabilities for negative test cases for ppc64 architecture testutilsqemu: Drop fake capability testing infrastructure for 'ppc64' src/conf/capabilities.c | 31 +- src/conf/capabilities.h | 5 +- src/libvirt_private.syms | 1 - src/libxl/libxl_capabilities.c | 39 ++- src/qemu/qemu_capabilities.c | 85 ++---- src/qemu/qemu_capabilities.h | 23 +- src/qemu/qemu_validate.c | 99 +----- tests/meson.build | 18 +- .../caps_4.2.0_aarch64.xml | 1 - .../qemucapabilitiesdata/caps_4.2.0_ppc64.xml | 8 - .../qemucapabilitiesdata/caps_4.2.0_s390x.xml | 1 - .../caps_4.2.0_x86_64.xml | 1 - .../caps_5.0.0_aarch64.xml | 1 - .../qemucapabilitiesdata/caps_5.0.0_ppc64.xml | 8 - .../caps_5.0.0_riscv64.xml | 1 - .../caps_5.0.0_x86_64.xml | 1 - .../qemucapabilitiesdata/caps_5.1.0_sparc.xml | 1 - .../caps_5.1.0_x86_64.xml | 1 - .../caps_5.2.0_aarch64.xml | 1 - .../qemucapabilitiesdata/caps_5.2.0_ppc64.xml | 8 - .../caps_5.2.0_riscv64.xml | 1 - .../qemucapabilitiesdata/caps_5.2.0_s390x.xml | 1 - .../caps_5.2.0_x86_64.xml | 1 - .../caps_6.0.0_aarch64.xml | 1 - .../qemucapabilitiesdata/caps_6.0.0_s390x.xml | 1 - .../caps_6.0.0_x86_64.xml | 1 - .../caps_6.1.0_x86_64.xml | 1 - .../caps_6.2.0_aarch64.xml | 1 - .../qemucapabilitiesdata/caps_6.2.0_ppc64.xml | 8 - .../caps_6.2.0_x86_64.xml | 1 - .../caps_7.0.0_aarch64+hvf.xml | 1 - .../caps_7.0.0_aarch64.xml | 1 - .../qemucapabilitiesdata/caps_7.0.0_ppc64.xml | 8 - .../caps_7.0.0_x86_64.xml | 1 - .../qemucapabilitiesdata/caps_7.1.0_ppc64.xml | 8 - .../caps_7.1.0_x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml | 1 - .../caps_7.2.0_x86_64+hvf.xml | 1 - .../caps_7.2.0_x86_64.xml | 1 - .../caps_8.0.0_riscv64.xml | 1 - .../caps_8.0.0_x86_64.xml | 1 - tests/qemucaps2xmltest.c | 8 +- tests/qemuhotplugtest.c | 284 +++++++++--------- .../ppc64-modern-bulk-result-conf.xml | 5 +- .../ppc64-modern-bulk-result-live.xml | 5 +- .../ppc64-modern-individual-result-conf.xml | 5 +- .../ppc64-modern-individual-result-live.xml | 5 +- .../x86-modern-bulk-result-conf.xml | 5 +- .../x86-modern-bulk-result-live.xml | 5 +- .../x86-modern-individual-add-result-conf.xml | 5 +- .../x86-modern-individual-add-result-live.xml | 5 +- .../qemuhotplug-disk-scsi-2.xml | 2 +- .../qemuhotplug-base-ccw-live+ccw-virtio.xml | 13 +- ...with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 13 +- ...otplug-base-ccw-live-with-2-ccw-virtio.xml | 13 +- ...-with-ccw-virtio+ccw-virtio-2-explicit.xml | 13 +- ...-ccw-live-with-ccw-virtio+ccw-virtio-2.xml | 13 +- ...uhotplug-base-ccw-live-with-ccw-virtio.xml | 13 +- .../qemuhotplug-base-ccw-live.xml | 13 +- .../qemuhotplug-base-live+cdrom-scsi.xml | 5 +- .../qemuhotplug-base-live+cdrom-usb.xml | 5 +- ...uhotplug-base-live+disk-scsi-multipath.xml | 5 +- ...+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml | 5 +- .../qemuhotplug-base-live+disk-scsi.xml | 5 +- .../qemuhotplug-base-live+disk-usb.xml | 5 +- .../qemuhotplug-base-live+disk-virtio.xml | 5 +- .../qemuhotplug-base-live+guestfwd.xml | 5 +- .../qemuhotplug-base-live+hostdev-pci.xml | 5 +- .../qemuhotplug-base-live+interface-vdpa.xml | 5 +- ...qemuhotplug-base-live+ivshmem-doorbell.xml | 5 +- .../qemuhotplug-base-live+ivshmem-plain.xml | 5 +- .../qemuhotplug-base-live+qemu-agent.xml | 5 +- ...uhotplug-base-live+watchdog-user-alias.xml | 5 +- .../qemuhotplug-base-live+watchdog.xml | 5 +- .../qemuhotplug-base-live.xml | 5 +- ...hotplug-base-with-scsi-controller-live.xml | 13 +- ...thout-scsi-controller-live+disk-scsi-2.xml | 17 +- ...g-console-compat-2-live+console-virtio.xml | 5 +- .../qemuhotplug-console-compat-2-live.xml | 5 +- .../qemuhotplug-disk-cdrom.xml | 4 +- ...uhotplug-graphics-spice-listen-network.xml | 4 +- .../qemuhotplug-graphics-spice-timeout.xml | 4 +- .../qemuhotplug-graphics-spice.xml | 4 +- ...uhotplug-pseries-base-live+hostdev-pci.xml | 5 +- .../qemuhotplug-pseries-base-live.xml | 5 +- tests/qemumemlocktest.c | 27 +- ...r => aarch64-gic-not-arm.ppc64-latest.err} | 0 ... cpu-hotplug-granularity.ppc64-latest.err} | 0 ...emory-hotplug-nvdimm-ppc64-abi-update.args | 13 +- ...ry-hotplug-nvdimm-ppc64.ppc64-latest.args} | 13 +- ...emory-hotplug-ppc64-nonuma-abi-update.args | 15 +- ...ry-hotplug-ppc64-nonuma.ppc64-latest.args} | 15 +- ....err => ppc64-tpm-double.ppc64-latest.err} | 0 ...=> ppc64-tpmproxy-double.ppc64-latest.err} | 0 ...4-usb-controller-legacy.ppc64-latest.args} | 11 +- .../ppc64-usb-controller-qemu-xhci.args | 11 +- ...=> ppc64-usb-controller.ppc64-latest.args} | 11 +- .../qemuxml2argvdata/pseries-features-ccf.err | 1 - .../qemuxml2argvdata/pseries-features-ccf.xml | 14 - .../pseries-features-cfpc.err | 1 - .../pseries-features-cfpc.xml | 14 - .../pseries-features-hpt-pagesize.err | 1 - .../pseries-features-hpt-pagesize.xml | 16 - .../qemuxml2argvdata/pseries-features-htm.err | 1 - .../qemuxml2argvdata/pseries-features-htm.xml | 14 - .../qemuxml2argvdata/pseries-features-ibs.err | 1 - .../qemuxml2argvdata/pseries-features-ibs.xml | 14 - .../pseries-features-nested-hv.err | 1 - .../pseries-features-nested-hv.xml | 14 - .../pseries-features-sbbc.err | 1 - .../pseries-features-sbbc.xml | 14 - .../pseries-features.ppc64-4.2.0.args | 30 ++ .../qemuxml2argvdata/pseries-no-parallel.err | 1 - .../pseries-no-parallel.ppc64-latest.err | 1 + ...b-invalid-target-index-1.ppc64-latest.err} | 0 ...b-invalid-target-index-2.ppc64-latest.err} | 0 ...b-invalid-target-index-3.ppc64-latest.err} | 0 .../pseries-spaprvio-invalid.err | 1 - .../pseries-spaprvio-invalid.ppc64-latest.err | 1 + tests/qemuxml2argvtest.c | 97 ++---- ...memory-hotplug-nvdimm-ppc64-abi-update.xml | 3 +- ...ory-hotplug-nvdimm-ppc64.ppc64-latest.xml} | 3 +- ...memory-hotplug-ppc64-nonuma-abi-update.xml | 3 + ...mory-hotplug-ppc64-nonuma.ppc64-latest.xml | 42 +++ .../memory-hotplug-ppc64-nonuma.xml | 1 - ...64-usb-controller-legacy.ppc64-latest.xml} | 3 + ... => ppc64-usb-controller.ppc64-latest.xml} | 5 +- tests/qemuxml2xmltest.c | 24 +- tests/testutilsqemu.c | 171 ++++++----- tests/testutilsqemu.h | 11 +- tests/testutilsxen.c | 26 +- tests/vircapstest.c | 230 -------------- 132 files changed, 705 insertions(+), 1118 deletions(-) rename tests/qemuxml2argvdata/{aarch64-gic-not-arm.err => aarch64-gic-not-arm.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{cpu-hotplug-granularity.err => cpu-hotplug-granularity.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{memory-hotplug-nvdimm-ppc64.args => memory-hotplug-nvdimm-ppc64.ppc64-latest.args} (55%) rename tests/qemuxml2argvdata/{memory-hotplug-ppc64-nonuma.args => memory-hotplug-ppc64-nonuma.ppc64-latest.args} (54%) rename tests/qemuxml2argvdata/{ppc64-tpm-double.err => ppc64-tpm-double.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{ppc64-tpmproxy-double.err => ppc64-tpmproxy-double.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{ppc64-usb-controller-legacy.args => ppc64-usb-controller-legacy.ppc64-latest.args} (58%) rename tests/qemuxml2argvdata/{ppc64-usb-controller.args => ppc64-usb-controller.ppc64-latest.args} (58%) delete mode 100644 tests/qemuxml2argvdata/pseries-features-ccf.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-ccf.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-cfpc.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-cfpc.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-hpt-pagesize.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-htm.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-htm.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-ibs.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-ibs.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-nested-hv.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-nested-hv.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-sbbc.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-sbbc.xml create mode 100644 tests/qemuxml2argvdata/pseries-features.ppc64-4.2.0.args delete mode 100644 tests/qemuxml2argvdata/pseries-no-parallel.err create mode 100644 tests/qemuxml2argvdata/pseries-no-parallel.ppc64-latest.err rename tests/qemuxml2argvdata/{pseries-phb-invalid-target-index-1.err => pseries-phb-invalid-target-index-1.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{pseries-phb-invalid-target-index-2.err => pseries-phb-invalid-target-index-2.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{pseries-phb-invalid-target-index-3.err => pseries-phb-invalid-target-index-3.ppc64-latest.err} (100%) delete mode 100644 tests/qemuxml2argvdata/pseries-spaprvio-invalid.err create mode 100644 tests/qemuxml2argvdata/pseries-spaprvio-invalid.ppc64-latest.err rename tests/qemuxml2xmloutdata/{memory-hotplug-nvdimm-ppc64.xml => memory-hotplug-nvdimm-ppc64.ppc64-latest.xml} (93%) create mode 100644 tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.ppc64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.xml rename tests/qemuxml2xmloutdata/{ppc64-usb-controller.xml => ppc64-usb-controller-legacy.ppc64-latest.xml} (91%) rename tests/qemuxml2xmloutdata/{ppc64-usb-controller-legacy.xml => ppc64-usb-controller.ppc64-latest.xml} (86%) delete mode 100644 tests/vircapstest.c -- 2.39.2

It's never set to any real value. Remove it along with the caching code. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 17 ----------------- src/qemu/qemu_capabilities.h | 1 - .../qemucapabilitiesdata/caps_4.2.0_aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0_s390x.xml | 1 - .../qemucapabilitiesdata/caps_4.2.0_x86_64.xml | 1 - .../qemucapabilitiesdata/caps_5.0.0_aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml | 1 - .../qemucapabilitiesdata/caps_5.0.0_riscv64.xml | 1 - .../qemucapabilitiesdata/caps_5.0.0_x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0_sparc.xml | 1 - .../qemucapabilitiesdata/caps_5.1.0_x86_64.xml | 1 - .../qemucapabilitiesdata/caps_5.2.0_aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml | 1 - .../qemucapabilitiesdata/caps_5.2.0_riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0_s390x.xml | 1 - .../qemucapabilitiesdata/caps_5.2.0_x86_64.xml | 1 - .../qemucapabilitiesdata/caps_6.0.0_aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml | 1 - .../qemucapabilitiesdata/caps_6.0.0_x86_64.xml | 1 - .../qemucapabilitiesdata/caps_6.1.0_x86_64.xml | 1 - .../qemucapabilitiesdata/caps_6.2.0_aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml | 1 - .../qemucapabilitiesdata/caps_6.2.0_x86_64.xml | 1 - .../caps_7.0.0_aarch64+hvf.xml | 1 - .../qemucapabilitiesdata/caps_7.0.0_aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml | 1 - .../qemucapabilitiesdata/caps_7.0.0_x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml | 1 - .../qemucapabilitiesdata/caps_7.1.0_x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml | 1 - .../caps_7.2.0_x86_64+hvf.xml | 1 - .../qemucapabilitiesdata/caps_7.2.0_x86_64.xml | 1 - .../qemucapabilitiesdata/caps_8.0.0_riscv64.xml | 1 - .../qemucapabilitiesdata/caps_8.0.0_x86_64.xml | 1 - 35 files changed, 51 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f37a81bfe7..6355c80f30 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -760,7 +760,6 @@ struct _virQEMUCaps { virBitmap *flags; unsigned int version; - unsigned int kvmVersion; unsigned int libvirtVersion; unsigned int microcodeVersion; char *hostCPUSignature; @@ -1992,7 +1991,6 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) ret->flags = virBitmapNewCopy(qemuCaps->flags); ret->version = qemuCaps->version; - ret->kvmVersion = qemuCaps->kvmVersion; ret->microcodeVersion = qemuCaps->microcodeVersion; ret->hostCPUSignature = g_strdup(qemuCaps->hostCPUSignature); @@ -2145,12 +2143,6 @@ unsigned int virQEMUCapsGetVersion(virQEMUCaps *qemuCaps) } -unsigned int virQEMUCapsGetKVMVersion(virQEMUCaps *qemuCaps) -{ - return qemuCaps->kvmVersion; -} - - const char *virQEMUCapsGetPackage(virQEMUCaps *qemuCaps) { return qemuCaps->package; @@ -4706,12 +4698,6 @@ virQEMUCapsLoadCache(virArch hostArch, return -1; } - if (virXPathUInt("string(./kvmVersion)", ctxt, &qemuCaps->kvmVersion) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing version in QEMU capabilities cache")); - return -1; - } - if (virXPathUInt("string(./microcodeVersion)", ctxt, &qemuCaps->microcodeVersion) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -5049,9 +5035,6 @@ virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) virBufferAsprintf(&buf, "<version>%d</version>\n", qemuCaps->version); - virBufferAsprintf(&buf, "<kvmVersion>%d</kvmVersion>\n", - qemuCaps->kvmVersion); - virBufferAsprintf(&buf, "<microcodeVersion>%u</microcodeVersion>\n", qemuCaps->microcodeVersion); virBufferEscapeString(&buf, "<hostCPUSignature>%s</hostCPUSignature>\n", diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 15f0df5317..4881f41253 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -704,7 +704,6 @@ virArch virQEMUCapsGetArch(virQEMUCaps *qemuCaps); unsigned int virQEMUCapsGetVersion(virQEMUCaps *qemuCaps); const char *virQEMUCapsGetPackage(virQEMUCaps *qemuCaps); -unsigned int virQEMUCapsGetKVMVersion(virQEMUCaps *qemuCaps); int virQEMUCapsAddCPUDefinitions(virQEMUCaps *qemuCaps, virDomainVirtType type, const char **name, diff --git a/tests/qemucapabilitiesdata/caps_4.2.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0_aarch64.xml index e0cc16e730..f87962a379 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0_aarch64.xml @@ -112,7 +112,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>4002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>61700242</microcodeVersion> <package>v4.1.0-2221-g36609b4fa3</package> <arch>aarch64</arch> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml index de9c102caa..1cc145cf58 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml @@ -118,7 +118,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>4002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>42900242</microcodeVersion> <package>v4.1.0-2198-g9e583f2</package> <arch>ppc64</arch> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0_s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0_s390x.xml index 08d0993ba3..b440d9d538 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0_s390x.xml @@ -76,7 +76,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>4002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>39100242</microcodeVersion> <package>qemu-4.2.0-20200115.0.1e4aa2da.fc31</package> <arch>s390x</arch> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0_x86_64.xml index e36983da58..b45d4a6293 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0_x86_64.xml @@ -154,7 +154,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>4002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> <package>v4.2.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0_aarch64.xml index 52529690c3..09619133c4 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0_aarch64.xml @@ -124,7 +124,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>61700241</microcodeVersion> <package>v5.0.0</package> <arch>aarch64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml index 9e1147e302..3b49aee40a 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml @@ -133,7 +133,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>42900241</microcodeVersion> <package>v5.0.0</package> <arch>ppc64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0_riscv64.xml b/tests/qemucapabilitiesdata/caps_5.0.0_riscv64.xml index f306bc83cd..fb460c9300 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0_riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0_riscv64.xml @@ -119,7 +119,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> <package>v5.0.0</package> <arch>riscv64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0_x86_64.xml index 89a083dda8..5331cf0113 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0_x86_64.xml @@ -163,7 +163,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion> <package>v5.0.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.1.0_sparc.xml b/tests/qemucapabilitiesdata/caps_5.1.0_sparc.xml index 68728321eb..bc5b3e6fac 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0_sparc.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0_sparc.xml @@ -48,7 +48,6 @@ <flag name='input-linux'/> <flag name='memory-backend-file.prealloc-threads'/> <version>5001000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> <package>qemu-5.1.0-5.fc33</package> <arch>sparc</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_5.1.0_x86_64.xml index f02e843248..1c3d3ea2a9 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0_x86_64.xml @@ -167,7 +167,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5001000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> <package>v5.1.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_5.2.0_aarch64.xml index 8657478d86..effcf4e96a 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0_aarch64.xml @@ -131,7 +131,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>61700243</microcodeVersion> <package>v5.2.0</package> <arch>aarch64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml index 9a571817c6..d02441420d 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml @@ -138,7 +138,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>42900243</microcodeVersion> <package>v5.2.0</package> <arch>ppc64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0_riscv64.xml b/tests/qemucapabilitiesdata/caps_5.2.0_riscv64.xml index ff3a4a7168..fe4757a12e 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0_riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0_riscv64.xml @@ -124,7 +124,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> <package>v5.2.0</package> <arch>riscv64</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0_s390x.xml b/tests/qemucapabilitiesdata/caps_5.2.0_s390x.xml index 3ec0bd4c32..38a3f70a5e 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0_s390x.xml @@ -87,7 +87,6 @@ <flag name='virtio-net.rss'/> <flag name='virtio-crypto'/> <version>5002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>39100243</microcodeVersion> <package>qemu-5.2.0-20201215.0.ba93e22c.fc32</package> <arch>s390x</arch> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_5.2.0_x86_64.xml index 293447644e..654fec58fe 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0_x86_64.xml @@ -171,7 +171,6 @@ <flag name='usb-host.guest-resets-all'/> <flag name='virtio-crypto'/> <version>5002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100243</microcodeVersion> <package>v5.2.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_6.0.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_6.0.0_aarch64.xml index a71b955266..651cdc8095 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0_aarch64.xml @@ -141,7 +141,6 @@ <flag name='virtio-crypto'/> <flag name='pvpanic-pci'/> <version>6000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>61700242</microcodeVersion> <package>v6.0.0</package> <arch>aarch64</arch> diff --git a/tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml b/tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml index 89420c1e9b..a63263e7e5 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0_s390x.xml @@ -96,7 +96,6 @@ <flag name='migration.blocked-reasons'/> <flag name='virtio-crypto'/> <version>6000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>39100242</microcodeVersion> <package>qemu-6.0.0-20210517.1.4ff77070.fc33</package> <arch>s390x</arch> diff --git a/tests/qemucapabilitiesdata/caps_6.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0_x86_64.xml index fc6a3ffd4a..b1bf3caecf 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0_x86_64.xml @@ -182,7 +182,6 @@ <flag name='virtio-crypto'/> <flag name='pvpanic-pci'/> <version>6000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> <package>v6.0.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_6.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_6.1.0_x86_64.xml index da8478cefa..13d909e382 100644 --- a/tests/qemucapabilitiesdata/caps_6.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.1.0_x86_64.xml @@ -188,7 +188,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>6001000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100243</microcodeVersion> <package>v6.1.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_6.2.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_6.2.0_aarch64.xml index ca7ab8bbc7..fd3d1602a1 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0_aarch64.xml @@ -154,7 +154,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>6001050</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>61700244</microcodeVersion> <package></package> <arch>aarch64</arch> diff --git a/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml index 7759599e67..97ebca47eb 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml @@ -151,7 +151,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>6002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>42900244</microcodeVersion> <package>v6.2.0</package> <arch>ppc64</arch> diff --git a/tests/qemucapabilitiesdata/caps_6.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_6.2.0_x86_64.xml index db33c30341..e1758396b0 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0_x86_64.xml @@ -190,7 +190,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>6002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100244</microcodeVersion> <package>v6.2.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml b/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml index 836932b95d..2e8495dcdd 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml @@ -162,7 +162,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>6002092</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>61700243</microcodeVersion> <package>v7.0.0-rc2</package> <arch>aarch64</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml index fd428a8afd..1420cc844d 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml @@ -162,7 +162,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>6002092</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>61700243</microcodeVersion> <package>v7.0.0-rc2</package> <arch>aarch64</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml index f4d161b7b4..a00ed4ef68 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml @@ -169,7 +169,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>7000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>42900243</microcodeVersion> <package>v7.0.0</package> <arch>ppc64</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml index 1487630078..b7446435a6 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml @@ -196,7 +196,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>7000000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100243</microcodeVersion> <package>v7.0.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml index e7fd3efca6..ccae1b1d2b 100644 --- a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml @@ -169,7 +169,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>7001000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>42900244</microcodeVersion> <package>v7.1.0</package> <arch>ppc64</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml index 17b2286a68..6492695705 100644 --- a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml @@ -199,7 +199,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>7001000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100244</microcodeVersion> <package>v7.1.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml b/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml index 717debd9b1..f190be552a 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml @@ -157,7 +157,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>7002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> <package>qemu-7.2.0-6.fc37</package> <arch>ppc</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml index 941823892c..c08a99e734 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml @@ -203,7 +203,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>7002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100245</microcodeVersion> <package>v7.2.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml index 6a4ac5dcfa..37933c0848 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml @@ -203,7 +203,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>7002000</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100245</microcodeVersion> <package>v7.2.0</package> <arch>x86_64</arch> diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml b/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml index a75e80120d..361c5fb811 100644 --- a/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml @@ -144,7 +144,6 @@ <flag name='pvpanic-pci'/> <flag name='virtio-gpu.blob'/> <version>7002050</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> <package>v7.2.0-333-g222059a0fc</package> <arch>riscv64</arch> diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml index 74128be904..73924e1163 100644 --- a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml @@ -207,7 +207,6 @@ <flag name='rbd-encryption-layering'/> <flag name='rbd-encryption-luks-any'/> <version>7002050</version> - <kvmVersion>0</kvmVersion> <microcodeVersion>43100244</microcodeVersion> <package>v7.2.0-2146-g2946e1af27</package> <arch>x86_64</arch> -- 2.39.2

Get rid of nested ternaries by adding a few helper variables and more explicit if conditions to fill them appropriately. Note that 'virCapabilitiesAllocMachines' doesn't require return value check any more as it can't fail. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/libxl/libxl_capabilities.c | 38 ++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index c2975d637e..82c38d1b26 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -463,26 +463,32 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCaps *caps) for (i = 0; i < nr_guest_archs; ++i) { virCapsGuest *guest; - char const *const xen_machines[] = { - guest_archs[i].hvm ? "xenfv" : - (guest_archs[i].pvh ? "xenpvh" : "xenpv")}; virCapsGuestMachine **machines; + virDomainOSType ostype = VIR_DOMAIN_OSTYPE_XEN; + const char *loader = NULL; - if ((machines = virCapabilitiesAllocMachines(xen_machines, 1)) == NULL) - return -1; + if (guest_archs[i].hvm) { + char const *const xen_machines[] = { "xenfv", NULL }; + + ostype = VIR_DOMAIN_OSTYPE_HVM; + loader = LIBXL_FIRMWARE_DIR "/hvmloader"; + + machines = virCapabilitiesAllocMachines(xen_machines, 1); + } else if (guest_archs[i].pvh) { + char const *const xen_machines[] = { "xenpvh", NULL }; + + ostype = VIR_DOMAIN_OSTYPE_XENPVH; + machines = virCapabilitiesAllocMachines(xen_machines, 1); + } else { + char const *const xen_machines[] = { "xenpv", NULL }; + + ostype = VIR_DOMAIN_OSTYPE_XEN; + machines = virCapabilitiesAllocMachines(xen_machines, 1); + } - guest = virCapabilitiesAddGuest(caps, - guest_archs[i].hvm ? VIR_DOMAIN_OSTYPE_HVM : - (guest_archs[i].pvh ? VIR_DOMAIN_OSTYPE_XENPVH : - VIR_DOMAIN_OSTYPE_XEN), - guest_archs[i].arch, + guest = virCapabilitiesAddGuest(caps, ostype, guest_archs[i].arch, LIBXL_EXECBIN_DIR "/qemu-system-i386", - (guest_archs[i].hvm ? - LIBXL_FIRMWARE_DIR "/hvmloader" : - NULL), - 1, - machines); - machines = NULL; + loader, 1, machines); virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL, NULL, 0, NULL); -- 2.39.2

Simplify use of the function by determining the number of elements inside the function. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/conf/capabilities.c | 12 +++++++----- src/conf/capabilities.h | 2 +- src/libxl/libxl_capabilities.c | 9 +++++---- tests/testutilsqemu.c | 23 +++-------------------- tests/testutilsxen.c | 26 +++++++------------------- 5 files changed, 23 insertions(+), 49 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 9144ced498..6d2f6e282d 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -380,21 +380,23 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps, /** * virCapabilitiesAllocMachines: - * @machines: machine variants for emulator ('pc', or 'isapc', etc) - * @nmachines: number of machine variants for emulator + * @machines: NULL-terminated list of machine variants for emulator ('pc', or 'isapc', etc) + * @nmachines: filled with number of machine variants for emulator * * Allocate a table of virCapsGuestMachine *from the supplied table * of machine names. */ virCapsGuestMachine ** -virCapabilitiesAllocMachines(const char *const *names, int nnames) +virCapabilitiesAllocMachines(const char *const *names, + int *nnames) { virCapsGuestMachine **machines; size_t i; - machines = g_new0(virCapsGuestMachine *, nnames); + *nnames = g_strv_length((gchar **)names); + machines = g_new0(virCapsGuestMachine *, *nnames); - for (i = 0; i < nnames; i++) { + for (i = 0; i < *nnames; i++) { machines[i] = g_new0(virCapsGuestMachine, 1); machines[i]->name = g_strdup(names[i]); } diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index ef6e8ab685..07f7a3ef58 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -261,7 +261,7 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps, virCapsGuestMachine ** virCapabilitiesAllocMachines(const char *const *names, - int nnames); + int *nnames); void virCapabilitiesFreeMachines(virCapsGuestMachine **machines, int nmachines); diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 82c38d1b26..2f4bc8bde8 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -464,6 +464,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCaps *caps) for (i = 0; i < nr_guest_archs; ++i) { virCapsGuest *guest; virCapsGuestMachine **machines; + int nmachines; virDomainOSType ostype = VIR_DOMAIN_OSTYPE_XEN; const char *loader = NULL; @@ -473,22 +474,22 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCaps *caps) ostype = VIR_DOMAIN_OSTYPE_HVM; loader = LIBXL_FIRMWARE_DIR "/hvmloader"; - machines = virCapabilitiesAllocMachines(xen_machines, 1); + machines = virCapabilitiesAllocMachines(xen_machines, &nmachines); } else if (guest_archs[i].pvh) { char const *const xen_machines[] = { "xenpvh", NULL }; ostype = VIR_DOMAIN_OSTYPE_XENPVH; - machines = virCapabilitiesAllocMachines(xen_machines, 1); + machines = virCapabilitiesAllocMachines(xen_machines, &nmachines); } else { char const *const xen_machines[] = { "xenpv", NULL }; ostype = VIR_DOMAIN_OSTYPE_XEN; - machines = virCapabilitiesAllocMachines(xen_machines, 1); + machines = virCapabilitiesAllocMachines(xen_machines, &nmachines); } guest = virCapabilitiesAddGuest(caps, ostype, guest_archs[i].arch, LIBXL_EXECBIN_DIR "/qemu-system-i386", - loader, 1, machines); + loader, nmachines, machines); virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL, NULL, 0, NULL); diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index d5922f302d..f6d49bc193 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -158,7 +158,7 @@ static int testQemuAddGuest(virCaps *caps, virArch arch) { - size_t nmachines; + int nmachines; virCapsGuestMachine **machines = NULL; virCapsGuest *guest; virArch emu_arch = arch; @@ -169,19 +169,11 @@ testQemuAddGuest(virCaps *caps, if (qemu_emulators[emu_arch] == NULL) return 0; - nmachines = g_strv_length((gchar **)qemu_machines[emu_arch]); - machines = virCapabilitiesAllocMachines(qemu_machines[emu_arch], - nmachines); - if (machines == NULL) - goto error; - + machines = virCapabilitiesAllocMachines(qemu_machines[emu_arch], &nmachines); guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, arch, qemu_emulators[emu_arch], NULL, nmachines, machines); - machines = NULL; - nmachines = 0; - if (arch == VIR_ARCH_I686 || arch == VIR_ARCH_X86_64) virCapabilitiesAddGuestFeature(guest, VIR_CAPS_GUEST_FEATURE_TYPE_CPUSELECTION); @@ -189,21 +181,12 @@ testQemuAddGuest(virCaps *caps, virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL); - nmachines = g_strv_length((char **)qemu_machines[emu_arch]); - machines = virCapabilitiesAllocMachines(qemu_machines[emu_arch], - nmachines); - if (machines == NULL) - goto error; - + machines = virCapabilitiesAllocMachines(qemu_machines[emu_arch], &nmachines); virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, qemu_emulators[emu_arch], NULL, nmachines, machines); return 0; - - error: - virCapabilitiesFreeMachines(machines, nmachines); - return -1; } diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c index 821ee49d94..3484cccbf2 100644 --- a/tests/testutilsxen.c +++ b/tests/testutilsxen.c @@ -16,13 +16,13 @@ testXLInitCaps(void) virCapsGuestMachine **machines; int nmachines; static const char *const x86_machines[] = { - "xenfv" + "xenfv", NULL, }; static const char *const xen_machines[] = { - "xenpv", + "xenpv", NULL, }; static const char *const pvh_machines[] = { - "xenpvh", + "xenpvh", NULL, }; if ((caps = virCapabilitiesNew(virArchFromHost(), @@ -31,48 +31,36 @@ testXLInitCaps(void) caps->host.cpu = virCPUDefCopy(&cpuDefaultData); - nmachines = G_N_ELEMENTS(x86_machines); - if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL) - goto cleanup; + machines = virCapabilitiesAllocMachines(x86_machines, &nmachines); guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, "/usr/lib/xen/bin/qemu-system-i386", "/usr/lib/xen/boot/hvmloader", nmachines, machines); - machines = NULL; + virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL, NULL, 0, NULL); - nmachines = G_N_ELEMENTS(xen_machines); - if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL) - goto cleanup; + machines = virCapabilitiesAllocMachines(xen_machines, &nmachines); guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_XEN, VIR_ARCH_X86_64, "/usr/lib/xen/bin/qemu-system-i386", NULL, nmachines, machines); - machines = NULL; virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL, NULL, 0, NULL); - nmachines = G_N_ELEMENTS(pvh_machines); - if ((machines = virCapabilitiesAllocMachines(pvh_machines, nmachines)) == NULL) - goto cleanup; + machines = virCapabilitiesAllocMachines(pvh_machines, &nmachines); guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_XENPVH, VIR_ARCH_X86_64, "/usr/lib/xen/bin/qemu-system-i386", NULL, nmachines, machines); - machines = NULL; virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN, NULL, NULL, 0, NULL); return g_steal_pointer(&caps); - - cleanup: - virCapabilitiesFreeMachines(machines, nmachines); - return NULL; } -- 2.39.2

The function always returns 0. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 6355c80f30..0201f288b3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1015,7 +1015,7 @@ virQEMUCapsInitGuest(virCaps *caps, } -static int +static void virQEMUCapsGetMachineTypesCaps(virQEMUCaps *qemuCaps, size_t *nmachines, virCapsGuestMachine ***machines) @@ -1037,7 +1037,7 @@ virQEMUCapsGetMachineTypesCaps(virQEMUCaps *qemuCaps, *nmachines = accel->nmachineTypes; if (*nmachines == 0) - return 0; + return; array = g_ptr_array_sized_new(*nmachines); @@ -1093,8 +1093,6 @@ virQEMUCapsGetMachineTypesCaps(virQEMUCaps *qemuCaps, *machines = g_new0(virCapsGuestMachine *, array->len); for (i = 0; i < array->len; ++i) (*machines)[i] = g_ptr_array_index(array, i); - - return 0; } @@ -1112,8 +1110,7 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, if (!binary) return 0; - if (virQEMUCapsGetMachineTypesCaps(qemuCaps, &nmachines, &machines) < 0) - goto cleanup; + virQEMUCapsGetMachineTypesCaps(qemuCaps, &nmachines, &machines); /* We register kvm as the base emulator too, since we can * just give -no-kvm to disable acceleration if required */ @@ -1160,8 +1157,6 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, ret = 0; - cleanup: - virCapabilitiesFreeMachines(machines, nmachines); return ret; -- 2.39.2

Remove useless call to virCapabilitiesFreeMachines as the pointers were cleared and the unneeded 'ret' variable. Since we don't need to clear the 'machines' pointer now, remove that as well. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 0201f288b3..135455df63 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1105,7 +1105,6 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, virCapsGuest *guest; virCapsGuestMachine **machines = NULL; size_t nmachines = 0; - int ret = -1; if (!binary) return 0; @@ -1118,9 +1117,6 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, guestarch, binary, NULL, nmachines, machines); - machines = NULL; - nmachines = 0; - /* CPU selection is always available, because all QEMU versions * we support can use at least '-cpu host' */ virCapabilitiesAddGuestFeature(guest, VIR_CAPS_GUEST_FEATURE_TYPE_CPUSELECTION); @@ -1155,11 +1151,7 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, virCapabilitiesAddGuestFeature(guest, VIR_CAPS_GUEST_FEATURE_TYPE_NONPAE); } - ret = 0; - - virCapabilitiesFreeMachines(machines, nmachines); - - return ret; + return 0; } -- 2.39.2

The function always returns 0. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 11 ++++------- src/qemu/qemu_capabilities.h | 8 ++++---- tests/qemucaps2xmltest.c | 8 +------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 135455df63..72105a65a3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1004,9 +1004,8 @@ virQEMUCapsInitGuest(virCaps *caps, } } - ret = virQEMUCapsInitGuestFromBinary(caps, - binary, qemuCaps, - guestarch); + virQEMUCapsInitGuestFromBinary(caps, binary, qemuCaps, guestarch); + ret = 0; VIR_FREE(binary); virObjectUnref(qemuCaps); @@ -1096,7 +1095,7 @@ virQEMUCapsGetMachineTypesCaps(virQEMUCaps *qemuCaps, } -int +void virQEMUCapsInitGuestFromBinary(virCaps *caps, const char *binary, virQEMUCaps *qemuCaps, @@ -1107,7 +1106,7 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, size_t nmachines = 0; if (!binary) - return 0; + return; virQEMUCapsGetMachineTypesCaps(qemuCaps, &nmachines, &machines); @@ -1150,8 +1149,6 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, virCapabilitiesAddGuestFeature(guest, VIR_CAPS_GUEST_FEATURE_TYPE_PAE); virCapabilitiesAddGuestFeature(guest, VIR_CAPS_GUEST_FEATURE_TYPE_NONPAE); } - - return 0; } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 4881f41253..ca31e26f0d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -819,10 +819,10 @@ bool virQEMUCapsSupportsGICVersion(virQEMUCaps *qemuCaps, const char *virQEMUCapsGetPreferredMachine(virQEMUCaps *qemuCaps, virDomainVirtType virtType); -int virQEMUCapsInitGuestFromBinary(virCaps *caps, - const char *binary, - virQEMUCaps *qemuCaps, - virArch guestarch); +void virQEMUCapsInitGuestFromBinary(virCaps *caps, + const char *binary, + virQEMUCaps *qemuCaps, + virArch guestarch); int virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virArch hostarch, diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index 2c5cb1b68b..192fb48450 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -102,13 +102,7 @@ testGetCaps(char *capsData, const testQemuData *data) return NULL; } - if (virQEMUCapsInitGuestFromBinary(caps, - binary, - qemuCaps, - arch) < 0) { - fprintf(stderr, "failed to create the capabilities from qemu"); - return NULL; - } + virQEMUCapsInitGuestFromBinary(caps, binary, qemuCaps, arch); return g_steal_pointer(&caps); } -- 2.39.2

Use automatic pointer freeing, remove 'ret' variable and also remove return value completely. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 72105a65a3..93915a9284 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -984,15 +984,14 @@ virQEMUCapsGetDefaultEmulator(virArch hostarch, } -static int +static void virQEMUCapsInitGuest(virCaps *caps, virFileCache *cache, virArch hostarch, virArch guestarch) { - char *binary = NULL; - virQEMUCaps *qemuCaps = NULL; - int ret = -1; + g_autofree char *binary = NULL; + g_autoptr(virQEMUCaps) qemuCaps = NULL; binary = virQEMUCapsGetDefaultEmulator(hostarch, guestarch); @@ -1000,17 +999,10 @@ virQEMUCapsInitGuest(virCaps *caps, if (binary) { if (!(qemuCaps = virQEMUCapsCacheLookup(cache, binary))) { virResetLastError(); - VIR_FREE(binary); } } virQEMUCapsInitGuestFromBinary(caps, binary, qemuCaps, guestarch); - ret = 0; - - VIR_FREE(binary); - virObjectUnref(qemuCaps); - - return ret; } @@ -1194,10 +1186,7 @@ virQEMUCapsInit(virFileCache *cache) * if a qemu-system-$ARCH binary can't be found */ for (i = 0; i < VIR_ARCH_LAST; i++) - if (virQEMUCapsInitGuest(caps, cache, - hostarch, - i) < 0) - return NULL; + virQEMUCapsInitGuest(caps, cache, hostarch, i); return g_steal_pointer(&caps); } -- 2.39.2

On a Thursday in 2023, Peter Krempa wrote:
Use automatic pointer freeing, remove 'ret' variable and also remove return value completely.
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 72105a65a3..93915a9284 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -984,15 +984,14 @@ virQEMUCapsGetDefaultEmulator(virArch hostarch, }
-static int +static void virQEMUCapsInitGuest(virCaps *caps, virFileCache *cache, virArch hostarch, virArch guestarch) { - char *binary = NULL; - virQEMUCaps *qemuCaps = NULL; - int ret = -1; + g_autofree char *binary = NULL; + g_autoptr(virQEMUCaps) qemuCaps = NULL;
binary = virQEMUCapsGetDefaultEmulator(hostarch, guestarch);
@@ -1000,17 +999,10 @@ virQEMUCapsInitGuest(virCaps *caps, if (binary) { if (!(qemuCaps = virQEMUCapsCacheLookup(cache, binary))) { virResetLastError(); - VIR_FREE(binary);
A 'return;' might be needed here. Before, VIR_FREE would set 'binary' to NULL, making the following virQEMUCapsInitGuestFromBinary call exit early. Jano
} }
virQEMUCapsInitGuestFromBinary(caps, binary, qemuCaps, guestarch); - ret = 0; - - VIR_FREE(binary); - virObjectUnref(qemuCaps); - - return ret; }

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/conf/capabilities.c | 19 ------------------- src/conf/capabilities.h | 3 --- src/libvirt_private.syms | 1 - 3 files changed, 23 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 6d2f6e282d..c1d5d6cd6e 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -404,25 +404,6 @@ virCapabilitiesAllocMachines(const char *const *names, return machines; } -/** - * virCapabilitiesFreeMachines: - * @machines: table of vircapsGuestMachinePtr - * - * Free a table of virCapsGuestMachine * - */ -void -virCapabilitiesFreeMachines(virCapsGuestMachine **machines, - int nmachines) -{ - size_t i; - if (!machines) - return; - for (i = 0; i < nmachines && machines[i]; i++) { - g_clear_pointer(&machines[i], virCapabilitiesFreeGuestMachine); - } - g_free(machines); -} - /** * virCapabilitiesAddGuest: * @caps: capabilities to extend diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index 07f7a3ef58..c78e3e52fa 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -262,9 +262,6 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps, virCapsGuestMachine ** virCapabilitiesAllocMachines(const char *const *names, int *nnames); -void -virCapabilitiesFreeMachines(virCapsGuestMachine **machines, - int nmachines); void virCapabilitiesFreeGuest(virCapsGuest *guest); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 87c3bab64f..37fc6d8b5c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -64,7 +64,6 @@ virCapabilitiesDomainDataLookup; virCapabilitiesDomainSupported; virCapabilitiesFormatXML; virCapabilitiesFreeGuest; -virCapabilitiesFreeMachines; virCapabilitiesGetNodeInfo; virCapabilitiesHostInitIOMMU; virCapabilitiesHostNUMAAddCell; -- 2.39.2

We have testing based on real capabilities in 'qemucaps2xmltest' for qemu guest related data and 'vircaps2xmltest' tests the host data gathering. The testing done here makes no sense. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/vircapstest.c | 74 --------------------------------------------- 1 file changed, 74 deletions(-) diff --git a/tests/vircapstest.c b/tests/vircapstest.c index be93325307..30e56ccc20 100644 --- a/tests/vircapstest.c +++ b/tests/vircapstest.c @@ -21,7 +21,6 @@ #include "testutils.h" #include "testutilslxc.h" -#include "testutilsqemu.h" #include "capabilities.h" #include "virbitmap.h" @@ -51,25 +50,6 @@ test_virCapabilitiesGetCpusForNodemask(const void *data G_GNUC_UNUSED) } -static bool G_GNUC_UNUSED -doCapsExpectFailure(virCaps *caps, - int ostype, - virArch arch, - int domaintype, - const char *emulator, - const char *machinetype) -{ - virCapsDomainData *data = virCapabilitiesDomainDataLookup(caps, ostype, - arch, domaintype, emulator, machinetype); - - if (data) { - VIR_FREE(data); - return false; - } - - return true; -} - static bool G_GNUC_UNUSED doCapsCompare(virCaps *caps, int ostype, @@ -135,55 +115,6 @@ doCapsCompare(virCaps *caps, if (!doCapsCompare(caps, o, a, d, e, m, fo, fa, fd, fe, fm)) \ ret = -1; -#define CAPS_EXPECT_ERR(o, a, d, e, m) \ - if (!doCapsExpectFailure(caps, o, a, d, e, m)) \ - ret = -1; - -#ifdef WITH_QEMU -static int -test_virCapsDomainDataLookupQEMU(const void *data G_GNUC_UNUSED) -{ - int ret = 0; - g_autoptr(virCaps) caps = NULL; - - if (!(caps = testQemuCapsInit())) - return -1; - - /* Checking each parameter individually */ - CAPSCOMP(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, NULL, NULL, - VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, - VIR_DOMAIN_VIRT_QEMU, "/usr/bin/qemu-system-x86_64", "pc"); - CAPSCOMP(VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, NULL, NULL, - VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, - VIR_DOMAIN_VIRT_QEMU, "/usr/bin/qemu-system-x86_64", "pc"); - CAPSCOMP(-1, VIR_ARCH_AARCH64, VIR_DOMAIN_VIRT_NONE, NULL, NULL, - VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_AARCH64, - VIR_DOMAIN_VIRT_QEMU, "/usr/bin/qemu-system-aarch64", "virt"); - CAPSCOMP(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_KVM, NULL, NULL, - VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, - VIR_DOMAIN_VIRT_KVM, "/usr/bin/qemu-system-x86_64", "pc"); - CAPSCOMP(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, "/usr/bin/qemu-system-ppc64", NULL, - VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64, - VIR_DOMAIN_VIRT_QEMU, "/usr/bin/qemu-system-ppc64", "pseries"); - - CAPSCOMP(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, NULL, "pseries", - VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64, - VIR_DOMAIN_VIRT_QEMU, "/usr/bin/qemu-system-ppc64", "pseries"); - CAPSCOMP(-1, VIR_ARCH_PPC64LE, VIR_DOMAIN_VIRT_NONE, NULL, "pseries", - VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_PPC64LE, - VIR_DOMAIN_VIRT_QEMU, "/usr/bin/qemu-system-ppc64", "pseries"); - - CAPS_EXPECT_ERR(VIR_DOMAIN_OSTYPE_LINUX, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, NULL, NULL); - CAPS_EXPECT_ERR(-1, VIR_ARCH_PPC64LE, VIR_DOMAIN_VIRT_NONE, NULL, "pc"); - CAPS_EXPECT_ERR(-1, VIR_ARCH_MIPS, VIR_DOMAIN_VIRT_NONE, NULL, NULL); - CAPS_EXPECT_ERR(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, - "/usr/bin/qemu-system-aarch64", "pc"); - CAPS_EXPECT_ERR(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_VMWARE, NULL, "pc"); - - return ret; -} -#endif /* WITH_QEMU */ - #ifdef WITH_LXC static int test_virCapsDomainDataLookupLXC(const void *data G_GNUC_UNUSED) @@ -213,11 +144,6 @@ mymain(void) if (virTestRun("virCapabilitiesGetCpusForNodemask", test_virCapabilitiesGetCpusForNodemask, NULL) < 0) ret = -1; -#ifdef WITH_QEMU - if (virTestRun("virCapsDomainDataLookupQEMU", - test_virCapsDomainDataLookupQEMU, NULL) < 0) - ret = -1; -#endif #ifdef WITH_LXC if (virTestRun("virCapsDomainDataLookupLXC", test_virCapsDomainDataLookupLXC, NULL) < 0) -- 2.39.2

The test case doesn't validate the returned map of cpus, just checks that it didn't fail. We test the returned value indirectly via qemuxml2argvtest. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/vircapstest.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/tests/vircapstest.c b/tests/vircapstest.c index 30e56ccc20..2101d35198 100644 --- a/tests/vircapstest.c +++ b/tests/vircapstest.c @@ -22,34 +22,11 @@ #include "testutils.h" #include "testutilslxc.h" #include "capabilities.h" -#include "virbitmap.h" #define VIR_FROM_THIS VIR_FROM_NONE -static int -test_virCapabilitiesGetCpusForNodemask(const void *data G_GNUC_UNUSED) -{ - const char *nodestr = "3,4,5,6"; - g_autoptr(virBitmap) nodemask = NULL; - g_autoptr(virBitmap) cpumap = NULL; - g_autoptr(virCapsHostNUMA) caps = NULL; - int mask_size = 8; - - if (!(caps = virTestCapsBuildNUMATopology(3))) - return -1; - - if (virBitmapParse(nodestr, &nodemask, mask_size) < 0) - return -1; - - if (!(cpumap = virCapabilitiesHostNUMAGetCpus(caps, nodemask))) - return -1; - - return 0; -} - - static bool G_GNUC_UNUSED doCapsCompare(virCaps *caps, int ostype, @@ -141,9 +118,6 @@ mymain(void) { int ret = 0; - if (virTestRun("virCapabilitiesGetCpusForNodemask", - test_virCapabilitiesGetCpusForNodemask, NULL) < 0) - ret = -1; #ifdef WITH_LXC if (virTestRun("virCapsDomainDataLookupLXC", test_virCapsDomainDataLookupLXC, NULL) < 0) -- 2.39.2

Technically for the LXC capabilities lookup we don't have another test case, but given that it shares the implementation with qemu and thus the only thing we are missing out on is testing of filling of the fake capabilities which doesn't make sense testing. Remove vircapstest. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/meson.build | 14 ----- tests/vircapstest.c | 130 -------------------------------------------- 2 files changed, 144 deletions(-) delete mode 100644 tests/vircapstest.c diff --git a/tests/meson.build b/tests/meson.build index 6be806f4ae..11010ebc6c 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -249,19 +249,6 @@ if conf.has('WITH_QEMU') domaincapstest_link_whole += [ test_utils_qemu_lib ] endif -vircapstest_link_with = [] -vircapstest_link_whole = [] -vircapstest_sources = [ 'vircapstest.c' ] -if conf.has('WITH_LXC') - vircapstest_link_with += [ lxc_driver_impl_lib ] - vircapstest_link_whole += [ test_utils_lxc_lib ] -endif -if conf.has('WITH_QEMU') - vircapstest_link_with += [ qemu_driver_impl ] - vircapstest_link_whole += [ test_utils_qemu_lib ] - vircapstest_sources += [ qemu_dtrace_gen_objects ] -endif - tests += [ { 'name': 'commandtest' }, { 'name': 'cputest', 'link_with': cputest_link_with, 'link_whole': cputest_link_whole }, @@ -285,7 +272,6 @@ tests += [ { 'name': 'virauthconfigtest' }, { 'name': 'virbitmaptest' }, { 'name': 'virbuftest' }, - { 'name': 'vircapstest', 'sources': vircapstest_sources, 'link_with': vircapstest_link_with, 'link_whole': vircapstest_link_whole }, { 'name': 'vircgrouptest' }, { 'name': 'virconftest' }, { 'name': 'vircryptotest' }, diff --git a/tests/vircapstest.c b/tests/vircapstest.c deleted file mode 100644 index 2101d35198..0000000000 --- a/tests/vircapstest.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) IBM Corp 2014 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include <config.h> - -#include "testutils.h" -#include "testutilslxc.h" -#include "capabilities.h" - - -#define VIR_FROM_THIS VIR_FROM_NONE - - -static bool G_GNUC_UNUSED -doCapsCompare(virCaps *caps, - int ostype, - virArch arch, - int domaintype, - const char *emulator, - const char *machinetype, - int expect_ostype, - virArch expect_arch, - int expect_domaintype, - const char *expect_emulator, - const char *expect_machinetype) -{ - bool ret = false; - virCapsDomainData *data = virCapabilitiesDomainDataLookup(caps, ostype, - arch, domaintype, emulator, machinetype); - - if (!data) - goto error; - - if (data->ostype != expect_ostype) { - fprintf(stderr, "data->ostype=%s doesn't match expect_ostype=%s\n", - virDomainOSTypeToString(data->ostype), - virDomainOSTypeToString(expect_ostype)); - goto error; - } - - if (data->arch != expect_arch) { - fprintf(stderr, "data->arch=%s doesn't match expect_arch=%s\n", - virArchToString(data->arch), - virArchToString(expect_arch)); - goto error; - } - - if (data->domaintype != expect_domaintype) { - fprintf(stderr, "data->domaintype=%s doesn't match " - "expect_domaintype=%s\n", - virDomainVirtTypeToString(data->domaintype), - virDomainVirtTypeToString(expect_domaintype)); - goto error; - } - - if (STRNEQ(data->emulator, expect_emulator)) { - fprintf(stderr, "data->emulator=%s doesn't match expect_emulator=%s\n", - data->emulator, expect_emulator); - goto error; - } - - if (STRNEQ_NULLABLE(data->machinetype, expect_machinetype)) { - fprintf(stderr, "data->machinetype=%s doesn't match " - "expect_machinetype=%s\n", - NULLSTR(data->machinetype), NULLSTR(expect_machinetype)); - goto error; - } - - ret = true; - error: - VIR_FREE(data); - return ret; -} - -#define CAPSCOMP(o, a, d, e, m, fo, fa, fd, fe, fm) \ - if (!doCapsCompare(caps, o, a, d, e, m, fo, fa, fd, fe, fm)) \ - ret = -1; - -#ifdef WITH_LXC -static int -test_virCapsDomainDataLookupLXC(const void *data G_GNUC_UNUSED) -{ - int ret = 0; - g_autoptr(virCaps) caps = NULL; - - if (!(caps = testLXCCapsInit())) - return -1; - - CAPSCOMP(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, NULL, NULL, - VIR_DOMAIN_OSTYPE_EXE, VIR_ARCH_X86_64, - VIR_DOMAIN_VIRT_LXC, "/usr/libexec/libvirt_lxc", NULL); - CAPSCOMP(-1, VIR_ARCH_X86_64, VIR_DOMAIN_VIRT_NONE, NULL, NULL, - VIR_DOMAIN_OSTYPE_EXE, VIR_ARCH_X86_64, - VIR_DOMAIN_VIRT_LXC, "/usr/libexec/libvirt_lxc", NULL); - - return ret; -} -#endif /* WITH_LXC */ - -static int -mymain(void) -{ - int ret = 0; - -#ifdef WITH_LXC - if (virTestRun("virCapsDomainDataLookupLXC", - test_virCapsDomainDataLookupLXC, NULL) < 0) - ret = -1; -#endif /* WITH_LXC */ - - return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; -} - -VIR_TEST_MAIN(mymain) -- 2.39.2

'testQemuInfoInitArgs' contains the logic to fetch and use the capabilities for tests using 'struct testQemuInfo'. As in certain cases use of 'struct testQemuInfo' is an overkill extract the code to fetch the capabilities into a standalone helper. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/testutilsqemu.c | 117 +++++++++++++++++++++++++++--------------- tests/testutilsqemu.h | 8 +++ 2 files changed, 85 insertions(+), 40 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index f6d49bc193..a1c55170d9 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -902,10 +902,77 @@ testQemuInfoSetArgs(struct testQemuInfo *info, } +/** + * testQemuGetRealCaps: + * + * @arch: architecture to fetch caps for + * @version: qemu version to fetch caps for ("latest" for fetching the latest version from @capsLatestFiles) + * @variant: capabilities variant to fetch caps for + * @capsLatestFiles: hash table containing latest version of capabilities for the @arch+@variant tuple + * @capsCache: hash table filled with the cache of capabilities + * @capsReplies: Filled with path to the corresponding '.replies' file + * + * Fetches and returns the appropriate virQEMUCaps for the @arch+@version+@variant + * tuple. The returned pointer is a copy of the cached object and thus can + * be freely modified. Caller is responsible for freeing it. + */ +virQEMUCaps * +testQemuGetRealCaps(const char *arch, + const char *version, + const char *variant, + GHashTable *capsLatestFiles, + GHashTable *capsCache, + char **capsReplies) +{ + g_autofree char *capsfile = NULL; + bool stripmachinealiases = false; + virQEMUCaps *cachedcaps = NULL; + virQEMUCaps *ret = NULL; + + if (STREQ(version, "latest")) { + g_autofree char *archvariant = g_strdup_printf("%s%s", arch, variant); + struct testQemuCapsFile *f = g_hash_table_lookup(capsLatestFiles, archvariant); + + if (!f) { + VIR_TEST_VERBOSE("'latest' caps for '%s' were not found\n", arch); + return NULL; + } + + capsfile = g_strdup(f->path); + stripmachinealiases = true; + } else { + capsfile = g_strdup_printf("%s/caps_%s_%s%s.xml", + TEST_QEMU_CAPS_PATH, + version, arch, variant); + } + + if (!g_hash_table_lookup_extended(capsCache, capsfile, NULL, (void **) &cachedcaps)) { + if (!(cachedcaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), capsfile))) { + VIR_TEST_VERBOSE("Failed to parse qemu capabilities file '%s'", capsfile); + return NULL; + } + + g_hash_table_insert(capsCache, g_strdup(capsfile), cachedcaps); + } + + ret = virQEMUCapsNewCopy(cachedcaps); + + if (stripmachinealiases) + virQEMUCapsStripMachineAliases(ret); + + if (capsReplies) { + /* provide path to the replies file for schema testing */ + capsfile[strlen(capsfile) - 3] = '\0'; + *capsReplies = g_strdup_printf("%sreplies", capsfile); + } + + return ret; +} + + int testQemuInfoInitArgs(struct testQemuInfo *info) { - g_autofree char *capsfile = NULL; ssize_t cap; if (!info->args.newargs) @@ -927,47 +994,17 @@ testQemuInfoInitArgs(struct testQemuInfo *info) } if (info->args.capsarch && info->args.capsver) { - bool stripmachinealiases = false; - virQEMUCaps *cachedcaps = NULL; - info->arch = virArchFromString(info->args.capsarch); - - if (STREQ(info->args.capsver, "latest")) { - g_autofree char *archvariant = g_strdup_printf("%s%s", info->args.capsarch, info->args.capsvariant); - struct testQemuCapsFile *f = g_hash_table_lookup(info->conf->capslatest, archvariant); - - if (!f) { - fprintf(stderr, "'latest' caps for '%s' were not found\n", info->args.capsarch); - return -1; - } - - capsfile = g_strdup(f->path); - stripmachinealiases = true; - } else { - capsfile = g_strdup_printf("%s/caps_%s_%s%s.xml", - TEST_QEMU_CAPS_PATH, - info->args.capsver, - info->args.capsarch, - info->args.capsvariant); - } - - if (!g_hash_table_lookup_extended(info->conf->capscache, capsfile, NULL, (void **) &cachedcaps)) { - if (!(cachedcaps = qemuTestParseCapabilitiesArch(info->arch, capsfile))) - return -1; - - g_hash_table_insert(info->conf->capscache, g_strdup(capsfile), cachedcaps); - } - - info->qemuCaps = virQEMUCapsNewCopy(cachedcaps); - - if (stripmachinealiases) - virQEMUCapsStripMachineAliases(info->qemuCaps); - info->flags |= FLAG_REAL_CAPS; - - /* provide path to the replies file for schema testing */ - capsfile[strlen(capsfile) - 3] = '\0'; - info->schemafile = g_strdup_printf("%sreplies", capsfile); + info->qemuCaps = testQemuGetRealCaps(info->args.capsarch, + info->args.capsver, + info->args.capsvariant, + info->conf->capslatest, + info->conf->capscache, + &info->schemafile); + + if (!info->qemuCaps) + return -1; } else { info->qemuCaps = virQEMUCapsNew(); } diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index 69cad61f5a..d7ee73beed 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -151,4 +151,12 @@ void testQemuInfoClear(struct testQemuInfo *info); int testQemuPrepareHostBackendChardevOne(virDomainDeviceDef *dev, virDomainChrSourceDef *chardev, void *opaque); + +virQEMUCaps * +testQemuGetRealCaps(const char *arch, + const char *version, + const char *variant, + GHashTable *capsLatestFiles, + GHashTable *capsCache, + char **capsReplies); #endif -- 2.39.2

Move the lookup of the corresponding QMP schema used for validation of QMP commands from 'testCompareXMLToArgvValidateSchema' to testQemuGetRealCaps as an optional step. This will simplify using QMP command validation in other tests which will use testQemuGetRealCaps. 'testutilsqemuschema' module is now linked into 'test_utils_qemu' as it contains no monitor-specific code itself and after this patch it's referenced directly from that module. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/meson.build | 4 ++-- tests/qemuxml2argvtest.c | 22 ++-------------------- tests/testutilsqemu.c | 29 +++++++++++++++++++++-------- tests/testutilsqemu.h | 5 +++-- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index 11010ebc6c..8958e68a69 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -147,13 +147,13 @@ endif if conf.has('WITH_QEMU') test_utils_qemu_lib = static_library( 'test_utils_qemu', - [ 'testutilsqemu.c' ], + [ 'testutilsqemu.c', 'testutilsqemuschema.c' ], dependencies: [ tests_dep ], ) test_utils_qemu_monitor_lib = static_library( 'test_utils_qemu_monitor', - [ 'qemumonitortestutils.c', 'testutilsqemuschema.c' ], + [ 'qemumonitortestutils.c', ], dependencies: [ tests_dep ], ) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7f3b2985eb..e0d237bb2d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -549,32 +549,14 @@ testCompareXMLToArgvValidateSchema(virCommand *cmd, struct testQemuInfo *info) { g_auto(GStrv) args = NULL; - GHashTable *schema = NULL; - - /* comment out with line comment to enable schema checking for non _CAPS tests - if (!info->schemafile) - info->schemafile = testQemuGetLatestCapsForArch(virArchToString(info->arch), "replies"); - // */ - - if (info->schemafile) { - /* lookup and insert into cache if not found */ - if (!g_hash_table_lookup_extended(info->conf->qapiSchemaCache, - info->schemafile, - NULL, (void **) &schema)) { - schema = testQEMUSchemaLoad(info->schemafile); - g_hash_table_insert(info->conf->qapiSchemaCache, - g_strdup(info->schemafile), - schema); - } - } - if (!schema) + if (!info->qmpSchema) return 0; if (virCommandGetArgList(cmd, &args) < 0) return -1; - if (testCompareXMLToArgvValidateSchemaCommand(args, schema) < 0) + if (testCompareXMLToArgvValidateSchemaCommand(args, info->qmpSchema) < 0) return -1; return 0; diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index a1c55170d9..0d7892353c 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -2,6 +2,7 @@ #ifdef WITH_QEMU # include "testutilsqemu.h" +# include "testutilsqemuschema.h" # include "testutilshostcpus.h" # include "testutils.h" # include "viralloc.h" @@ -910,11 +911,16 @@ testQemuInfoSetArgs(struct testQemuInfo *info, * @variant: capabilities variant to fetch caps for * @capsLatestFiles: hash table containing latest version of capabilities for the @arch+@variant tuple * @capsCache: hash table filled with the cache of capabilities - * @capsReplies: Filled with path to the corresponding '.replies' file + * @schemaCache: hash table for caching QMP schemas (may be NULL, see below) + * @schema: Filled with the QMP schema (hash table) (may be NULL, see below) * * Fetches and returns the appropriate virQEMUCaps for the @arch+@version+@variant * tuple. The returned pointer is a copy of the cached object and thus can * be freely modified. Caller is responsible for freeing it. + * + * If @schemaCache and @schema are non-NULL, @schema is filled with with a + * pointer (borrowed from the cache) to the hash table representing the QEMU QMP + * schema used for validation of the monitor traffic. */ virQEMUCaps * testQemuGetRealCaps(const char *arch, @@ -922,7 +928,8 @@ testQemuGetRealCaps(const char *arch, const char *variant, GHashTable *capsLatestFiles, GHashTable *capsCache, - char **capsReplies) + GHashTable *schemaCache, + GHashTable **schema) { g_autofree char *capsfile = NULL; bool stripmachinealiases = false; @@ -960,10 +967,16 @@ testQemuGetRealCaps(const char *arch, if (stripmachinealiases) virQEMUCapsStripMachineAliases(ret); - if (capsReplies) { - /* provide path to the replies file for schema testing */ - capsfile[strlen(capsfile) - 3] = '\0'; - *capsReplies = g_strdup_printf("%sreplies", capsfile); + /* strip 'xml' suffix so that we can format the file to '.replies' */ + capsfile[strlen(capsfile) - 3] = '\0'; + + if (schemaCache && schema) { + g_autofree char *schemafile = g_strdup_printf("%sreplies", capsfile); + + if (!g_hash_table_lookup_extended(schemaCache, schemafile, NULL, (void **) schema)) { + *schema = testQEMUSchemaLoad(schemafile); + g_hash_table_insert(schemaCache, g_strdup(schemafile), *schema); + } } return ret; @@ -1001,7 +1014,8 @@ testQemuInfoInitArgs(struct testQemuInfo *info) info->args.capsvariant, info->conf->capslatest, info->conf->capscache, - &info->schemafile); + info->conf->qapiSchemaCache, + &info->qmpSchema); if (!info->qemuCaps) return -1; @@ -1028,7 +1042,6 @@ testQemuInfoClear(struct testQemuInfo *info) { VIR_FREE(info->infile); VIR_FREE(info->outfile); - VIR_FREE(info->schemafile); VIR_FREE(info->errfile); virObjectUnref(info->qemuCaps); g_clear_pointer(&info->args.fakeCapsAdd, virBitmapFree); diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index d7ee73beed..1e6611daa3 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -99,7 +99,7 @@ struct testQemuInfo { unsigned int flags; unsigned int parseFlags; virArch arch; - char *schemafile; + GHashTable *qmpSchema; /* borrowed pointer from the cache */ struct testQemuArgs args; struct testQemuConf *conf; @@ -158,5 +158,6 @@ testQemuGetRealCaps(const char *arch, const char *variant, GHashTable *capsLatestFiles, GHashTable *capsCache, - char **capsReplies); + GHashTable *schemaCache, + GHashTable **schema); #endif -- 2.39.2

Use testQemuGetRealCaps to fetch real capabilities and use it in place of the faked caps. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemumemlocktest.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c index efed232407..61b73e1d79 100644 --- a/tests/qemumemlocktest.c +++ b/tests/qemumemlocktest.c @@ -45,8 +45,15 @@ testCompareMemLock(const void *data) static int mymain(void) { + g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps(); + g_autoptr(GHashTable) capscache = virHashNew(virObjectUnref); + g_autoptr(virQEMUCaps) qemuCaps_x86_64 = NULL; + g_autoptr(virQEMUCaps) qemuCaps_ppc64 = NULL; int ret = 0; - g_autoptr(virQEMUCaps) qemuCaps = NULL; + + if (!(qemuCaps_x86_64 = testQemuGetRealCaps("x86_64", "latest", "", capslatest, capscache, NULL, NULL)) || + !(qemuCaps_ppc64 = testQemuGetRealCaps("ppc64", "latest", "", capslatest, capscache, NULL, NULL))) + return EXIT_FAILURE; if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; @@ -78,18 +85,15 @@ mymain(void) qemuTestSetHostArch(&driver, VIR_ARCH_X86_64); - DO_TEST("pc-kvm", 0); - DO_TEST("pc-tcg", 0); - - qemuCaps = virQEMUCapsNew(); - - virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI); - - if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps) < 0) { + virFileCacheClear(driver.qemuCapsCache); + if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps_x86_64) < 0) { ret = -1; goto cleanup; }; + DO_TEST("pc-kvm", 0); + DO_TEST("pc-tcg", 0); + DO_TEST("pc-hardlimit", 2147483648); DO_TEST("pc-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); DO_TEST("pc-hostdev", 2147483648); @@ -100,9 +104,8 @@ mymain(void) DO_TEST("pc-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); qemuTestSetHostArch(&driver, VIR_ARCH_PPC64); - - virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); - if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps) < 0) { + virFileCacheClear(driver.qemuCapsCache); + if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps_ppc64) < 0) { ret = -1; goto cleanup; }; -- 2.39.2

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuhotplugtest.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 6a36856d8a..804e32279d 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -319,7 +319,6 @@ testQemuHotplug(const void *data) unsigned int device_parse_flags = 0; virDomainObj *vm = NULL; virDomainDeviceDef *dev = NULL; - g_autoptr(virCaps) caps = NULL; g_autoptr(qemuMonitorTest) test_mon = NULL; qemuDomainObjPrivate *priv = NULL; @@ -339,9 +338,6 @@ testQemuHotplug(const void *data) virTestLoadFile(result_filename, &result_xml) < 0) goto cleanup; - if (!(caps = virQEMUDriverGetCapabilities(&driver, false))) - goto cleanup; - if (test->vm) { vm = test->vm; if (!vm->def) { @@ -480,7 +476,6 @@ testQemuHotplugCpuPrepare(const char *test, GHashTable *qmpschema) { qemuDomainObjPrivate *priv = NULL; - virCaps *caps = NULL; g_autofree char *prefix = NULL; struct testQemuHotplugCpuData *data = NULL; @@ -501,9 +496,6 @@ testQemuHotplugCpuPrepare(const char *test, if (qemuHotplugCreateObjects(driver.xmlopt, &data->vm, data->xml_dom) < 0) goto error; - if (!(caps = virQEMUDriverGetCapabilities(&driver, false))) - goto error; - /* create vm->newDef */ data->vm->persistent = true; if (virDomainObjSetDefTransient(driver.xmlopt, data->vm, NULL) < 0) @@ -533,7 +525,6 @@ testQemuHotplugCpuPrepare(const char *test, return data; error: - virObjectUnref(caps); testQemuHotplugCpuDataFree(data); return NULL; } -- 2.39.2

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml | 4 ++-- .../qemuhotplug-graphics-spice-listen-network.xml | 4 ++-- .../qemuhotplug-graphics-spice-timeout.xml | 4 ++-- tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml index ad77405266..3acf55ab17 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>219100</currentMemory> <vcpu placement='static'>1</vcpu> <os> - <type arch='i686' machine='pc'>hvm</type> + <type arch='x86_64' machine='pc'>hvm</type> <boot dev='hd'/> </os> <clock offset='utc'/> @@ -13,7 +13,7 @@ <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> - <emulator>/usr/bin/qemu-system-i386</emulator> + <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/HostVG/QEMUGuest1'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network.xml index 2323521f5e..e88d1f26d3 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>219136</currentMemory> <vcpu placement='static'>1</vcpu> <os> - <type arch='i686' machine='pc'>hvm</type> + <type arch='x86_64' machine='pc'>hvm</type> <boot dev='hd'/> </os> <clock offset='utc'/> @@ -13,7 +13,7 @@ <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> - <emulator>/usr/bin/qemu-system-i386</emulator> + <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='block' device='disk'> <source dev='/dev/HostVG/QEMUGuest1'/> <target dev='hda' bus='ide'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml index 0ca19e9610..0e96033fc8 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>1048576</currentMemory> <vcpu placement='static'>2</vcpu> <os> - <type arch='i686' machine='pc'>hvm</type> + <type arch='x86_64' machine='pc'>hvm</type> <boot dev='cdrom'/> <boot dev='hd'/> <bootmenu enable='yes'/> @@ -38,7 +38,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/bin/qemu-system-i386</emulator> + <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/f14.img'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml index 657b6ccbed..ec761d6619 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml @@ -5,7 +5,7 @@ <currentMemory unit='KiB'>219136</currentMemory> <vcpu placement='static'>1</vcpu> <os> - <type arch='i686' machine='pc'>hvm</type> + <type arch='x86_64' machine='pc'>hvm</type> <boot dev='hd'/> </os> <clock offset='utc'/> @@ -13,7 +13,7 @@ <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> - <emulator>/usr/bin/qemu-system-i386</emulator> + <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='block' device='disk'> <source dev='/dev/HostVG/QEMUGuest1'/> <target dev='hda' bus='ide'/> -- 2.39.2

All real qemus support the 'lsilogic' controller and thus would pick it as the default rather than virtio-scsi. Since lsilogic is limited in some aspects we should test it with the proper default model. In the future the fake capabilities will be replaced by real capabilities so this test would break. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuhotplugtest.c | 3 ++- .../qemuhotplug-disk-scsi-2.xml | 2 +- .../qemuhotplug-base-with-scsi-controller-live.xml | 8 ++++---- ...base-without-scsi-controller-live+disk-scsi-2.xml | 12 ++++++------ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 804e32279d..819d9215e7 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -70,6 +70,7 @@ qemuHotplugCreateObjects(virDomainXMLOption *xmlopt, priv->qemuCaps = virQEMUCapsNew(); + virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SCSI_LSI); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_SCSI); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM_PLAIN); @@ -790,7 +791,7 @@ mymain(void) DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", true, true, "device_del", QMP_OK); DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", false, false, - "device_del", QMP_DEVICE_DELETED("scsi3-0-5-6") QMP_OK, + "device_del", QMP_DEVICE_DELETED("scsi3-0-6") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-2.xml b/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-2.xml index 876afb182f..97f8ab1418 100644 --- a/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-2.xml +++ b/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-2.xml @@ -2,7 +2,7 @@ <driver name='qemu' type='raw' cache='none'/> <source file='/dev/null'/> <target dev='sdf' bus='scsi'/> - <address type='drive' controller='3' bus='0' target='5' unit='6'/> + <address type='drive' controller='3' bus='0' target='0' unit='6'/> <readonly/> <shareable/> </disk> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml index a61a68f561..939cea4cbe 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml @@ -26,19 +26,19 @@ <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> - <controller type='scsi' index='0' model='virtio-scsi'> + <controller type='scsi' index='0' model='lsilogic'> <alias name='scsi0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> - <controller type='scsi' index='1' model='virtio-scsi'> + <controller type='scsi' index='1' model='lsilogic'> <alias name='scsi1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </controller> - <controller type='scsi' index='2' model='virtio-scsi'> + <controller type='scsi' index='2' model='lsilogic'> <alias name='scsi2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> - <controller type='scsi' index='3' model='virtio-scsi'> + <controller type='scsi' index='3' model='lsilogic'> <alias name='scsi3'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml index 71dd10d40d..97f651374d 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml @@ -26,8 +26,8 @@ <target dev='sdf' bus='scsi'/> <readonly/> <shareable/> - <alias name='scsi3-0-5-6'/> - <address type='drive' controller='3' bus='0' target='5' unit='6'/> + <alias name='scsi3-0-6'/> + <address type='drive' controller='3' bus='0' target='0' unit='6'/> </disk> <controller type='usb' index='0'> <alias name='usb'/> @@ -36,19 +36,19 @@ <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> - <controller type='scsi' index='0' model='virtio-scsi'> + <controller type='scsi' index='0' model='lsilogic'> <alias name='scsi0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </controller> - <controller type='scsi' index='1' model='virtio-scsi'> + <controller type='scsi' index='1' model='lsilogic'> <alias name='scsi1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </controller> - <controller type='scsi' index='2' model='virtio-scsi'> + <controller type='scsi' index='2' model='lsilogic'> <alias name='scsi2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> - <controller type='scsi' index='3' model='virtio-scsi'> + <controller type='scsi' index='3' model='lsilogic'> <alias name='scsi3'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </controller> -- 2.39.2

With modern qemu we use 'set-action' instead of 'watchdog-set-action'. Switch to it so that later qemuhotplugtest can be switched to use real capabilities. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuhotplugtest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 819d9215e7..5f69afc7d4 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -89,6 +89,7 @@ qemuHotplugCreateObjects(virDomainXMLOption *xmlopt, virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SCSI_BLOCK); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_KBD); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_NETDEV_VHOST_VDPA); + virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SET_ACTION); if (qemuTestCapsCacheInsert(driver.qemuCapsCache, priv->qemuCaps) < 0) return -1; @@ -899,13 +900,13 @@ mymain(void) ); DO_TEST_ATTACH("base-live", "watchdog", false, true, - "watchdog-set-action", QMP_OK, + "set-action", QMP_OK, "device_add", QMP_OK); DO_TEST_DETACH("base-live", "watchdog-full", false, false, "device_del", QMP_DEVICE_DELETED("watchdog0") QMP_OK); DO_TEST_ATTACH("base-live", "watchdog-user-alias", false, true, - "watchdog-set-action", QMP_OK, + "set-action", QMP_OK, "device_add", QMP_OK); DO_TEST_DETACH("base-live", "watchdog-user-alias-full", false, false, "device_del", QMP_DEVICE_DELETED("ua-UserWatchdog") QMP_OK); -- 2.39.2

Pass in the whole struct rather than splitting out individual members. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuhotplugtest.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 5f69afc7d4..186958cd57 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -471,21 +471,29 @@ testQemuHotplugCpuDataFree(struct testQemuHotplugCpuData *data) } +struct testQemuHotplugCpuParams { + const char *test; + int newcpus; + const char *cpumap; + bool state; + bool modern; + bool fail; + GHashTable *schema; +}; + + static struct testQemuHotplugCpuData * -testQemuHotplugCpuPrepare(const char *test, - bool modern, - bool fail, - GHashTable *qmpschema) +testQemuHotplugCpuPrepare(const struct testQemuHotplugCpuParams *params) { qemuDomainObjPrivate *priv = NULL; g_autofree char *prefix = NULL; struct testQemuHotplugCpuData *data = NULL; - prefix = g_strdup_printf("%s/qemuhotplugtestcpus/%s", abs_srcdir, test); + prefix = g_strdup_printf("%s/qemuhotplugtestcpus/%s", abs_srcdir, params->test); data = g_new0(struct testQemuHotplugCpuData, 1); - data->modern = modern; + data->modern = params->modern; data->file_xml_dom = g_strdup_printf("%s-domain.xml", prefix); data->file_xml_res_live = g_strdup_printf("%s-result-live.xml", prefix); @@ -509,10 +517,10 @@ testQemuHotplugCpuPrepare(const char *test, virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); if (!(data->mon = qemuMonitorTestNewFromFileFull(data->file_json_monitor, - &driver, data->vm, qmpschema))) + &driver, data->vm, params->schema))) goto error; - if (fail) + if (params->fail) qemuMonitorTestAllowUnusedCommands(data->mon); if (!data->modern) @@ -561,17 +569,6 @@ testQemuHotplugCpuFinalize(struct testQemuHotplugCpuData *data) } -struct testQemuHotplugCpuParams { - const char *test; - int newcpus; - const char *cpumap; - bool state; - bool modern; - bool fail; - GHashTable *schema; -}; - - static int testQemuHotplugCpuGroup(const void *opaque) { @@ -580,8 +577,7 @@ testQemuHotplugCpuGroup(const void *opaque) int ret = -1; int rc; - if (!(data = testQemuHotplugCpuPrepare(params->test, params->modern, - params->fail, params->schema))) + if (!(data = testQemuHotplugCpuPrepare(params))) return -1; rc = qemuDomainSetVcpusInternal(&driver, data->vm, data->vm->def, @@ -617,8 +613,7 @@ testQemuHotplugCpuIndividual(const void *opaque) int ret = -1; int rc; - if (!(data = testQemuHotplugCpuPrepare(params->test, params->modern, - params->fail, params->schema))) + if (!(data = testQemuHotplugCpuPrepare(params))) return -1; if (virBitmapParse(params->cpumap, &map, 128) < 0) -- 2.39.2

Rather than test with synthetic capabilities which might get outdated reuse testQemuGetRealCaps to fetch latest capabilities and use those. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuhotplugtest.c | 231 +++++++++--------- .../ppc64-modern-bulk-result-conf.xml | 5 +- .../ppc64-modern-bulk-result-live.xml | 5 +- .../ppc64-modern-individual-result-conf.xml | 5 +- .../ppc64-modern-individual-result-live.xml | 5 +- .../x86-modern-bulk-result-conf.xml | 5 +- .../x86-modern-bulk-result-live.xml | 5 +- .../x86-modern-individual-add-result-conf.xml | 5 +- .../x86-modern-individual-add-result-live.xml | 5 +- .../qemuhotplug-base-ccw-live+ccw-virtio.xml | 13 +- ...with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 13 +- ...otplug-base-ccw-live-with-2-ccw-virtio.xml | 13 +- ...-with-ccw-virtio+ccw-virtio-2-explicit.xml | 13 +- ...-ccw-live-with-ccw-virtio+ccw-virtio-2.xml | 13 +- ...uhotplug-base-ccw-live-with-ccw-virtio.xml | 13 +- .../qemuhotplug-base-ccw-live.xml | 13 +- .../qemuhotplug-base-live+cdrom-scsi.xml | 5 +- .../qemuhotplug-base-live+cdrom-usb.xml | 5 +- ...uhotplug-base-live+disk-scsi-multipath.xml | 5 +- ...+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml | 5 +- .../qemuhotplug-base-live+disk-scsi.xml | 5 +- .../qemuhotplug-base-live+disk-usb.xml | 5 +- .../qemuhotplug-base-live+disk-virtio.xml | 5 +- .../qemuhotplug-base-live+guestfwd.xml | 5 +- .../qemuhotplug-base-live+hostdev-pci.xml | 5 +- .../qemuhotplug-base-live+interface-vdpa.xml | 5 +- ...qemuhotplug-base-live+ivshmem-doorbell.xml | 5 +- .../qemuhotplug-base-live+ivshmem-plain.xml | 5 +- .../qemuhotplug-base-live+qemu-agent.xml | 5 +- ...uhotplug-base-live+watchdog-user-alias.xml | 5 +- .../qemuhotplug-base-live+watchdog.xml | 5 +- .../qemuhotplug-base-live.xml | 5 +- ...hotplug-base-with-scsi-controller-live.xml | 5 +- ...thout-scsi-controller-live+disk-scsi-2.xml | 5 +- ...g-console-compat-2-live+console-virtio.xml | 5 +- .../qemuhotplug-console-compat-2-live.xml | 5 +- ...uhotplug-pseries-base-live+hostdev-pci.xml | 5 +- .../qemuhotplug-pseries-base-live.xml | 5 +- 38 files changed, 299 insertions(+), 173 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 186958cd57..9c8407c5ef 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -53,12 +53,22 @@ struct qemuHotplugTestData { bool keep; virDomainObj *vm; bool deviceDeletedEvent; + const char *arch; + GHashTable *capsLatestFiles; + GHashTable *capsCache; + GHashTable *schemaCache; }; static int qemuHotplugCreateObjects(virDomainXMLOption *xmlopt, virDomainObj **vm, - const char *domxml) + const char *domxml, + const char *arch, + GHashTable *capsLatestFiles, + GHashTable *capsCache, + GHashTable *schemaCache, + GHashTable **schema) + { qemuDomainObjPrivate *priv = NULL; const unsigned int parseFlags = 0; @@ -68,28 +78,10 @@ qemuHotplugCreateObjects(virDomainXMLOption *xmlopt, priv = (*vm)->privateData; - priv->qemuCaps = virQEMUCapsNew(); - - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SCSI_LSI); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_SCSI); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM_PLAIN); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SCSI_DISK_WWN); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_QXL); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_VGA); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_PIIX_DISABLE_S3); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_PIIX_DISABLE_S4); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VNC); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SPICE); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SCSI_BLOCK); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_KBD); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_NETDEV_VHOST_VDPA); - virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SET_ACTION); + if (!(priv->qemuCaps = testQemuGetRealCaps(arch, "latest", "", + capsLatestFiles, capsCache, + schemaCache, schema))) + return -1; if (qemuTestCapsCacheInsert(driver.qemuCapsCache, priv->qemuCaps) < 0) return -1; @@ -347,7 +339,10 @@ testQemuHotplug(const void *data) goto cleanup; } } else { - if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_xml) < 0) + if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_xml, + test->arch, test->capsLatestFiles, + test->capsCache, test->schemaCache, + NULL) < 0) goto cleanup; } @@ -478,7 +473,10 @@ struct testQemuHotplugCpuParams { bool state; bool modern; bool fail; - GHashTable *schema; + const char *arch; + GHashTable *capsLatestFiles; + GHashTable *capsCache; + GHashTable *schemaCache; }; @@ -488,6 +486,7 @@ testQemuHotplugCpuPrepare(const struct testQemuHotplugCpuParams *params) qemuDomainObjPrivate *priv = NULL; g_autofree char *prefix = NULL; struct testQemuHotplugCpuData *data = NULL; + GHashTable *schema = NULL; prefix = g_strdup_printf("%s/qemuhotplugtestcpus/%s", abs_srcdir, params->test); @@ -503,7 +502,9 @@ testQemuHotplugCpuPrepare(const struct testQemuHotplugCpuParams *params) if (virTestLoadFile(data->file_xml_dom, &data->xml_dom) < 0) goto error; - if (qemuHotplugCreateObjects(driver.xmlopt, &data->vm, data->xml_dom) < 0) + if (qemuHotplugCreateObjects(driver.xmlopt, &data->vm, data->xml_dom, + params->arch, params->capsLatestFiles, + params->capsCache, params->schemaCache, &schema) < 0) goto error; /* create vm->newDef */ @@ -517,7 +518,7 @@ testQemuHotplugCpuPrepare(const struct testQemuHotplugCpuParams *params) virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); if (!(data->mon = qemuMonitorTestNewFromFileFull(data->file_json_monitor, - &driver, data->vm, params->schema))) + &driver, data->vm, schema))) goto error; if (params->fail) @@ -645,11 +646,17 @@ testQemuHotplugCpuIndividual(const void *opaque) static int mymain(void) { - g_autoptr(GHashTable) qmpschema = NULL; int ret = 0; - struct qemuHotplugTestData data = {0}; - struct testQemuHotplugCpuParams cpudata; g_autoptr(virQEMUDriverConfig) cfg = NULL; + g_autoptr(GHashTable) capsLatestFiles = testQemuGetLatestCaps(); + g_autoptr(GHashTable) capsCache = virHashNew(virObjectUnref); + g_autoptr(GHashTable) schemaCache = virHashNew((GDestroyNotify) g_hash_table_unref); + struct qemuHotplugTestData data = { .capsLatestFiles = capsLatestFiles, + .capsCache = capsCache, + .schemaCache = schemaCache }; + struct testQemuHotplugCpuParams cpudata = { .capsLatestFiles = capsLatestFiles, + .capsCache = capsCache, + .schemaCache = schemaCache }; if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; @@ -661,13 +668,6 @@ mymain(void) if (!(driver.domainEventState = virObjectEventStateNew())) return EXIT_FAILURE; - if (!(qmpschema = testQEMUSchemaLoadLatest("x86_64"))) { - VIR_TEST_VERBOSE("failed to load qapi schema\n"); - return EXIT_FAILURE; - } - - cpudata.schema = qmpschema; - driver.lockManager = virLockManagerPluginNew("nop", "qemu", driver.config->configBaseDir, 0); @@ -682,10 +682,11 @@ mymain(void) } -#define DO_TEST(file, ACTION, dev, fail_, keep_, ...) \ +#define DO_TEST(archname, file, ACTION, dev, fail_, keep_, ...) \ do { \ const char *my_mon[] = { __VA_ARGS__, NULL}; \ const char *name = file " " #ACTION " " dev; \ + data.arch = archname; \ data.action = ACTION; \ data.domain_filename = file; \ data.device_filename = dev; \ @@ -696,14 +697,14 @@ mymain(void) ret = -1; \ } while (0) -#define DO_TEST_ATTACH(file, dev, fail, keep, ...) \ - DO_TEST(file, ATTACH, dev, fail, keep, __VA_ARGS__) +#define DO_TEST_ATTACH(arch, file, dev, fail, keep, ...) \ + DO_TEST(arch, file, ATTACH, dev, fail, keep, __VA_ARGS__) -#define DO_TEST_DETACH(file, dev, fail, keep, ...) \ - DO_TEST(file, DETACH, dev, fail, keep, __VA_ARGS__) +#define DO_TEST_DETACH(arch, file, dev, fail, keep, ...) \ + DO_TEST(arch, file, DETACH, dev, fail, keep, __VA_ARGS__) -#define DO_TEST_UPDATE(file, dev, fail, keep, ...) \ - DO_TEST(file, UPDATE, dev, fail, keep, __VA_ARGS__) +#define DO_TEST_UPDATE(arch, file, dev, fail, keep, ...) \ + DO_TEST(arch, file, UPDATE, dev, fail, keep, __VA_ARGS__) #define QMP_OK "{\"return\": {}}" @@ -722,60 +723,60 @@ mymain(void) "}\r\n" cfg->spiceTLS = true; - DO_TEST_UPDATE("graphics-spice", "graphics-spice-nochange", false, false, NULL); - DO_TEST_UPDATE("graphics-spice-timeout", "graphics-spice-timeout-nochange", false, false, + DO_TEST_UPDATE("x86_64", "graphics-spice", "graphics-spice-nochange", false, false, NULL); + DO_TEST_UPDATE("x86_64", "graphics-spice-timeout", "graphics-spice-timeout-nochange", false, false, "set_password", QMP_OK, "expire_password", QMP_OK); - DO_TEST_UPDATE("graphics-spice-timeout", "graphics-spice-timeout-password", false, false, + DO_TEST_UPDATE("x86_64", "graphics-spice-timeout", "graphics-spice-timeout-password", false, false, "set_password", QMP_OK, "expire_password", QMP_OK); - DO_TEST_UPDATE("graphics-spice", "graphics-spice-listen", true, false, NULL); - DO_TEST_UPDATE("graphics-spice-listen-network", "graphics-spice-listen-network-password", false, false, + DO_TEST_UPDATE("x86_64", "graphics-spice", "graphics-spice-listen", true, false, NULL); + DO_TEST_UPDATE("x86_64", "graphics-spice-listen-network", "graphics-spice-listen-network-password", false, false, "set_password", QMP_OK, "expire_password", QMP_OK); cfg->spiceTLS = false; /* Strange huh? Currently, only graphics can be updated :-P */ - DO_TEST_UPDATE("disk-cdrom", "disk-cdrom-nochange", true, false, NULL); + DO_TEST_UPDATE("x86_64", "disk-cdrom", "disk-cdrom-nochange", true, false, NULL); - DO_TEST_ATTACH("console-compat-2-live", "console-virtio", false, true, + DO_TEST_ATTACH("x86_64", "console-compat-2-live", "console-virtio", false, true, "chardev-add", "{\"return\": {\"pty\": \"/dev/pts/26\"}}", "device_add", QMP_OK); - DO_TEST_DETACH("console-compat-2-live", "console-virtio", false, false, + DO_TEST_DETACH("x86_64", "console-compat-2-live", "console-virtio", false, false, "device_del", QMP_DEVICE_DELETED("console1") QMP_OK, "chardev-remove", QMP_OK, "query-fdsets", "{\"return\": []}"); - DO_TEST_ATTACH("base-live", "disk-virtio", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "disk-virtio", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "disk-virtio", true, true, + DO_TEST_DETACH("x86_64", "base-live", "disk-virtio", true, true, "device_del", QMP_OK); - DO_TEST_DETACH("base-live", "disk-virtio", false, false, + DO_TEST_DETACH("x86_64", "base-live", "disk-virtio", false, false, "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); - DO_TEST_ATTACH("base-live", "disk-usb", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "disk-usb", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "disk-usb", true, true, + DO_TEST_DETACH("x86_64", "base-live", "disk-usb", true, true, "device_del", QMP_OK); - DO_TEST_DETACH("base-live", "disk-usb", false, false, + DO_TEST_DETACH("x86_64", "base-live", "disk-usb", false, false, "device_del", QMP_DEVICE_DELETED("usb-disk16") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); - DO_TEST_ATTACH("base-live", "disk-scsi", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "disk-scsi", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "disk-scsi", true, true, + DO_TEST_DETACH("x86_64", "base-live", "disk-scsi", true, true, "device_del", QMP_OK); - DO_TEST_DETACH("base-live", "disk-scsi", false, false, + DO_TEST_DETACH("x86_64", "base-live", "disk-scsi", false, false, "device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); - DO_TEST_ATTACH("base-without-scsi-controller-live", "disk-scsi-2", false, true, + DO_TEST_ATTACH("x86_64", "base-without-scsi-controller-live", "disk-scsi-2", false, true, /* Four controllers added */ "device_add", QMP_OK, "device_add", QMP_OK, @@ -784,109 +785,109 @@ mymain(void) "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", true, true, + DO_TEST_DETACH("x86_64", "base-with-scsi-controller-live", "disk-scsi-2", true, true, "device_del", QMP_OK); - DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", false, false, + DO_TEST_DETACH("x86_64", "base-with-scsi-controller-live", "disk-scsi-2", false, false, "device_del", QMP_DEVICE_DELETED("scsi3-0-6") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); - DO_TEST_ATTACH("base-live", "disk-scsi-multipath", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "disk-scsi-multipath", false, true, "object-add", QMP_OK, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "disk-scsi-multipath", true, true, + DO_TEST_DETACH("x86_64", "base-live", "disk-scsi-multipath", true, true, "device_del", QMP_OK); - DO_TEST_DETACH("base-live", "disk-scsi-multipath", false, false, + DO_TEST_DETACH("x86_64", "base-live", "disk-scsi-multipath", false, false, "device_del", QMP_DEVICE_DELETED("scsi0-0-0-0") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK, "object-del", QMP_OK); - DO_TEST_ATTACH("base-live", "qemu-agent", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "qemu-agent", false, true, "getfd", QMP_OK, "chardev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "qemu-agent-detach", false, false, + DO_TEST_DETACH("x86_64", "base-live", "qemu-agent-detach", false, false, "device_del", QMP_DEVICE_DELETED("channel0") QMP_OK, "chardev-remove", QMP_OK, "query-fdsets", "{\"return\": []}"); - DO_TEST_ATTACH("base-ccw-live", "ccw-virtio", false, true, + DO_TEST_ATTACH("s390x", "base-ccw-live", "ccw-virtio", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-ccw-live", "ccw-virtio", false, false, + DO_TEST_DETACH("s390x", "base-ccw-live", "ccw-virtio", false, false, "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); - DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, true, + DO_TEST_ATTACH("s390x", "base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, false, + DO_TEST_DETACH("s390x", "base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, false, "device_del", QMP_DEVICE_DELETED("virtio-disk0") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); - DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true, + DO_TEST_ATTACH("s390x", "base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, false, + DO_TEST_DETACH("s390x", "base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, false, "device_del", QMP_DEVICE_DELETED("virtio-disk0") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); /* Attach a second device, then detach the first one. Then attach the first one again. */ - DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true, + DO_TEST_ATTACH("s390x", "base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-explicit", false, true, + DO_TEST_DETACH("s390x", "base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-explicit", false, true, "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK); - DO_TEST_ATTACH("base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-reverse", false, false, + DO_TEST_ATTACH("s390x", "base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-reverse", false, false, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_ATTACH("base-live", "ivshmem-plain", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "ivshmem-plain", false, true, "object-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_ATTACH("base-live", "ivshmem-doorbell", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "ivshmem-doorbell", false, true, "chardev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live+ivshmem-plain", "ivshmem-doorbell-detach", false, true, + DO_TEST_DETACH("x86_64", "base-live+ivshmem-plain", "ivshmem-doorbell-detach", false, true, "device_del", QMP_DEVICE_DELETED("shmem1") QMP_OK, "chardev-remove", QMP_OK); - DO_TEST_DETACH("base-live", "ivshmem-plain-detach", false, false, + DO_TEST_DETACH("x86_64", "base-live", "ivshmem-plain-detach", false, false, "device_del", QMP_DEVICE_DELETED("shmem0") QMP_OK, "object-del", QMP_OK); - DO_TEST_ATTACH("base-live+disk-scsi-wwn", + DO_TEST_ATTACH("x86_64", "base-live+disk-scsi-wwn", "disk-scsi-duplicate-wwn", false, false, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_ATTACH("base-live", "hostdev-pci", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "hostdev-pci", false, true, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "hostdev-pci", false, false, + DO_TEST_DETACH("x86_64", "base-live", "hostdev-pci", false, false, "device_del", QMP_DEVICE_DELETED("hostdev0") QMP_OK); - DO_TEST_ATTACH("pseries-base-live", "hostdev-pci", false, true, + DO_TEST_ATTACH("ppc64", "pseries-base-live", "hostdev-pci", false, true, "device_add", QMP_OK); - DO_TEST_DETACH("pseries-base-live", "hostdev-pci", false, false, + DO_TEST_DETACH("ppc64", "pseries-base-live", "hostdev-pci", false, false, "device_del", QMP_DEVICE_DELETED("hostdev0") QMP_OK); - DO_TEST_ATTACH("base-live", "interface-vdpa", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "interface-vdpa", false, true, "query-fdsets", "{\"return\":[{\"fdset-id\":99999}]}", "add-fd", "{ \"return\": { \"fdset-id\": 1, \"fd\": 95 }}", "netdev_add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "interface-vdpa", false, false, + DO_TEST_DETACH("x86_64", "base-live", "interface-vdpa", false, false, "device_del", QMP_DEVICE_DELETED("net0") QMP_OK, "netdev_del", QMP_OK, "query-fdsets", @@ -894,50 +895,51 @@ mymain(void) "remove-fd", QMP_OK ); - DO_TEST_ATTACH("base-live", "watchdog", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "watchdog", false, true, "set-action", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "watchdog-full", false, false, + DO_TEST_DETACH("x86_64", "base-live", "watchdog-full", false, false, "device_del", QMP_DEVICE_DELETED("watchdog0") QMP_OK); - DO_TEST_ATTACH("base-live", "watchdog-user-alias", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "watchdog-user-alias", false, true, "set-action", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "watchdog-user-alias-full", false, false, + DO_TEST_DETACH("x86_64", "base-live", "watchdog-user-alias-full", false, false, "device_del", QMP_DEVICE_DELETED("ua-UserWatchdog") QMP_OK); - DO_TEST_ATTACH("base-live", "guestfwd", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "guestfwd", false, true, "getfd", QMP_OK, "chardev-add", QMP_OK, "netdev_add", QMP_OK); - DO_TEST_DETACH("base-live", "guestfwd", false, false, + DO_TEST_DETACH("x86_64", "base-live", "guestfwd", false, false, "netdev_del", QMP_OK); - DO_TEST_ATTACH("base-live", "cdrom-usb", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "cdrom-usb", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "cdrom-usb", true, true, + DO_TEST_DETACH("x86_64", "base-live", "cdrom-usb", true, true, "device_del", QMP_OK); - DO_TEST_DETACH("base-live", "cdrom-usb", false, false, + DO_TEST_DETACH("x86_64", "base-live", "cdrom-usb", false, false, "device_del", QMP_DEVICE_DELETED("usb-disk4") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); - DO_TEST_ATTACH("base-live", "cdrom-scsi", false, true, + DO_TEST_ATTACH("x86_64", "base-live", "cdrom-scsi", false, true, "blockdev-add", QMP_OK, "blockdev-add", QMP_OK, "device_add", QMP_OK); - DO_TEST_DETACH("base-live", "cdrom-scsi", true, true, + DO_TEST_DETACH("x86_64", "base-live", "cdrom-scsi", true, true, "device_del", QMP_OK); - DO_TEST_DETACH("base-live", "cdrom-scsi", false, false, + DO_TEST_DETACH("x86_64", "base-live", "cdrom-scsi", false, false, "device_del", QMP_DEVICE_DELETED("scsi0-0-0-4") QMP_OK, "blockdev-del", QMP_OK, "blockdev-del", QMP_OK); -#define DO_TEST_CPU_GROUP(prefix, vcpus, modernhp, expectfail) \ +#define DO_TEST_CPU_GROUP(archname, prefix, vcpus, modernhp, expectfail) \ do { \ cpudata.test = prefix; \ + cpudata.arch = archname; \ cpudata.newcpus = vcpus; \ cpudata.modern = modernhp; \ cpudata.fail = expectfail; \ @@ -946,15 +948,16 @@ mymain(void) ret = -1; \ } while (0) - DO_TEST_CPU_GROUP("x86-modern-bulk", 7, true, false); - DO_TEST_CPU_GROUP("ppc64-modern-bulk", 24, true, false); - DO_TEST_CPU_GROUP("ppc64-modern-bulk", 15, true, true); - DO_TEST_CPU_GROUP("ppc64-modern-bulk", 23, true, true); - DO_TEST_CPU_GROUP("ppc64-modern-bulk", 25, true, true); + DO_TEST_CPU_GROUP("x86_64", "x86-modern-bulk", 7, true, false); + DO_TEST_CPU_GROUP("ppc64", "ppc64-modern-bulk", 24, true, false); + DO_TEST_CPU_GROUP("ppc64", "ppc64-modern-bulk", 15, true, true); + DO_TEST_CPU_GROUP("ppc64", "ppc64-modern-bulk", 23, true, true); + DO_TEST_CPU_GROUP("ppc64", "ppc64-modern-bulk", 25, true, true); -#define DO_TEST_CPU_INDIVIDUAL(prefix, mapstr, statefl, modernhp, expectfail) \ +#define DO_TEST_CPU_INDIVIDUAL(archname, prefix, mapstr, statefl, modernhp, expectfail) \ do { \ cpudata.test = prefix; \ + cpudata.arch = archname; \ cpudata.cpumap = mapstr; \ cpudata.state = statefl; \ cpudata.modern = modernhp; \ @@ -964,13 +967,13 @@ mymain(void) ret = -1; \ } while (0) - DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", true, true, false); - DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "6,7", true, true, true); - DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", false, true, true); + DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "7", true, true, false); + DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "6,7", true, true, true); + DO_TEST_CPU_INDIVIDUAL("x86_64", "x86-modern-individual-add", "7", false, true, true); - DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "16-23", true, true, false); - DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "16-22", true, true, true); - DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "17", true, true, true); + DO_TEST_CPU_INDIVIDUAL("ppc64", "ppc64-modern-individual", "16-23", true, true, false); + DO_TEST_CPU_INDIVIDUAL("ppc64", "ppc64-modern-individual", "16-22", true, true, true); + DO_TEST_CPU_INDIVIDUAL("ppc64", "ppc64-modern-individual", "17", true, true, true); qemuTestDriverFree(&driver); virObjectUnref(data.vm); diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml index a7ada18bf3..afb2c85bc2 100644 --- a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml +++ b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml @@ -42,7 +42,8 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='network'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> <topology sockets='1' dies='1' cores='4' threads='8'/> </cpu> <clock offset='utc'/> @@ -51,7 +52,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <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'/> diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml index 3932fd9b55..d86247d70c 100644 --- a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml +++ b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml @@ -42,7 +42,8 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='network'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> <topology sockets='1' dies='1' cores='4' threads='8'/> </cpu> <clock offset='utc'/> @@ -51,7 +52,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml index f3a1efeede..e8d30f7ddd 100644 --- a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml @@ -42,7 +42,8 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='network'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> <topology sockets='1' dies='1' cores='4' threads='8'/> </cpu> <clock offset='utc'/> @@ -51,7 +52,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <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'/> diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml index 6d64ead3d0..afc500657c 100644 --- a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml @@ -42,7 +42,8 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='network'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> <topology sockets='1' dies='1' cores='4' threads='8'/> </cpu> <clock offset='utc'/> @@ -51,7 +52,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml index 87eb19ebd8..8d52ffedb4 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml +++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml @@ -18,7 +18,8 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='network'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> <topology sockets='4' dies='1' cores='2' threads='1'/> </cpu> <clock offset='utc'/> @@ -27,7 +28,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <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'/> diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml index 251634e266..f416397e33 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml +++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml @@ -18,7 +18,8 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='network'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> <topology sockets='4' dies='1' cores='2' threads='1'/> </cpu> <clock offset='utc'/> @@ -27,7 +28,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml index 140892aaf8..0bd2af8e43 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml @@ -18,7 +18,8 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='network'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> <topology sockets='4' dies='1' cores='2' threads='1'/> </cpu> <clock offset='utc'/> @@ -27,7 +28,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <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'/> diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml index 45196ba1d1..b31e6ebe55 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml @@ -18,7 +18,8 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='network'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> <topology sockets='4' dies='1' cores='2' threads='1'/> </cpu> <clock offset='utc'/> @@ -27,7 +28,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml index 4036adde89..798a7ab732 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml @@ -13,6 +13,7 @@ <apic/> <pae/> </features> + <cpu mode='host-model' check='partial'/> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -31,18 +32,24 @@ </disk> <controller type='usb' index='0'> <alias name='usb'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'> + <zpci uid='0x0001' fid='0x00000000'/> + </address> </controller> <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'> + <zpci uid='0x0002' fid='0x00000001'/> + </address> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'> + <zpci uid='0x0003' fid='0x00000002'/> + </address> </controller> <audio id='1' type='none'/> <memballoon model='none'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml index 2eb7f9eb0e..5d2769c420 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml @@ -13,6 +13,7 @@ <apic/> <pae/> </features> + <cpu mode='host-model' check='partial'/> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -41,18 +42,24 @@ </disk> <controller type='usb' index='0'> <alias name='usb'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'> + <zpci uid='0x0001' fid='0x00000000'/> + </address> </controller> <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'> + <zpci uid='0x0002' fid='0x00000001'/> + </address> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'> + <zpci uid='0x0003' fid='0x00000002'/> + </address> </controller> <audio id='1' type='none'/> <memballoon model='none'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml index 935925bdba..845c0e1c98 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml @@ -13,6 +13,7 @@ <apic/> <pae/> </features> + <cpu mode='host-model' check='partial'/> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -31,18 +32,24 @@ </disk> <controller type='usb' index='0'> <alias name='usb'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'> + <zpci uid='0x0001' fid='0x00000000'/> + </address> </controller> <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'> + <zpci uid='0x0002' fid='0x00000001'/> + </address> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'> + <zpci uid='0x0003' fid='0x00000002'/> + </address> </controller> <audio id='1' type='none'/> <memballoon model='none'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml index 51fe4b461a..29b8fdd6c8 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml @@ -13,6 +13,7 @@ <apic/> <pae/> </features> + <cpu mode='host-model' check='partial'/> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -40,18 +41,24 @@ </disk> <controller type='usb' index='0'> <alias name='usb'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'> + <zpci uid='0x0001' fid='0x00000000'/> + </address> </controller> <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'> + <zpci uid='0x0002' fid='0x00000001'/> + </address> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'> + <zpci uid='0x0003' fid='0x00000002'/> + </address> </controller> <audio id='1' type='none'/> <memballoon model='none'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml index 51fe4b461a..29b8fdd6c8 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml @@ -13,6 +13,7 @@ <apic/> <pae/> </features> + <cpu mode='host-model' check='partial'/> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -40,18 +41,24 @@ </disk> <controller type='usb' index='0'> <alias name='usb'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'> + <zpci uid='0x0001' fid='0x00000000'/> + </address> </controller> <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'> + <zpci uid='0x0002' fid='0x00000001'/> + </address> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'> + <zpci uid='0x0003' fid='0x00000002'/> + </address> </controller> <audio id='1' type='none'/> <memballoon model='none'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml index adec141512..82402ffe1b 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml @@ -13,6 +13,7 @@ <apic/> <pae/> </features> + <cpu mode='host-model' check='partial'/> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -30,18 +31,24 @@ </disk> <controller type='usb' index='0'> <alias name='usb'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'> + <zpci uid='0x0001' fid='0x00000000'/> + </address> </controller> <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'> + <zpci uid='0x0002' fid='0x00000001'/> + </address> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'> + <zpci uid='0x0003' fid='0x00000002'/> + </address> </controller> <audio id='1' type='none'/> <memballoon model='none'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml index 2267fe39df..6eb60b13a9 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml @@ -13,6 +13,7 @@ <apic/> <pae/> </features> + <cpu mode='host-model' check='partial'/> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -21,18 +22,24 @@ <emulator>/usr/bin/qemu-system-s390x</emulator> <controller type='usb' index='0'> <alias name='usb'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'> + <zpci uid='0x0001' fid='0x00000000'/> + </address> </controller> <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'> + <zpci uid='0x0002' fid='0x00000001'/> + </address> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'> + <zpci uid='0x0003' fid='0x00000002'/> + </address> </controller> <audio id='1' type='none'/> <memballoon model='none'/> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml index 922e9c1b4e..4353191197 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -28,7 +31,7 @@ <alias name='scsi0-0-0-4'/> <address type='drive' controller='0' bus='0' target='0' unit='4'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml index ba8ce3b2c8..d31136dbc8 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -28,7 +31,7 @@ <alias name='usb-disk4'/> <address type='usb' bus='0' port='1'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml index bea59403be..0a0fbc1c95 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -31,7 +34,7 @@ <alias name='scsi0-0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml index b3089b2006..732a27be43 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -41,7 +44,7 @@ <alias name='scsi0-0-0-6'/> <address type='drive' controller='0' bus='0' target='0' unit='6'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml index 4241b3b71a..8bff04a4b6 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -29,7 +32,7 @@ <alias name='scsi0-0-0-5'/> <address type='drive' controller='0' bus='0' target='0' unit='5'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml index 4202ded5b3..5964c23ba0 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -29,7 +32,7 @@ <alias name='usb-disk16'/> <address type='usb' bus='0' port='1'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml index 02851d4ca1..684b3c26de 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -29,7 +32,7 @@ <alias name='virtio-disk4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml index 3bf64326c5..da5e446cf6 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+hostdev-pci.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+hostdev-pci.xml index d8b0c80feb..e49e21c53e 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+hostdev-pci.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+hostdev-pci.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+interface-vdpa.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+interface-vdpa.xml index f80dc42ac5..d1459d5c75 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+interface-vdpa.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+interface-vdpa.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml index b0898a968b..84a1286eb5 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml index db21d2b5ba..ac50d6bdfc 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent.xml index c288b502aa..0e4c3907bf 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog-user-alias.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog-user-alias.xml index f54c7a4599..86c8a8bb26 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog-user-alias.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog-user-alias.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog.xml index bd85c56ce6..11f7987964 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live.xml index a02bc39663..82dfef6dd0 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml index 939cea4cbe..29e4008070 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml index 97f651374d..6044179cbb 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -29,7 +32,7 @@ <alias name='scsi3-0-6'/> <address type='drive' controller='3' bus='0' target='0' unit='6'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+console-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+console-virtio.xml index 72516555a0..24d061ea7b 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+console-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+console-virtio.xml @@ -16,6 +16,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -45,7 +48,7 @@ <alias name='ide'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml index 6197a2bfe3..1665a9e3ea 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml @@ -16,6 +16,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -45,7 +48,7 @@ <alias name='ide'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live+hostdev-pci.xml b/tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live+hostdev-pci.xml index 6a60a388a9..13d10e57aa 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live+hostdev-pci.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live+hostdev-pci.xml @@ -8,6 +8,9 @@ <type arch='ppc64' machine='pseries'>hvm</type> <boot dev='hd'/> </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>POWER9</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -24,7 +27,7 @@ <target index='1'/> <alias name='pci.1'/> </controller> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='pci-ohci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live.xml index e9b89a7acc..f31ae0013e 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live.xml @@ -8,6 +8,9 @@ <type arch='ppc64' machine='pseries'>hvm</type> <boot dev='hd'/> </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>POWER9</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -24,7 +27,7 @@ <target index='1'/> <alias name='pci.1'/> </controller> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='pci-ohci'> <alias name='usb'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </controller> -- 2.39.2

qemuhotplugtest validates only that a given command is used but not the arguments of the command. With this patch we'll validate the arguments against the QMP schema thus we can catch possible issues with deprecated commands. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuhotplugtest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 9c8407c5ef..63a6833cfd 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -57,6 +57,7 @@ struct qemuHotplugTestData { GHashTable *capsLatestFiles; GHashTable *capsCache; GHashTable *schemaCache; + GHashTable *schema; }; static int @@ -342,7 +343,7 @@ testQemuHotplug(const void *data) if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_xml, test->arch, test->capsLatestFiles, test->capsCache, test->schemaCache, - NULL) < 0) + &test->schema) < 0) goto cleanup; } @@ -356,7 +357,7 @@ testQemuHotplug(const void *data) /* Now is the best time to feed the spoofed monitor with predefined * replies. */ - if (!(test_mon = qemuMonitorTestNew(driver.xmlopt, vm, NULL, NULL))) + if (!(test_mon = qemuMonitorTestNew(driver.xmlopt, vm, NULL, test->schema))) goto cleanup; tmp = test->mon; -- 2.39.2

Switch them to use latest caps. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- ...emory-hotplug-nvdimm-ppc64-abi-update.args | 13 ++++---- ...ry-hotplug-nvdimm-ppc64.ppc64-latest.args} | 13 ++++---- ...emory-hotplug-ppc64-nonuma-abi-update.args | 15 ++++++---- ...ry-hotplug-ppc64-nonuma.ppc64-latest.args} | 15 ++++++---- ...4-usb-controller-legacy.ppc64-latest.args} | 11 ++++--- .../ppc64-usb-controller-qemu-xhci.args | 11 ++++--- ...=> ppc64-usb-controller.ppc64-latest.args} | 11 ++++--- tests/qemuxml2argvtest.c | 30 +++++-------------- 8 files changed, 62 insertions(+), 57 deletions(-) rename tests/qemuxml2argvdata/{memory-hotplug-nvdimm-ppc64.args => memory-hotplug-nvdimm-ppc64.ppc64-latest.args} (55%) rename tests/qemuxml2argvdata/{memory-hotplug-ppc64-nonuma.args => memory-hotplug-ppc64-nonuma.ppc64-latest.args} (54%) rename tests/qemuxml2argvdata/{ppc64-usb-controller-legacy.args => ppc64-usb-controller-legacy.ppc64-latest.args} (58%) rename tests/qemuxml2argvdata/{ppc64-usb-controller.args => ppc64-usb-controller.ppc64-latest.args} (58%) diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args index 5a98a8c586..9b57518fca 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args @@ -9,13 +9,15 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ /usr/bin/qemu-system-ppc64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ -machine pseries,usb=off,dump-guest-core=off,nvdimm=on \ -accel tcg \ +-cpu POWER9 \ -m size=1048576k,slots=16,maxmem=1099511627776k \ -overcommit mem-lock=off \ --smp 2,sockets=2,cores=1,threads=1 \ --numa node,nodeid=0,cpus=0-1,mem=1024 \ +-smp 2,sockets=2,dies=1,cores=1,threads=1 \ +-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824}' \ +-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ @@ -25,7 +27,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,prealloc=on,size=537001984 \ --device nvdimm,node=0,label-size=131072,uuid=49545eb3-75e1-2d0a-acdd-f0294406c99e,memdev=memnvdimm0,id=nvdimm0,slot=0 \ +-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","prealloc":true,"size":537001984}' \ +-device '{"driver":"nvdimm","node":0,"label-size":131072,"uuid":"49545eb3-75e1-2d0a-acdd-f0294406c99e","memdev":"memnvdimm0","id":"nvdimm0","slot":0}' \ -audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args similarity index 55% rename from tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.args rename to tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args index 5a98a8c586..9b57518fca 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args @@ -9,13 +9,15 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ /usr/bin/qemu-system-ppc64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ -machine pseries,usb=off,dump-guest-core=off,nvdimm=on \ -accel tcg \ +-cpu POWER9 \ -m size=1048576k,slots=16,maxmem=1099511627776k \ -overcommit mem-lock=off \ --smp 2,sockets=2,cores=1,threads=1 \ --numa node,nodeid=0,cpus=0-1,mem=1024 \ +-smp 2,sockets=2,dies=1,cores=1,threads=1 \ +-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824}' \ +-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ @@ -25,7 +27,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,prealloc=on,size=537001984 \ --device nvdimm,node=0,label-size=131072,uuid=49545eb3-75e1-2d0a-acdd-f0294406c99e,memdev=memnvdimm0,id=nvdimm0,slot=0 \ +-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","prealloc":true,"size":537001984}' \ +-device '{"driver":"nvdimm","node":0,"label-size":131072,"uuid":"49545eb3-75e1-2d0a-acdd-f0294406c99e","memdev":"memnvdimm0","id":"nvdimm0","slot":0}' \ -audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args index f878de8a91..83bfb1123c 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args +++ b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args @@ -9,10 +9,12 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ /usr/bin/qemu-system-ppc64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \ --machine pseries,usb=off,dump-guest-core=off \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pseries,usb=off,dump-guest-core=off,memory-backend=ppc_spapr.ram \ -accel kvm \ +-cpu POWER9 \ -m size=1048576k,slots=16,maxmem=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":1073741824}' \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid 49545eb3-75e1-2d0a-acdd-f0294406c99e \ @@ -24,9 +26,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --object memory-backend-ram,id=memdimm0,size=536870912 \ --device pc-dimm,memdev=memdimm0,id=dimm0,slot=0 \ --object memory-backend-ram,id=memdimm1,size=536870912 \ --device pc-dimm,memdev=memdimm1,id=dimm1,slot=1 \ +-object '{"qom-type":"memory-backend-ram","id":"memdimm0","size":536870912}' \ +-device '{"driver":"pc-dimm","memdev":"memdimm0","id":"dimm0","slot":0}' \ +-object '{"qom-type":"memory-backend-ram","id":"memdimm1","size":536870912}' \ +-device '{"driver":"pc-dimm","memdev":"memdimm1","id":"dimm1","slot":1}' \ -audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.args b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.ppc64-latest.args similarity index 54% rename from tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.args rename to tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.ppc64-latest.args index 035377eaf1..6c84ef3b01 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.args +++ b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.ppc64-latest.args @@ -9,10 +9,12 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ /usr/bin/qemu-system-ppc64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \ --machine pseries,usb=off,dump-guest-core=off \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pseries,usb=off,dump-guest-core=off,memory-backend=ppc_spapr.ram \ -accel kvm \ +-cpu POWER9 \ -m size=1310720k,slots=16,maxmem=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":1342177280}' \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid 49545eb3-75e1-2d0a-acdd-f0294406c99e \ @@ -24,9 +26,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --object memory-backend-ram,id=memdimm0,size=536870912 \ --device pc-dimm,memdev=memdimm0,id=dimm0,slot=0 \ --object memory-backend-ram,id=memdimm1,size=536870912 \ --device pc-dimm,memdev=memdimm1,id=dimm1,slot=1 \ +-object '{"qom-type":"memory-backend-ram","id":"memdimm0","size":536870912}' \ +-device '{"driver":"pc-dimm","memdev":"memdimm0","id":"dimm0","slot":0}' \ +-object '{"qom-type":"memory-backend-ram","id":"memdimm1","size":536870912}' \ +-device '{"driver":"pc-dimm","memdev":"memdimm1","id":"dimm1","slot":1}' \ -audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/ppc64-usb-controller-legacy.args b/tests/qemuxml2argvdata/ppc64-usb-controller-legacy.ppc64-latest.args similarity index 58% rename from tests/qemuxml2argvdata/ppc64-usb-controller-legacy.args rename to tests/qemuxml2argvdata/ppc64-usb-controller-legacy.ppc64-latest.args index f8e0315fcc..1ce5bd8b71 100644 --- a/tests/qemuxml2argvdata/ppc64-usb-controller-legacy.args +++ b/tests/qemuxml2argvdata/ppc64-usb-controller-legacy.ppc64-latest.args @@ -9,10 +9,12 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ /usr/bin/qemu-system-ppc64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \ --machine pseries,usb=off,dump-guest-core=off \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pseries,usb=off,dump-guest-core=off,memory-backend=ppc_spapr.ram \ -accel tcg \ +-cpu POWER9 \ -m 256 \ +-object '{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":268435456}' \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ @@ -24,7 +26,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --usb \ +-device '{"driver":"pci-ohci","id":"usb","bus":"pci.0","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x6"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.args b/tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.args index 607c2f1180..7e5dd0925c 100644 --- a/tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.args +++ b/tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.args @@ -9,10 +9,12 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ /usr/bin/qemu-system-ppc64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \ --machine pseries,usb=off,dump-guest-core=off \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pseries,usb=off,dump-guest-core=off,memory-backend=ppc_spapr.ram \ -accel tcg \ +-cpu POWER9 \ -m 256 \ +-object '{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":268435456}' \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ @@ -24,7 +26,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --device qemu-xhci,id=usb,bus=pci.0,addr=0x1 \ +-device '{"driver":"qemu-xhci","id":"usb","bus":"pci.0","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x6"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/ppc64-usb-controller.args b/tests/qemuxml2argvdata/ppc64-usb-controller.ppc64-latest.args similarity index 58% rename from tests/qemuxml2argvdata/ppc64-usb-controller.args rename to tests/qemuxml2argvdata/ppc64-usb-controller.ppc64-latest.args index 383058e767..1ce5bd8b71 100644 --- a/tests/qemuxml2argvdata/ppc64-usb-controller.args +++ b/tests/qemuxml2argvdata/ppc64-usb-controller.ppc64-latest.args @@ -9,10 +9,12 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ /usr/bin/qemu-system-ppc64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \ --machine pseries,usb=off,dump-guest-core=off \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pseries,usb=off,dump-guest-core=off,memory-backend=ppc_spapr.ram \ -accel tcg \ +-cpu POWER9 \ -m 256 \ +-object '{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":268435456}' \ -overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ @@ -24,7 +26,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --device pci-ohci,id=usb,bus=pci.0,addr=0x1 \ +-device '{"driver":"pci-ohci","id":"usb","bus":"pci.0","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x6"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e0d237bb2d..a765de304d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2541,14 +2541,10 @@ mymain(void) DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM); DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM); DO_TEST_CAPS_LATEST("memory-hotplug-dimm-addr"); - DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); + DO_TEST_CAPS_ARCH_LATEST("memory-hotplug-ppc64-nonuma", "ppc64"); DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", "", ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, - ARG_QEMU_CAPS, - QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_LAST, + ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest", ARG_END); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm"); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-access"); @@ -2560,14 +2556,10 @@ mymain(void) DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-pmem"); DO_TEST_CAPS_VER("memory-hotplug-nvdimm-readonly", "5.2.0"); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-readonly"); - DO_TEST("memory-hotplug-nvdimm-ppc64", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST_CAPS_ARCH_LATEST("memory-hotplug-nvdimm-ppc64", "ppc64"); DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", "", ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, - ARG_QEMU_CAPS, - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_DEVICE_NVDIMM, - QEMU_CAPS_LAST, + ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest", ARG_END); DO_TEST_CAPS_VER("memory-hotplug-virtio-pmem", "5.2.0"); DO_TEST_CAPS_LATEST("memory-hotplug-virtio-pmem"); @@ -2622,19 +2614,11 @@ mymain(void) DO_TEST_CAPS_LATEST("input-linux"); - DO_TEST("ppc64-usb-controller", - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_PCI_OHCI); - DO_TEST("ppc64-usb-controller-legacy", - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_PIIX3_USB_UHCI); + DO_TEST_CAPS_ARCH_LATEST("ppc64-usb-controller", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST("ppc64-usb-controller-legacy", "ppc64"); DO_TEST_FULL("ppc64-usb-controller-qemu-xhci", "", ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, - ARG_QEMU_CAPS, - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_NEC_USB_XHCI, - QEMU_CAPS_DEVICE_QEMU_XHCI, - QEMU_CAPS_LAST, + ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest", ARG_END); DO_TEST_PARSE_ERROR("ppc64-tpmproxy-double", -- 2.39.2

Switch them to use latest caps. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- ...memory-hotplug-nvdimm-ppc64-abi-update.xml | 3 +- ...ory-hotplug-nvdimm-ppc64.ppc64-latest.xml} | 3 +- ...memory-hotplug-ppc64-nonuma-abi-update.xml | 3 ++ ...mory-hotplug-ppc64-nonuma.ppc64-latest.xml | 42 +++++++++++++++++++ .../memory-hotplug-ppc64-nonuma.xml | 1 - ...64-usb-controller-legacy.ppc64-latest.xml} | 3 ++ ... => ppc64-usb-controller.ppc64-latest.xml} | 5 ++- tests/qemuxml2xmltest.c | 24 +++-------- 8 files changed, 62 insertions(+), 22 deletions(-) rename tests/qemuxml2xmloutdata/{memory-hotplug-nvdimm-ppc64.xml => memory-hotplug-nvdimm-ppc64.ppc64-latest.xml} (93%) create mode 100644 tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.ppc64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.xml rename tests/qemuxml2xmloutdata/{ppc64-usb-controller.xml => ppc64-usb-controller-legacy.ppc64-latest.xml} (91%) rename tests/qemuxml2xmloutdata/{ppc64-usb-controller-legacy.xml => ppc64-usb-controller.ppc64-latest.xml} (86%) diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.xml index 4c9a15da6f..ae157c4849 100644 --- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.xml +++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.xml @@ -9,7 +9,8 @@ <type arch='ppc64' machine='pseries'>hvm</type> <boot dev='hd'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>POWER9</model> <topology sockets='2' dies='1' cores='1' threads='1'/> <numa> <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/> diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml similarity index 93% rename from tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml rename to tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml index c15db20dad..3c1cbc731d 100644 --- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml +++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml @@ -9,7 +9,8 @@ <type arch='ppc64' machine='pseries'>hvm</type> <boot dev='hd'/> </os> - <cpu> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>POWER9</model> <topology sockets='2' dies='1' cores='1' threads='1'/> <numa> <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/> diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.xml b/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.xml index 0590940233..d0be98f140 100644 --- a/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.xml +++ b/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.xml @@ -9,6 +9,9 @@ <type arch='ppc64' machine='pseries'>hvm</type> <boot dev='hd'/> </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>POWER9</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.ppc64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.ppc64-latest.xml new file mode 100644 index 0000000000..436a8d1895 --- /dev/null +++ b/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.ppc64-latest.xml @@ -0,0 +1,42 @@ +<domain type='kvm'> + <name>QEMUGuest1</name> + <uuid>49545eb3-75e1-2d0a-acdd-f0294406c99e</uuid> + <maxMemory slots='16' unit='KiB'>4194304</maxMemory> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>2097152</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + <boot dev='hd'/> + </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>POWER9</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='usb' index='0' model='none'/> + <controller type='pci' index='0' model='pci-root'> + <model name='spapr-pci-host-bridge'/> + <target index='0'/> + </controller> + <audio id='1' type='none'/> + <memballoon model='none'/> + <panic model='pseries'/> + <memory model='dimm'> + <target> + <size unit='KiB'>523264</size> + </target> + <address type='dimm' slot='0'/> + </memory> + <memory model='dimm'> + <target> + <size unit='KiB'>524287</size> + </target> + <address type='dimm' slot='1'/> + </memory> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.xml b/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.xml deleted file mode 120000 index 0822e409b4..0000000000 --- a/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/memory-hotplug-ppc64-nonuma.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/ppc64-usb-controller.xml b/tests/qemuxml2xmloutdata/ppc64-usb-controller-legacy.ppc64-latest.xml similarity index 91% rename from tests/qemuxml2xmloutdata/ppc64-usb-controller.xml rename to tests/qemuxml2xmloutdata/ppc64-usb-controller-legacy.ppc64-latest.xml index ec50384dd1..c25b3918e9 100644 --- a/tests/qemuxml2xmloutdata/ppc64-usb-controller.xml +++ b/tests/qemuxml2xmloutdata/ppc64-usb-controller-legacy.ppc64-latest.xml @@ -13,6 +13,9 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>POWER9</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> diff --git a/tests/qemuxml2xmloutdata/ppc64-usb-controller-legacy.xml b/tests/qemuxml2xmloutdata/ppc64-usb-controller.ppc64-latest.xml similarity index 86% rename from tests/qemuxml2xmloutdata/ppc64-usb-controller-legacy.xml rename to tests/qemuxml2xmloutdata/ppc64-usb-controller.ppc64-latest.xml index 2caf95d961..c25b3918e9 100644 --- a/tests/qemuxml2xmloutdata/ppc64-usb-controller-legacy.xml +++ b/tests/qemuxml2xmloutdata/ppc64-usb-controller.ppc64-latest.xml @@ -13,13 +13,16 @@ <apic/> <pae/> </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>POWER9</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-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/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index dd4e4ba0e5..60ff48550f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -575,12 +575,8 @@ mymain(void) QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_NEC_USB_XHCI); - DO_TEST("ppc64-usb-controller", - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_PCI_OHCI); - DO_TEST("ppc64-usb-controller-legacy", - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_PIIX3_USB_UHCI); + DO_TEST_CAPS_ARCH_LATEST("ppc64-usb-controller", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST("ppc64-usb-controller-legacy", "ppc64"); DO_TEST("usb-port-missing", QEMU_CAPS_USB_HUB); DO_TEST("usb-redir", QEMU_CAPS_USB_REDIR, QEMU_CAPS_SPICE, @@ -1017,14 +1013,10 @@ mymain(void) /* SVE aarch64 CPU features work on modern QEMU */ DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64"); - DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); + DO_TEST_CAPS_ARCH_LATEST("memory-hotplug-ppc64-nonuma", "ppc64"); DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", "", WHEN_BOTH, ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, - ARG_QEMU_CAPS, - QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_LAST, ARG_END); + ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest", ARG_END); DO_TEST_NOCAPS("memory-hotplug"); DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM); DO_TEST_CAPS_LATEST("memory-hotplug-dimm-addr"); @@ -1035,14 +1027,10 @@ mymain(void) DO_TEST("memory-hotplug-nvdimm-pmem", QEMU_CAPS_DEVICE_NVDIMM); DO_TEST("memory-hotplug-nvdimm-readonly", QEMU_CAPS_DEVICE_NVDIMM, QEMU_CAPS_DEVICE_NVDIMM_UNARMED); - DO_TEST("memory-hotplug-nvdimm-ppc64", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST_CAPS_ARCH_LATEST("memory-hotplug-nvdimm-ppc64", "ppc64"); DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", "", WHEN_BOTH, ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, - ARG_QEMU_CAPS, - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_DEVICE_NVDIMM, - QEMU_CAPS_LAST, ARG_END); + ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest", ARG_END); DO_TEST_CAPS_LATEST("memory-hotplug-virtio-pmem"); DO_TEST_CAPS_LATEST("memory-hotplug-virtio-mem"); -- 2.39.2

Add an example case showing that every feature in the 'pseries-features' test works also with the oldest supported qemu version. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- .../pseries-features.ppc64-4.2.0.args | 30 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 2 files changed, 31 insertions(+) create mode 100644 tests/qemuxml2argvdata/pseries-features.ppc64-4.2.0.args diff --git a/tests/qemuxml2argvdata/pseries-features.ppc64-4.2.0.args b/tests/qemuxml2argvdata/pseries-features.ppc64-4.2.0.args new file mode 100644 index 0000000000..7decaba057 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features.ppc64-4.2.0.args @@ -0,0 +1,30 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-ppc64 \ +-name guest=guest,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-guest/master-key.aes \ +-machine pseries-4.2,usb=off,resize-hpt=required,cap-hpt-max-page-size=1048576k,cap-htm=on,cap-nested-hv=off,cap-ccf-assist=on,cap-cfpc=fixed,cap-sbbc=broken,cap-ibs=fixed-ccd,dump-guest-core=off \ +-accel tcg \ +-cpu POWER9 \ +-m 512 \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a765de304d..6560bcfaab 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2001,6 +2001,7 @@ mymain(void) DO_TEST_CAPS_LATEST_PPC64("pseries-hostdevs-2"); DO_TEST_CAPS_LATEST_PPC64("pseries-hostdevs-3"); + DO_TEST_CAPS_ARCH_VER("pseries-features", "ppc64", "4.2.0"); DO_TEST_CAPS_LATEST_PPC64("pseries-features"); /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE */ -- 2.39.2

All of the tested features are always present in the 'pseries' machine with oldest-supported qemu-4.2, thus the tests don't make sense any more. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvdata/pseries-features-ccf.err | 1 - tests/qemuxml2argvdata/pseries-features-ccf.xml | 14 -------------- tests/qemuxml2argvdata/pseries-features-cfpc.err | 1 - tests/qemuxml2argvdata/pseries-features-cfpc.xml | 14 -------------- .../pseries-features-hpt-pagesize.err | 1 - .../pseries-features-hpt-pagesize.xml | 16 ---------------- tests/qemuxml2argvdata/pseries-features-htm.err | 1 - tests/qemuxml2argvdata/pseries-features-htm.xml | 14 -------------- tests/qemuxml2argvdata/pseries-features-ibs.err | 1 - tests/qemuxml2argvdata/pseries-features-ibs.xml | 14 -------------- .../pseries-features-nested-hv.err | 1 - .../pseries-features-nested-hv.xml | 14 -------------- tests/qemuxml2argvdata/pseries-features-sbbc.err | 1 - tests/qemuxml2argvdata/pseries-features-sbbc.xml | 14 -------------- tests/qemuxml2argvtest.c | 15 --------------- 15 files changed, 122 deletions(-) delete mode 100644 tests/qemuxml2argvdata/pseries-features-ccf.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-ccf.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-cfpc.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-cfpc.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-hpt-pagesize.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-htm.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-htm.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-ibs.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-ibs.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-nested-hv.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-nested-hv.xml delete mode 100644 tests/qemuxml2argvdata/pseries-features-sbbc.err delete mode 100644 tests/qemuxml2argvdata/pseries-features-sbbc.xml diff --git a/tests/qemuxml2argvdata/pseries-features-ccf.err b/tests/qemuxml2argvdata/pseries-features-ccf.err deleted file mode 100644 index 83e88253b8..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-ccf.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: ccf-assist configuration is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-features-ccf.xml b/tests/qemuxml2argvdata/pseries-features-ccf.xml deleted file mode 100644 index 037d9feaab..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-ccf.xml +++ /dev/null @@ -1,14 +0,0 @@ -<domain type='qemu'> - <name>guest</name> - <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> - <memory unit='KiB'>524288</memory> - <os> - <type arch='ppc64' machine='pseries'>hvm</type> - </os> - <features> - <ccf-assist state='on'/> - </features> - <devices> - <emulator>/usr/bin/qemu-system-ppc64</emulator> - </devices> -</domain> diff --git a/tests/qemuxml2argvdata/pseries-features-cfpc.err b/tests/qemuxml2argvdata/pseries-features-cfpc.err deleted file mode 100644 index 47938f1a9e..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-cfpc.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: cfpc configuration is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-features-cfpc.xml b/tests/qemuxml2argvdata/pseries-features-cfpc.xml deleted file mode 100644 index 9229e87aab..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-cfpc.xml +++ /dev/null @@ -1,14 +0,0 @@ -<domain type='qemu'> - <name>guest</name> - <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> - <memory unit='KiB'>524288</memory> - <os> - <type arch='ppc64' machine='pseries'>hvm</type> - </os> - <features> - <cfpc value='fixed'/> - </features> - <devices> - <emulator>/usr/bin/qemu-system-ppc64</emulator> - </devices> -</domain> diff --git a/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.err b/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.err deleted file mode 100644 index ea3ad282cd..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: Configuring the page size for HPT guests is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml b/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml deleted file mode 100644 index ba919f6b0d..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-hpt-pagesize.xml +++ /dev/null @@ -1,16 +0,0 @@ -<domain type='qemu'> - <name>guest</name> - <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> - <memory unit='KiB'>524288</memory> - <os> - <type arch='ppc64' machine='pseries'>hvm</type> - </os> - <features> - <hpt resizing='required'> - <maxpagesize unit='GiB'>1</maxpagesize> - </hpt> - </features> - <devices> - <emulator>/usr/bin/qemu-system-ppc64</emulator> - </devices> -</domain> diff --git a/tests/qemuxml2argvdata/pseries-features-htm.err b/tests/qemuxml2argvdata/pseries-features-htm.err deleted file mode 100644 index d0bbcb0d27..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-htm.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: HTM configuration is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-features-htm.xml b/tests/qemuxml2argvdata/pseries-features-htm.xml deleted file mode 100644 index 59ac294161..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-htm.xml +++ /dev/null @@ -1,14 +0,0 @@ -<domain type='qemu'> - <name>guest</name> - <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> - <memory unit='KiB'>524288</memory> - <os> - <type arch='ppc64' machine='pseries'>hvm</type> - </os> - <features> - <htm state='on'/> - </features> - <devices> - <emulator>/usr/bin/qemu-system-ppc64</emulator> - </devices> -</domain> diff --git a/tests/qemuxml2argvdata/pseries-features-ibs.err b/tests/qemuxml2argvdata/pseries-features-ibs.err deleted file mode 100644 index 7b4d125a36..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-ibs.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: ibs configuration is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-features-ibs.xml b/tests/qemuxml2argvdata/pseries-features-ibs.xml deleted file mode 100644 index c3317b47ba..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-ibs.xml +++ /dev/null @@ -1,14 +0,0 @@ -<domain type='qemu'> - <name>guest</name> - <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> - <memory unit='KiB'>524288</memory> - <os> - <type arch='ppc64' machine='pseries'>hvm</type> - </os> - <features> - <ibs value='fixed-ccd'/> - </features> - <devices> - <emulator>/usr/bin/qemu-system-ppc64</emulator> - </devices> -</domain> diff --git a/tests/qemuxml2argvdata/pseries-features-nested-hv.err b/tests/qemuxml2argvdata/pseries-features-nested-hv.err deleted file mode 100644 index cd6d8a679a..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-nested-hv.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: Nested HV configuration is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-features-nested-hv.xml b/tests/qemuxml2argvdata/pseries-features-nested-hv.xml deleted file mode 100644 index 8d74ab41ab..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-nested-hv.xml +++ /dev/null @@ -1,14 +0,0 @@ -<domain type='qemu'> - <name>guest</name> - <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> - <memory unit='KiB'>524288</memory> - <os> - <type arch='ppc64' machine='pseries'>hvm</type> - </os> - <features> - <nested-hv state='on'/> - </features> - <devices> - <emulator>/usr/bin/qemu-system-ppc64</emulator> - </devices> -</domain> diff --git a/tests/qemuxml2argvdata/pseries-features-sbbc.err b/tests/qemuxml2argvdata/pseries-features-sbbc.err deleted file mode 100644 index b3c00172aa..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-sbbc.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: sbbc configuration is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-features-sbbc.xml b/tests/qemuxml2argvdata/pseries-features-sbbc.xml deleted file mode 100644 index e7f8d46176..0000000000 --- a/tests/qemuxml2argvdata/pseries-features-sbbc.xml +++ /dev/null @@ -1,14 +0,0 @@ -<domain type='qemu'> - <name>guest</name> - <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> - <memory unit='KiB'>524288</memory> - <os> - <type arch='ppc64' machine='pseries'>hvm</type> - </os> - <features> - <sbbc value='workaround'/> - </features> - <devices> - <emulator>/usr/bin/qemu-system-ppc64</emulator> - </devices> -</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6560bcfaab..2ed3ae3cb7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2004,21 +2004,6 @@ mymain(void) DO_TEST_CAPS_ARCH_VER("pseries-features", "ppc64", "4.2.0"); DO_TEST_CAPS_LATEST_PPC64("pseries-features"); - /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE */ - DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-hpt-pagesize"); - /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_HTM */ - DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-htm"); - /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV */ - DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-nested-hv"); - /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST */ - DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-ccf"); - /* parse error: no QEMU_CAPS_MACHINE_PSERIES_CFPC */ - DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-cfpc"); - /* parse error: no QEMU_CAPS_MACHINE_PSERIES_SBBC */ - DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-sbbc"); - /* parse error: no QEMU_CAPS_MACHINE_PSERIES_IBS */ - DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-ibs"); - DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-invalid-machine"); DO_TEST_CAPS_LATEST_PPC64("pseries-serial-native"); -- 2.39.2

The features: QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE QEMU_CAPS_MACHINE_PSERIES_CAP_HTM QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC QEMU_CAPS_MACHINE_PSERIES_CAP_IBS are supported by all qemu versions that libvirt supports. Drop the obsolete checks. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_validate.c | 58 +--------------------------------------- 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index b2624c9131..83e4ca757e 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -37,7 +37,6 @@ VIR_LOG_INIT("qemu.qemu_validate"); static int qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, - virQEMUCaps *qemuCaps, int feature) { const char *str; @@ -69,25 +68,9 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, return -1; } } - - if (def->hpt_maxpagesize > 0 && - !virQEMUCapsGet(qemuCaps, - QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Configuring the page size for HPT guests " - "is not supported by this QEMU binary")); - return -1; - } break; case VIR_DOMAIN_FEATURE_HTM: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_HTM)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("HTM configuration is not supported by this " - "QEMU binary")); - return -1; - } - str = virTristateSwitchTypeToString(def->features[feature]); if (!str) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -98,13 +81,6 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, break; case VIR_DOMAIN_FEATURE_NESTED_HV: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Nested HV configuration is not supported by " - "this QEMU binary")); - return -1; - } - str = virTristateSwitchTypeToString(def->features[feature]); if (!str) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -115,13 +91,6 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, break; case VIR_DOMAIN_FEATURE_CCF_ASSIST: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("ccf-assist configuration is not supported by " - "this QEMU binary")); - return -1; - } - str = virTristateSwitchTypeToString(def->features[feature]); if (!str) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -132,33 +101,8 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, break; case VIR_DOMAIN_FEATURE_CFPC: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("cfpc configuration is not supported by " - "this QEMU binary")); - return -1; - } - - break; - case VIR_DOMAIN_FEATURE_SBBC: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("sbbc configuration is not supported by " - "this QEMU binary")); - return -1; - } - - break; - case VIR_DOMAIN_FEATURE_IBS: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_IBS)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("ibs configuration is not supported by " - "this QEMU binary")); - return -1; - } - break; } @@ -197,7 +141,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, case VIR_DOMAIN_FEATURE_CFPC: case VIR_DOMAIN_FEATURE_SBBC: case VIR_DOMAIN_FEATURE_IBS: - if (qemuValidateDomainDefPSeriesFeature(def, qemuCaps, i) < 0) + if (qemuValidateDomainDefPSeriesFeature(def, i) < 0) return -1; break; -- 2.39.2

Retire: QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE QEMU_CAPS_MACHINE_PSERIES_CAP_HTM QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC QEMU_CAPS_MACHINE_PSERIES_CAP_IBS Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 21 +++++++------------ src/qemu/qemu_capabilities.h | 14 ++++++------- .../qemucapabilitiesdata/caps_4.2.0_ppc64.xml | 7 ------- .../qemucapabilitiesdata/caps_5.0.0_ppc64.xml | 7 ------- .../qemucapabilitiesdata/caps_5.2.0_ppc64.xml | 7 ------- .../qemucapabilitiesdata/caps_6.2.0_ppc64.xml | 7 ------- .../qemucapabilitiesdata/caps_7.0.0_ppc64.xml | 7 ------- .../qemucapabilitiesdata/caps_7.1.0_ppc64.xml | 7 ------- 8 files changed, 14 insertions(+), 63 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 93915a9284..b023c7d178 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -497,10 +497,10 @@ VIR_ENUM_IMPL(virQEMUCaps, "mch", /* QEMU_CAPS_DEVICE_MCH */ "mch.extended-tseg-mbytes", /* QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES */ "sev-guest", /* QEMU_CAPS_SEV_GUEST */ - "machine.pseries.cap-hpt-max-page-size", /* QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE */ + "machine.pseries.cap-hpt-max-page-size", /* X_QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE */ /* 310 */ - "machine.pseries.cap-htm", /* QEMU_CAPS_MACHINE_PSERIES_CAP_HTM */ + "machine.pseries.cap-htm", /* X_QEMU_CAPS_MACHINE_PSERIES_CAP_HTM */ "usb-storage.werror", /* X_QEMU_CAPS_USB_STORAGE_WERROR */ "egl-headless", /* QEMU_CAPS_EGL_HEADLESS */ "vfio-pci.display", /* QEMU_CAPS_VFIO_PCI_DISPLAY */ @@ -514,7 +514,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "iothread.poll-max-ns", /* X_QEMU_CAPS_IOTHREAD_POLLING */ /* 320 */ - "machine.pseries.cap-nested-hv", /* QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV */ + "machine.pseries.cap-nested-hv", /* X_QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV */ "egl-headless.rendernode", /* QEMU_CAPS_EGL_HEADLESS_RENDERNODE */ "memory-backend-file.align", /* X_QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN */ "memory-backend-file.pmem", /* QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM */ @@ -546,7 +546,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "query-cpu-model-baseline", /* QEMU_CAPS_QUERY_CPU_MODEL_BASELINE */ "query-cpu-model-comparison", /* QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON */ "ramfb", /* QEMU_CAPS_DEVICE_RAMFB */ - "machine.pseries.cap-ccf-assist", /* QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST */ + "machine.pseries.cap-ccf-assist", /* X_QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST */ /* 345 */ "arm-max-cpu", /* QEMU_CAPS_ARM_MAX_CPU */ @@ -574,11 +574,11 @@ VIR_ENUM_IMPL(virQEMUCaps, "virtio.packed", /* X_QEMU_CAPS_VIRTIO_PACKED_QUEUES */ "pcie-root-port.hotplug", /* QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG */ "aio.io_uring", /* QEMU_CAPS_AIO_IO_URING */ - "machine.pseries.cap-cfpc", /* QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC */ + "machine.pseries.cap-cfpc", /* X_QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC */ /* 365 */ - "machine.pseries.cap-sbbc", /* QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC */ - "machine.pseries.cap-ibs", /* QEMU_CAPS_MACHINE_PSERIES_CAP_IBS */ + "machine.pseries.cap-sbbc", /* X_QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC */ + "machine.pseries.cap-ibs", /* X_QEMU_CAPS_MACHINE_PSERIES_CAP_IBS */ "tcg", /* QEMU_CAPS_TCG */ "virtio-blk-pci.scsi.default.disabled", /* QEMU_CAPS_VIRTIO_BLK_SCSI_DEFAULT_DISABLED */ "pvscsi", /* QEMU_CAPS_SCSI_PVSCSI */ @@ -1715,13 +1715,6 @@ static virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = { }; static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsPSeries[] = { - { "cap-hpt-max-page-size", QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE }, - { "cap-htm", QEMU_CAPS_MACHINE_PSERIES_CAP_HTM }, - { "cap-nested-hv", QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV }, - { "cap-ccf-assist", QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST }, - { "cap-cfpc", QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC }, - { "cap-sbbc", QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC }, - { "cap-ibs", QEMU_CAPS_MACHINE_PSERIES_CAP_IBS }, }; static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsVirt[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index ca31e26f0d..3b55aed07a 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -476,10 +476,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_DEVICE_MCH, /* Northbridge in q35 machine types */ QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES, /* -global mch.extended-tseg-mbytes */ QEMU_CAPS_SEV_GUEST, /* -object sev-guest,... */ - QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE, /* -machine pseries.cap-hpt-max-page-size */ + X_QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE, /* -machine pseries.cap-hpt-max-page-size */ /* 310 */ - QEMU_CAPS_MACHINE_PSERIES_CAP_HTM, /* -machine pseries.cap-htm */ + X_QEMU_CAPS_MACHINE_PSERIES_CAP_HTM, /* -machine pseries.cap-htm */ X_QEMU_CAPS_USB_STORAGE_WERROR, /* -device usb-storage,werror=..,rerror=.. */ QEMU_CAPS_EGL_HEADLESS, /* -display egl-headless */ QEMU_CAPS_VFIO_PCI_DISPLAY, /* -device vfio-pci.display */ @@ -493,7 +493,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ X_QEMU_CAPS_IOTHREAD_POLLING, /* -object iothread.poll-max-ns */ /* 320 */ - QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV, /* -machine pseries.cap-nested-hv */ + X_QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV, /* -machine pseries.cap-nested-hv */ QEMU_CAPS_EGL_HEADLESS_RENDERNODE, /* -display egl-headless,rendernode= */ X_QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN, /* -object memory-backend-file,align= */ QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM, /* -object memory-backend-file,pmem= */ @@ -525,7 +525,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_QUERY_CPU_MODEL_BASELINE, /* qmp query-cpu-model-baseline */ QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON, /* qmp query-cpu-model-comparison */ QEMU_CAPS_DEVICE_RAMFB, /* -device ramfb */ - QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST, /* -machine pseries.cap-ccf-assist */ + X_QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST, /* -machine pseries.cap-ccf-assist */ /* 345 */ QEMU_CAPS_ARM_MAX_CPU, /* max-arm-cpu type exists */ @@ -553,11 +553,11 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ X_QEMU_CAPS_VIRTIO_PACKED_QUEUES, /* virtio.packed */ QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG, /* pcie-root-port.hotplug */ QEMU_CAPS_AIO_IO_URING, /* -blockdev {...,"aio":"io_uring",...} */ - QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC, /* -machine pseries.cap-cfpc */ + X_QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC, /* -machine pseries.cap-cfpc */ /* 365 */ - QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC, /* -machine pseries.cap-sbbc */ - QEMU_CAPS_MACHINE_PSERIES_CAP_IBS, /* -machine pseries.cap-ibs */ + X_QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC, /* -machine pseries.cap-sbbc */ + X_QEMU_CAPS_MACHINE_PSERIES_CAP_IBS, /* -machine pseries.cap-ibs */ QEMU_CAPS_TCG, /* QEMU does support TCG */ QEMU_CAPS_VIRTIO_BLK_SCSI_DEFAULT_DISABLED, /* virtio-blk-pci.scsi disabled by default */ QEMU_CAPS_SCSI_PVSCSI, /* -device pvscsi */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml index 1cc145cf58..2064f07c9c 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0_ppc64.xml @@ -81,13 +81,10 @@ <flag name='screendump_device'/> <flag name='hda-output'/> <flag name='vhost-vsock'/> - <flag name='machine.pseries.cap-hpt-max-page-size'/> - <flag name='machine.pseries.cap-htm'/> <flag name='egl-headless'/> <flag name='vfio-pci.display'/> <flag name='memory-backend-memfd'/> <flag name='memory-backend-memfd.hugetlb'/> - <flag name='machine.pseries.cap-nested-hv'/> <flag name='egl-headless.rendernode'/> <flag name='memory-backend-file.pmem'/> <flag name='virtio-pci-non-transitional'/> @@ -96,14 +93,10 @@ <flag name='migration-file-drop-cache'/> <flag name='vhost-user-gpu'/> <flag name='vhost-user-vga'/> - <flag name='machine.pseries.cap-ccf-assist'/> <flag name='drive-nvme'/> <flag name='smp-dies'/> <flag name='i8042'/> <flag name='rng-builtin'/> - <flag name='machine.pseries.cap-cfpc'/> - <flag name='machine.pseries.cap-sbbc'/> - <flag name='machine.pseries.cap-ibs'/> <flag name='tcg'/> <flag name='pvscsi'/> <flag name='spapr-tpm-proxy'/> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml index 3b49aee40a..16333ba499 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0_ppc64.xml @@ -84,13 +84,10 @@ <flag name='hda-output'/> <flag name='vhost-vsock'/> <flag name='tpm-emulator'/> - <flag name='machine.pseries.cap-hpt-max-page-size'/> - <flag name='machine.pseries.cap-htm'/> <flag name='egl-headless'/> <flag name='vfio-pci.display'/> <flag name='memory-backend-memfd'/> <flag name='memory-backend-memfd.hugetlb'/> - <flag name='machine.pseries.cap-nested-hv'/> <flag name='egl-headless.rendernode'/> <flag name='memory-backend-file.pmem'/> <flag name='nvdimm.unarmed'/> @@ -101,7 +98,6 @@ <flag name='dbus-vmstate'/> <flag name='vhost-user-gpu'/> <flag name='vhost-user-vga'/> - <flag name='machine.pseries.cap-ccf-assist'/> <flag name='drive-nvme'/> <flag name='smp-dies'/> <flag name='i8042'/> @@ -112,9 +108,6 @@ <flag name='blockdev-snapshot.allow-write-only-overlay'/> <flag name='fsdev.multidevs'/> <flag name='pcie-root-port.hotplug'/> - <flag name='machine.pseries.cap-cfpc'/> - <flag name='machine.pseries.cap-sbbc'/> - <flag name='machine.pseries.cap-ibs'/> <flag name='tcg'/> <flag name='virtio-blk-pci.scsi.default.disabled'/> <flag name='pvscsi'/> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml index d02441420d..9db85dafef 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0_ppc64.xml @@ -82,13 +82,10 @@ <flag name='hda-output'/> <flag name='vhost-vsock'/> <flag name='tpm-emulator'/> - <flag name='machine.pseries.cap-hpt-max-page-size'/> - <flag name='machine.pseries.cap-htm'/> <flag name='egl-headless'/> <flag name='vfio-pci.display'/> <flag name='memory-backend-memfd'/> <flag name='memory-backend-memfd.hugetlb'/> - <flag name='machine.pseries.cap-nested-hv'/> <flag name='egl-headless.rendernode'/> <flag name='memory-backend-file.pmem'/> <flag name='nvdimm.unarmed'/> @@ -99,7 +96,6 @@ <flag name='dbus-vmstate'/> <flag name='vhost-user-gpu'/> <flag name='vhost-user-vga'/> - <flag name='machine.pseries.cap-ccf-assist'/> <flag name='drive-nvme'/> <flag name='smp-dies'/> <flag name='i8042'/> @@ -110,9 +106,6 @@ <flag name='blockdev-snapshot.allow-write-only-overlay'/> <flag name='fsdev.multidevs'/> <flag name='pcie-root-port.hotplug'/> - <flag name='machine.pseries.cap-cfpc'/> - <flag name='machine.pseries.cap-sbbc'/> - <flag name='machine.pseries.cap-ibs'/> <flag name='tcg'/> <flag name='virtio-blk-pci.scsi.default.disabled'/> <flag name='pvscsi'/> diff --git a/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml index 97ebca47eb..e6b0bc03f4 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0_ppc64.xml @@ -82,12 +82,9 @@ <flag name='hda-output'/> <flag name='vhost-vsock'/> <flag name='tpm-emulator'/> - <flag name='machine.pseries.cap-hpt-max-page-size'/> - <flag name='machine.pseries.cap-htm'/> <flag name='vfio-pci.display'/> <flag name='memory-backend-memfd'/> <flag name='memory-backend-memfd.hugetlb'/> - <flag name='machine.pseries.cap-nested-hv'/> <flag name='nvdimm.unarmed'/> <flag name='virtio-pci-non-transitional'/> <flag name='nbd-bitmap'/> @@ -97,7 +94,6 @@ <flag name='vhost-user-gpu'/> <flag name='vhost-user-vga'/> <flag name='incremental-backup'/> - <flag name='machine.pseries.cap-ccf-assist'/> <flag name='drive-nvme'/> <flag name='smp-dies'/> <flag name='i8042'/> @@ -109,9 +105,6 @@ <flag name='blockdev-reopen'/> <flag name='fsdev.multidevs'/> <flag name='pcie-root-port.hotplug'/> - <flag name='machine.pseries.cap-cfpc'/> - <flag name='machine.pseries.cap-sbbc'/> - <flag name='machine.pseries.cap-ibs'/> <flag name='tcg'/> <flag name='virtio-blk-pci.scsi.default.disabled'/> <flag name='pvscsi'/> diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml index a00ed4ef68..40130f180f 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml @@ -88,13 +88,10 @@ <flag name='hda-output'/> <flag name='vhost-vsock'/> <flag name='tpm-emulator'/> - <flag name='machine.pseries.cap-hpt-max-page-size'/> - <flag name='machine.pseries.cap-htm'/> <flag name='egl-headless'/> <flag name='vfio-pci.display'/> <flag name='memory-backend-memfd'/> <flag name='memory-backend-memfd.hugetlb'/> - <flag name='machine.pseries.cap-nested-hv'/> <flag name='egl-headless.rendernode'/> <flag name='memory-backend-file.pmem'/> <flag name='nvdimm.unarmed'/> @@ -106,7 +103,6 @@ <flag name='vhost-user-gpu'/> <flag name='vhost-user-vga'/> <flag name='incremental-backup'/> - <flag name='machine.pseries.cap-ccf-assist'/> <flag name='drive-nvme'/> <flag name='smp-dies'/> <flag name='i8042'/> @@ -119,9 +115,6 @@ <flag name='fsdev.multidevs'/> <flag name='pcie-root-port.hotplug'/> <flag name='aio.io_uring'/> - <flag name='machine.pseries.cap-cfpc'/> - <flag name='machine.pseries.cap-sbbc'/> - <flag name='machine.pseries.cap-ibs'/> <flag name='tcg'/> <flag name='virtio-blk-pci.scsi.default.disabled'/> <flag name='pvscsi'/> diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml index ccae1b1d2b..6bc39b85f7 100644 --- a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml @@ -87,12 +87,9 @@ <flag name='hda-output'/> <flag name='vhost-vsock'/> <flag name='tpm-emulator'/> - <flag name='machine.pseries.cap-hpt-max-page-size'/> - <flag name='machine.pseries.cap-htm'/> <flag name='vfio-pci.display'/> <flag name='memory-backend-memfd'/> <flag name='memory-backend-memfd.hugetlb'/> - <flag name='machine.pseries.cap-nested-hv'/> <flag name='memory-backend-file.pmem'/> <flag name='nvdimm.unarmed'/> <flag name='virtio-pci-non-transitional'/> @@ -103,7 +100,6 @@ <flag name='vhost-user-gpu'/> <flag name='vhost-user-vga'/> <flag name='incremental-backup'/> - <flag name='machine.pseries.cap-ccf-assist'/> <flag name='drive-nvme'/> <flag name='smp-dies'/> <flag name='i8042'/> @@ -116,9 +112,6 @@ <flag name='fsdev.multidevs'/> <flag name='pcie-root-port.hotplug'/> <flag name='aio.io_uring'/> - <flag name='machine.pseries.cap-cfpc'/> - <flag name='machine.pseries.cap-sbbc'/> - <flag name='machine.pseries.cap-ibs'/> <flag name='tcg'/> <flag name='virtio-blk-pci.scsi.default.disabled'/> <flag name='pvscsi'/> -- 2.39.2

Return early and reformat the error message. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_validate.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 83e4ca757e..793990c4ca 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -41,20 +41,18 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, { const char *str; - if (def->features[feature] != VIR_TRISTATE_SWITCH_ABSENT && - !qemuDomainIsPSeries(def)) { + if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT) + return 0; + + if (!qemuDomainIsPSeries(def)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The '%s' feature is not supported for " - "architecture '%s' or machine type '%s'"), + _("The '%s' feature is not supported for architecture '%s' or machine type '%s'"), virDomainFeatureTypeToString(feature), virArchToString(def->os.arch), def->os.machine); return -1; } - if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT) - return 0; - switch (feature) { case VIR_DOMAIN_FEATURE_HPT: if (def->features[feature] != VIR_TRISTATE_SWITCH_ON) -- 2.39.2

Unify validation of VIR_DOMAIN_FEATURE_HTM, VIR_DOMAIN_FEATURE_NESTED_HV, VIR_DOMAIN_FEATURE_CCF_ASSIST and remove temporary string. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_validate.c | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 793990c4ca..83f2502e6a 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -39,8 +39,6 @@ static int qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, int feature) { - const char *str; - if (def->features[feature] == VIR_TRISTATE_SWITCH_ABSENT) return 0; @@ -59,8 +57,7 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, break; if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE) { - str = virDomainHPTResizingTypeToString(def->hpt_resizing); - if (!str) { + if (!virDomainHPTResizingTypeToString(def->hpt_resizing)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Invalid setting for HPT resizing")); return -1; @@ -69,33 +66,15 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef *def, break; case VIR_DOMAIN_FEATURE_HTM: - str = virTristateSwitchTypeToString(def->features[feature]); - if (!str) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid setting for HTM state")); - return -1; - } - - break; - case VIR_DOMAIN_FEATURE_NESTED_HV: - str = virTristateSwitchTypeToString(def->features[feature]); - if (!str) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid setting for nested HV state")); - return -1; - } - - break; - case VIR_DOMAIN_FEATURE_CCF_ASSIST: - str = virTristateSwitchTypeToString(def->features[feature]); - if (!str) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid setting for ccf-assist state")); + if (!virTristateSwitchTypeToString(def->features[feature])) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid setting for pseries feature '%s'"), + virDomainFeatureTypeToString(feature)); + return -1; } - break; case VIR_DOMAIN_FEATURE_CFPC: -- 2.39.2

Convert the last outstanding test cases for ppc64 to use real capabilities. In couple cases this actually fixes the test case to test what it was intending to do. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- ...r => aarch64-gic-not-arm.ppc64-latest.err} | 0 ... cpu-hotplug-granularity.ppc64-latest.err} | 0 ....err => ppc64-tpm-double.ppc64-latest.err} | 0 ...=> ppc64-tpmproxy-double.ppc64-latest.err} | 0 .../qemuxml2argvdata/pseries-no-parallel.err | 1 - .../pseries-no-parallel.ppc64-latest.err | 1 + ...b-invalid-target-index-1.ppc64-latest.err} | 0 ...b-invalid-target-index-2.ppc64-latest.err} | 0 ...b-invalid-target-index-3.ppc64-latest.err} | 0 .../pseries-spaprvio-invalid.err | 1 - .../pseries-spaprvio-invalid.ppc64-latest.err | 1 + tests/qemuxml2argvtest.c | 29 ++++++------------- 12 files changed, 11 insertions(+), 22 deletions(-) rename tests/qemuxml2argvdata/{aarch64-gic-not-arm.err => aarch64-gic-not-arm.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{cpu-hotplug-granularity.err => cpu-hotplug-granularity.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{ppc64-tpm-double.err => ppc64-tpm-double.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{ppc64-tpmproxy-double.err => ppc64-tpmproxy-double.ppc64-latest.err} (100%) delete mode 100644 tests/qemuxml2argvdata/pseries-no-parallel.err create mode 100644 tests/qemuxml2argvdata/pseries-no-parallel.ppc64-latest.err rename tests/qemuxml2argvdata/{pseries-phb-invalid-target-index-1.err => pseries-phb-invalid-target-index-1.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{pseries-phb-invalid-target-index-2.err => pseries-phb-invalid-target-index-2.ppc64-latest.err} (100%) rename tests/qemuxml2argvdata/{pseries-phb-invalid-target-index-3.err => pseries-phb-invalid-target-index-3.ppc64-latest.err} (100%) delete mode 100644 tests/qemuxml2argvdata/pseries-spaprvio-invalid.err create mode 100644 tests/qemuxml2argvdata/pseries-spaprvio-invalid.ppc64-latest.err diff --git a/tests/qemuxml2argvdata/aarch64-gic-not-arm.err b/tests/qemuxml2argvdata/aarch64-gic-not-arm.ppc64-latest.err similarity index 100% rename from tests/qemuxml2argvdata/aarch64-gic-not-arm.err rename to tests/qemuxml2argvdata/aarch64-gic-not-arm.ppc64-latest.err diff --git a/tests/qemuxml2argvdata/cpu-hotplug-granularity.err b/tests/qemuxml2argvdata/cpu-hotplug-granularity.ppc64-latest.err similarity index 100% rename from tests/qemuxml2argvdata/cpu-hotplug-granularity.err rename to tests/qemuxml2argvdata/cpu-hotplug-granularity.ppc64-latest.err diff --git a/tests/qemuxml2argvdata/ppc64-tpm-double.err b/tests/qemuxml2argvdata/ppc64-tpm-double.ppc64-latest.err similarity index 100% rename from tests/qemuxml2argvdata/ppc64-tpm-double.err rename to tests/qemuxml2argvdata/ppc64-tpm-double.ppc64-latest.err diff --git a/tests/qemuxml2argvdata/ppc64-tpmproxy-double.err b/tests/qemuxml2argvdata/ppc64-tpmproxy-double.ppc64-latest.err similarity index 100% rename from tests/qemuxml2argvdata/ppc64-tpmproxy-double.err rename to tests/qemuxml2argvdata/ppc64-tpmproxy-double.ppc64-latest.err diff --git a/tests/qemuxml2argvdata/pseries-no-parallel.err b/tests/qemuxml2argvdata/pseries-no-parallel.err deleted file mode 100644 index 9c9eb69ae4..0000000000 --- a/tests/qemuxml2argvdata/pseries-no-parallel.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: The 'spapr-pci-host-bridge' device is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-no-parallel.ppc64-latest.err b/tests/qemuxml2argvdata/pseries-no-parallel.ppc64-latest.err new file mode 100644 index 0000000000..619b19dc28 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-no-parallel.ppc64-latest.err @@ -0,0 +1 @@ +unsupported configuration: parallel ports are not supported diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.ppc64-latest.err similarity index 100% rename from tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err rename to tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.ppc64-latest.err diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.ppc64-latest.err similarity index 100% rename from tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err rename to tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.ppc64-latest.err diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.ppc64-latest.err similarity index 100% rename from tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err rename to tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.ppc64-latest.err diff --git a/tests/qemuxml2argvdata/pseries-spaprvio-invalid.err b/tests/qemuxml2argvdata/pseries-spaprvio-invalid.err deleted file mode 100644 index 9c9eb69ae4..0000000000 --- a/tests/qemuxml2argvdata/pseries-spaprvio-invalid.err +++ /dev/null @@ -1 +0,0 @@ -unsupported configuration: The 'spapr-pci-host-bridge' device is not supported by this QEMU binary diff --git a/tests/qemuxml2argvdata/pseries-spaprvio-invalid.ppc64-latest.err b/tests/qemuxml2argvdata/pseries-spaprvio-invalid.ppc64-latest.err new file mode 100644 index 0000000000..cadd19e2f2 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-spaprvio-invalid.ppc64-latest.err @@ -0,0 +1 @@ +unsupported configuration: spapr-vio reg='0x100000000' exceeds maximum possible value (0xffffffff) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2ed3ae3cb7..4fada9725f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1964,7 +1964,7 @@ mymain(void) DO_TEST_CAPS_LATEST_PPC64("pseries-nvram"); DO_TEST_CAPS_LATEST_PPC64("pseries-usb-kbd"); DO_TEST_CAPS_LATEST_PPC64("pseries-cpu-exact"); - DO_TEST_PARSE_ERROR_NOCAPS("pseries-no-parallel"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("pseries-no-parallel", "ppc64"); DO_TEST_CAPS_LATEST_PPC64("pseries-cpu-le"); qemuTestSetHostArch(&driver, VIR_ARCH_PPC64); @@ -1990,9 +1990,9 @@ mymain(void) DO_TEST_CAPS_LATEST_PPC64("pseries-phb-numa-node"); DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("pseries-default-phb-numa-node", "ppc64"); - DO_TEST_PARSE_ERROR_NOCAPS("pseries-phb-invalid-target-index-1"); - DO_TEST_PARSE_ERROR_NOCAPS("pseries-phb-invalid-target-index-2"); - DO_TEST_PARSE_ERROR_NOCAPS("pseries-phb-invalid-target-index-3"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("pseries-phb-invalid-target-index-1", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("pseries-phb-invalid-target-index-2", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("pseries-phb-invalid-target-index-3", "ppc64"); DO_TEST_CAPS_LATEST_PPC64("pseries-many-devices"); DO_TEST_CAPS_LATEST_PPC64("pseries-many-buses-1"); @@ -2014,7 +2014,7 @@ mymain(void) DO_TEST_CAPS_LATEST_PPC64("pseries-console-native"); DO_TEST_CAPS_LATEST_PPC64("pseries-console-virtio"); DO_TEST_PARSE_ERROR_NOCAPS("pseries-serial-invalid-machine"); - DO_TEST_PARSE_ERROR_NOCAPS("pseries-spaprvio-invalid"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("pseries-spaprvio-invalid", "ppc64"); DO_TEST("mach-virt-serial-native", QEMU_CAPS_DEVICE_PL011); @@ -2463,8 +2463,7 @@ mymain(void) QEMU_CAPS_KVM); DO_TEST_PARSE_ERROR("aarch64-gic-not-virt", QEMU_CAPS_KVM); - DO_TEST_PARSE_ERROR("aarch64-gic-not-arm", - QEMU_CAPS_KVM); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-gic-not-arm", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("aarch64-kvm-32-on-64", "aarch64"); DO_TEST("aarch64-pci-serial", QEMU_CAPS_DEVICE_PCI_SERIAL, @@ -2607,17 +2606,8 @@ mymain(void) ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest", ARG_END); - DO_TEST_PARSE_ERROR("ppc64-tpmproxy-double", - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_PCI_OHCI, - QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, - QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY); - - DO_TEST_PARSE_ERROR("ppc64-tpm-double", - QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_PCI_OHCI, - QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, - QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("ppc64-tpmproxy-double", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("ppc64-tpm-double", "ppc64"); DO_TEST_CAPS_LATEST_PPC64("ppc64-tpmproxy-single"); DO_TEST_CAPS_LATEST_PPC64("ppc64-tpmproxy-with-tpm"); @@ -2661,8 +2651,7 @@ mymain(void) DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-invalid-address"); DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); - DO_TEST_PARSE_ERROR("cpu-hotplug-granularity", - QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("cpu-hotplug-granularity", "ppc64"); DO_TEST_CAPS_LATEST("virtio-options"); DO_TEST_CAPS_LATEST("virtio-options-controller-iommu"); -- 2.39.2

Now that all tests were converted to use real capabilities we don't need it any more. Remove it so that no new tests are added with it. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/testutilsqemu.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 0d7892353c..bd3de1e786 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -30,14 +30,9 @@ static const char *qemu_emulators[VIR_ARCH_LAST] = { [VIR_ARCH_I686] = "/usr/bin/qemu-system-i386", [VIR_ARCH_X86_64] = "/usr/bin/qemu-system-x86_64", [VIR_ARCH_AARCH64] = "/usr/bin/qemu-system-aarch64", - [VIR_ARCH_PPC64] = "/usr/bin/qemu-system-ppc64", [VIR_ARCH_S390X] = "/usr/bin/qemu-system-s390x", }; -static const virArch arch_alias[VIR_ARCH_LAST] = { - [VIR_ARCH_PPC64LE] = VIR_ARCH_PPC64, -}; - static const char *const i386_machines[] = { "pc", NULL }; @@ -48,9 +43,6 @@ static const char *const x86_64_machines[] = { static const char *const aarch64_machines[] = { "virt", "virt-2.6", "versatilepb", NULL }; -static const char *const ppc64_machines[] = { - "pseries", NULL -}; static const char *const s390x_machines[] = { "s390-ccw-virtio", NULL }; @@ -59,7 +51,6 @@ static const char *const *qemu_machines[VIR_ARCH_LAST] = { [VIR_ARCH_I686] = i386_machines, [VIR_ARCH_X86_64] = x86_64_machines, [VIR_ARCH_AARCH64] = aarch64_machines, - [VIR_ARCH_PPC64] = ppc64_machines, [VIR_ARCH_S390X] = s390x_machines, }; @@ -67,7 +58,6 @@ static const char *qemu_default_ram_id[VIR_ARCH_LAST] = { [VIR_ARCH_I686] = "pc.ram", [VIR_ARCH_X86_64] = "pc.ram", [VIR_ARCH_AARCH64] = "mach-virt.ram", - [VIR_ARCH_PPC64] = "ppc_spapr.ram", [VIR_ARCH_S390X] = "s390.ram", }; @@ -164,9 +154,6 @@ testQemuAddGuest(virCaps *caps, virCapsGuest *guest; virArch emu_arch = arch; - if (arch_alias[arch] != VIR_ARCH_NONE) - emu_arch = arch_alias[arch]; - if (qemu_emulators[emu_arch] == NULL) return 0; @@ -412,9 +399,6 @@ qemuTestCapsCacheInsert(virFileCache *cache, g_autoptr(virQEMUCaps) copyCaps = NULL; virQEMUCaps *effCaps = caps; - if (arch_alias[arch] != VIR_ARCH_NONE) - arch = arch_alias[arch]; - if (qemu_emulators[arch]) { /* if we are dealing with fake caps we need to populate machine types */ if (!virQEMUCapsHasMachines(caps)) { -- 2.39.2

On a Thursday in 2023, Peter Krempa wrote:
This series applies on top of 'part2' fetch everything from my repo:
git fetch https://gitlab.com/pipo.sk/libvirt.git ppc-send
In this part: - caps code is refactored to simplify error paths - vircapstest is removed - qemumemlocktest is converted to use real caps - qemuhotplugtest is converted to use real caps - ppc64 fake caps invocation is dropped from qemuxml2xml/argv tests - always present ppc64 caps are drooped - ppc64 fake emulators are removed
Peter Krempa (31): qemu: capabilities: Drop 'kvmVersion' field libxlCapsInitGuests: Rework insane use of ternary operators [...] qemuxml2argvtest: Use real capabilities for negative test cases for ppc64 architecture testutilsqemu: Drop fake capability testing infrastructure for 'ppc64'
src/conf/capabilities.c | 31 +- src/conf/capabilities.h | 5 +- src/libvirt_private.syms | 1 - [...] ... => ppc64-usb-controller.ppc64-latest.xml} | 5 +- tests/qemuxml2xmltest.c | 24 +- tests/testutilsqemu.c | 171 ++++++----- tests/testutilsqemu.h | 11 +- tests/testutilsxen.c | 26 +- tests/vircapstest.c | 230 -------------- 132 files changed, 705 insertions(+), 1118 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Peter Krempa