When starting a domain without a CPU model specified in the domain XML,
QEMU will choose a default one. Which is fine unless the domain gets
migrated to another host because libvirt doesn't perform any CPU ABI
checks and the virtual CPU provided by QEMU on the destination host can
differ from the one on the source host.
With QEMU 4.2.0 we can probe for the default CPU model used by QEMU for
a particular machine type and store it in the domain XML. This way the
chosen CPU model is more visible to users and libvirt will make sure
the guest will see the exact same CPU after migration.
https://bugzilla.redhat.com/show_bug.cgi?id=1598151
https://bugzilla.redhat.com/show_bug.cgi?id=1598162
Version 2:
- more tests
- TCG-only support for non x86_64 architectures
Version 3:
- as a result of talking with QEMU developers dealing with s390 and
ppc64 I have to enhance the series so that libvirt is able to fetch
different default CPU models on TCG vs. KVM
---
Some patches were too large so I decided to shorten them before sending
to the list. You can check the full version of this series with
git fetch
https://gitlab.com/jirkade/libvirt cpu-default-type
Jiri Denemark (52):
tests: Add capabilities for QEMU 4.2.0 on s390x
tests: Update 4.2.0 capabilities data on ppc64
conf: Use VIR_AUTO* in virDomainCapsCPUModelsAdd
conf: Drop nameLen parameter from virDomainCapsCPUModelsAdd
qemu: Copy CPU models in virQEMUCapsGetCPUDefinitions
qemu: Filter models in virQEMUCapsGetCPUDefinitions
qemu: Use virQEMUCapsGetCPUDefinitions more
qemu: Use g_autoptr in qemuMonitorJSONGetCPUDefinitions
qemu: Change return type of virQEMUCapsFetchCPUDefinitions
qemu: Introduce qemuMonitorCPUDefs struct
qemu: Flatten qemuMonitorCPUDefs.cpus
qemu: Add qemuMonitorCPUDefsCopy
qemu: Use g_autofree in virQEMUCapsLoadCPUModels
qemu: Use virDomainCapsCPUUsable in qemuMonitorCPUDefInfo
qemu: Introduce virQEMUCapsCPUDefsToModels
qemu: Rename virQEMUCaps{Get,Fetch}CPUDefinitions
qemu: Split virQEMUCapsFetchCPUModels
qemu: Switch qemuCaps to use qemuMonitorCPUDefs
conf: Drop unused virDomainCapsCPUModelsFilter
conf: Drop virDomainCapsCPUModelsAddSteal
qemu: Store typename from query-cpu-definitions in qemuCaps
qemu: Drop unused virQEMUCapsGetDefaultMachine
qemu: Add virQEMUCaps{Load,Format}Accel
qemu: Introduce virQEMUCapsAccel structure
qemu: Introduce virQEMUCapsAccelCopy
qemu: Introduce virQEMUCapsAccelClear
qemu: Introduce and use virQEMUCapsGetAccel
qemu: Drop virQEMUCapsGetHostCPUData
qemu: Refactor virQEMUCapsLoadAccel
qemu: Refactor virQEMUCapsFormatAccel
qemu: Introduce virQEMUCapsProbeCPUDefinitionsTest
qemu: Refactor probing of accelerator dependent data
qemu: Make virQEMUCapsGetMachineTypesCaps static
qemu: Make virQEMUCapsIsMachineSupported static
qemu: Refactor virQEMUCapsLoadCache a bit
qemu: Refactor virQEMUCapsFormatCache a bit
qemu: Pass virDomainVirtType to APIs dealing with machine types
qemu: Move machine type data in capabilities cache
qemu: Use typedef for virQEMUCapsMachineType
qemu: Introduce virQEMUCapsCopyMachineTypes
qemu: Make probed machine types depend on accelerator
qemu: Probe machine types for both KVM and TCG
qemu: Probe for default CPU types
qemu: Introduce virQEMUCapsGetMachineDefaultCPU
qemu: Use g_autoptr in qemuDomainDefPostParse
conf: Define g_autoptr cleanup function for virCPUDef
qemuxml2argvtest: Update host arch for DO_TEST*ARCH* tests
qemuxml2*test: Add test cases for default CPU models on aarch64
qemuxml2*test: Add test cases for default CPU models on ppc64
qemuxml2*test: Add test cases for default CPU models on s390x
qemuxml2*test: Add test cases for default CPU models on x86_64
qemu: Store default CPU in domain XML
src/conf/cpu_conf.h | 1 +
src/conf/domain_capabilities.c | 86 +-
src/conf/domain_capabilities.h | 10 +-
src/libvirt_private.syms | 2 -
src/qemu/qemu_capabilities.c | 1064 +-
src/qemu/qemu_capabilities.h | 29 +-
src/qemu/qemu_capspriv.h | 5 +-
src/qemu/qemu_domain.c | 97 +-
src/qemu/qemu_driver.c | 4 +-
src/qemu/qemu_monitor.c | 61 +-
src/qemu/qemu_monitor.h | 19 +-
src/qemu/qemu_monitor_json.c | 82 +-
src/qemu/qemu_monitor_json.h | 2 +-
src/qemu/qemu_process.c | 24 +-
tests/cputest.c | 12 +-
tests/domaincapsdata/qemu_4.2.0.s390x.xml | 202 +
tests/domaincapstest.c | 10 +-
.../caps_1.5.3.x86_64.replies | 78 +
.../caps_1.5.3.x86_64.xml | 45 +-
.../caps_1.6.0.x86_64.replies | 86 +
.../caps_1.6.0.x86_64.xml | 51 +-
.../caps_1.7.0.x86_64.replies | 94 +
.../caps_1.7.0.x86_64.xml | 57 +-
.../caps_2.1.1.x86_64.replies | 110 +
.../caps_2.1.1.x86_64.xml | 69 +-
.../caps_2.10.0.aarch64.replies | 272 +
.../caps_2.10.0.aarch64.xml | 279 +-
.../caps_2.10.0.ppc64.replies | 123 +
.../caps_2.10.0.ppc64.xml | 575 +-
.../caps_2.10.0.s390x.replies | 53 +
.../caps_2.10.0.s390x.xml | 285 +-
.../caps_2.10.0.x86_64.replies | 194 +
.../caps_2.10.0.x86_64.xml | 387 +-
.../caps_2.11.0.s390x.replies | 58 +
.../caps_2.11.0.s390x.xml | 288 +-
.../caps_2.11.0.x86_64.replies | 194 +
.../caps_2.11.0.x86_64.xml | 327 +-
.../caps_2.12.0.aarch64.replies | 302 +
.../caps_2.12.0.aarch64.xml | 307 +-
.../caps_2.12.0.ppc64.replies | 143 +
.../caps_2.12.0.ppc64.xml | 591 +-
.../caps_2.12.0.s390x.replies | 63 +
.../caps_2.12.0.s390x.xml | 291 +-
.../caps_2.12.0.x86_64.replies | 204 +
.../caps_2.12.0.x86_64.xml | 631 +-
.../caps_2.4.0.x86_64.replies | 134 +
.../caps_2.4.0.x86_64.xml | 87 +-
.../caps_2.5.0.x86_64.replies | 142 +
.../caps_2.5.0.x86_64.xml | 93 +-
.../caps_2.6.0.aarch64.replies | 180 +
.../caps_2.6.0.aarch64.xml | 123 +-
.../caps_2.6.0.ppc64.replies | 77 +
.../qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 45 +-
.../caps_2.6.0.x86_64.replies | 118 +
.../caps_2.6.0.x86_64.xml | 75 +-
.../caps_2.7.0.s390x.replies | 38 +
.../qemucapabilitiesdata/caps_2.7.0.s390x.xml | 12 +-
.../caps_2.7.0.x86_64.replies | 154 +
.../caps_2.7.0.x86_64.xml | 81 +-
.../caps_2.8.0.s390x.replies | 43 +
.../qemucapabilitiesdata/caps_2.8.0.s390x.xml | 15 +-
.../caps_2.8.0.x86_64.replies | 174 +
.../caps_2.8.0.x86_64.xml | 93 +-
.../caps_2.9.0.ppc64.replies | 118 +
.../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 572 +-
.../caps_2.9.0.s390x.replies | 48 +
.../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 274 +-
.../caps_2.9.0.x86_64.replies | 184 +
.../caps_2.9.0.x86_64.xml | 277 +-
.../caps_3.0.0.ppc64.replies | 148 +
.../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 594 +-
.../caps_3.0.0.riscv32.replies | 42 +
.../caps_3.0.0.riscv32.xml | 10 +-
.../caps_3.0.0.riscv64.replies | 42 +
.../caps_3.0.0.riscv64.xml | 10 +-
.../caps_3.0.0.s390x.replies | 68 +
.../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 302 +-
.../caps_3.0.0.x86_64.replies | 214 +
.../caps_3.0.0.x86_64.xml | 447 +-
.../caps_3.1.0.ppc64.replies | 153 +
.../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 597 +-
.../caps_3.1.0.x86_64.replies | 224 +
.../caps_3.1.0.x86_64.xml | 587 +-
.../caps_4.0.0.aarch64.replies | 347 +
.../caps_4.0.0.aarch64.xml | 346 +-
.../caps_4.0.0.ppc64.replies | 158 +
.../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 600 +-
.../caps_4.0.0.riscv32.replies | 42 +
.../caps_4.0.0.riscv32.xml | 10 +-
.../caps_4.0.0.riscv64.replies | 42 +
.../caps_4.0.0.riscv64.xml | 10 +-
.../caps_4.0.0.s390x.replies | 78 +
.../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 324 +-
.../caps_4.0.0.x86_64.replies | 224 +
.../caps_4.0.0.x86_64.xml | 583 +-
.../caps_4.1.0.x86_64.replies | 329 +
.../caps_4.1.0.x86_64.xml | 930 +-
.../caps_4.2.0.aarch64.replies | 556 +
.../caps_4.2.0.aarch64.xml | 358 +-
.../caps_4.2.0.ppc64.replies | 305 +-
.../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 611 +-
.../caps_4.2.0.s390x.replies | 22548 ++++++++++++++++
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 3359 +++
.../caps_4.2.0.x86_64.replies | 389 +
.../caps_4.2.0.x86_64.xml | 942 +-
tests/qemumonitorjsontest.c | 42 +-
...fault-cpu-kvm-virt-4.2.aarch64-latest.args | 38 +
.../aarch64-default-cpu-kvm-virt-4.2.xml | 20 +
...fault-cpu-tcg-virt-4.2.aarch64-latest.args | 39 +
.../aarch64-default-cpu-tcg-virt-4.2.xml | 20 +
.../disk-cache.x86_64-latest.args | 1 +
.../disk-cdrom-network.x86_64-latest.args | 1 +
.../disk-cdrom-tray.x86_64-latest.args | 1 +
.../disk-copy_on_read.x86_64-latest.args | 1 +
.../disk-detect-zeroes.x86_64-latest.args | 1 +
.../disk-floppy-q35-2_11.x86_64-latest.args | 1 +
.../disk-floppy-q35-2_9.x86_64-latest.args | 1 +
.../os-firmware-bios.x86_64-latest.args | 1 +
...os-firmware-efi-secboot.x86_64-latest.args | 1 +
.../os-firmware-efi.x86_64-latest.args | 1 +
...ault-cpu-kvm-pseries-2.7.ppc64-latest.args | 39 +
.../ppc64-default-cpu-kvm-pseries-2.7.xml | 22 +
...ault-cpu-kvm-pseries-3.1.ppc64-latest.args | 39 +
.../ppc64-default-cpu-kvm-pseries-3.1.xml | 22 +
...ault-cpu-kvm-pseries-4.2.ppc64-latest.args | 39 +
.../ppc64-default-cpu-kvm-pseries-4.2.xml | 22 +
...ault-cpu-tcg-pseries-2.7.ppc64-latest.args | 39 +
.../ppc64-default-cpu-tcg-pseries-2.7.xml | 22 +
...ault-cpu-tcg-pseries-3.1.ppc64-latest.args | 39 +
.../ppc64-default-cpu-tcg-pseries-3.1.xml | 22 +
...ault-cpu-tcg-pseries-4.2.ppc64-latest.args | 39 +
.../ppc64-default-cpu-tcg-pseries-4.2.xml | 22 +
...t-cpu-kvm-ccw-virtio-4.2.s390x-latest.args | 32 +
.../s390-default-cpu-kvm-ccw-virtio-4.2.xml | 16 +
...t-cpu-tcg-ccw-virtio-4.2.s390x-latest.args | 32 +
.../s390-default-cpu-tcg-ccw-virtio-4.2.xml | 16 +
.../tpm-emulator-tpm2-enc.x86_64-latest.args | 1 +
.../tpm-emulator-tpm2.x86_64-latest.args | 1 +
.../tpm-emulator.x86_64-latest.args | 1 +
.../tseg-explicit-size.x86_64-latest.args | 1 +
.../vhost-vsock-auto.x86_64-latest.args | 1 +
.../vhost-vsock.x86_64-latest.args | 1 +
...-default-cpu-kvm-pc-4.2.x86_64-latest.args | 37 +
.../x86_64-default-cpu-kvm-pc-4.2.xml | 24 +
...default-cpu-kvm-q35-4.2.x86_64-latest.args | 42 +
.../x86_64-default-cpu-kvm-q35-4.2.xml | 24 +
...-default-cpu-tcg-pc-4.2.x86_64-latest.args | 37 +
.../x86_64-default-cpu-tcg-pc-4.2.xml | 24 +
...default-cpu-tcg-q35-4.2.x86_64-latest.args | 42 +
.../x86_64-default-cpu-tcg-q35-4.2.xml | 24 +
tests/qemuxml2argvtest.c | 19 +
...efault-cpu-kvm-virt-4.2.aarch64-latest.xml | 38 +
...efault-cpu-tcg-virt-4.2.aarch64-latest.xml | 41 +
.../os-firmware-bios.x86_64-latest.xml | 3 +
.../os-firmware-efi-secboot.x86_64-latest.xml | 3 +
.../os-firmware-efi.x86_64-latest.xml | 3 +
...fault-cpu-kvm-pseries-2.7.ppc64-latest.xml | 48 +
...fault-cpu-kvm-pseries-3.1.ppc64-latest.xml | 48 +
...fault-cpu-kvm-pseries-4.2.ppc64-latest.xml | 48 +
...fault-cpu-tcg-pseries-2.7.ppc64-latest.xml | 48 +
...fault-cpu-tcg-pseries-3.1.ppc64-latest.xml | 48 +
...fault-cpu-tcg-pseries-4.2.ppc64-latest.xml | 48 +
...lt-cpu-kvm-ccw-virtio-4.2.s390x-latest.xml | 24 +
...lt-cpu-tcg-ccw-virtio-4.2.s390x-latest.xml | 26 +
.../tpm-emulator-tpm2-enc.x86_64-latest.xml | 3 +
.../tpm-emulator-tpm2.x86_64-latest.xml | 3 +
.../tpm-emulator.x86_64-latest.xml | 3 +
.../tpm-passthrough-crb.x86_64-latest.xml | 3 +
.../tpm-passthrough.x86_64-latest.xml | 3 +
...4-default-cpu-kvm-pc-4.2.x86_64-latest.xml | 40 +
...-default-cpu-kvm-q35-4.2.x86_64-latest.xml | 63 +
...4-default-cpu-tcg-pc-4.2.x86_64-latest.xml | 40 +
...-default-cpu-tcg-q35-4.2.x86_64-latest.xml | 63 +
tests/qemuxml2xmltest.c | 15 +
tests/testutilsqemu.c | 6 +-
tests/testutilsqemu.h | 1 +
176 files changed, 42397 insertions(+), 6735 deletions(-)
create mode 100644 tests/domaincapsdata/qemu_4.2.0.s390x.xml
create mode 100644 tests/qemucapabilitiesdata/caps_4.2.0.s390x.replies
create mode 100644 tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
create mode 100644
tests/qemuxml2argvdata/aarch64-default-cpu-kvm-virt-4.2.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/aarch64-default-cpu-kvm-virt-4.2.xml
create mode 100644
tests/qemuxml2argvdata/aarch64-default-cpu-tcg-virt-4.2.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/aarch64-default-cpu-tcg-virt-4.2.xml
create mode 100644
tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-2.7.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-2.7.xml
create mode 100644
tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-3.1.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-3.1.xml
create mode 100644
tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-4.2.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-4.2.xml
create mode 100644
tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-2.7.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-2.7.xml
create mode 100644
tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-3.1.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-3.1.xml
create mode 100644
tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-4.2.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-4.2.xml
create mode 100644
tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-4.2.s390x-latest.args
create mode 100644 tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-4.2.xml
create mode 100644
tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-4.2.s390x-latest.args
create mode 100644 tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-4.2.xml
create mode 100644
tests/qemuxml2argvdata/x86_64-default-cpu-kvm-pc-4.2.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-kvm-pc-4.2.xml
create mode 100644
tests/qemuxml2argvdata/x86_64-default-cpu-kvm-q35-4.2.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-kvm-q35-4.2.xml
create mode 100644
tests/qemuxml2argvdata/x86_64-default-cpu-tcg-pc-4.2.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-tcg-pc-4.2.xml
create mode 100644
tests/qemuxml2argvdata/x86_64-default-cpu-tcg-q35-4.2.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-tcg-q35-4.2.xml
create mode 100644
tests/qemuxml2xmloutdata/aarch64-default-cpu-kvm-virt-4.2.aarch64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/aarch64-default-cpu-tcg-virt-4.2.aarch64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/ppc64-default-cpu-kvm-pseries-2.7.ppc64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/ppc64-default-cpu-kvm-pseries-3.1.ppc64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/ppc64-default-cpu-kvm-pseries-4.2.ppc64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/ppc64-default-cpu-tcg-pseries-2.7.ppc64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/ppc64-default-cpu-tcg-pseries-3.1.ppc64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/ppc64-default-cpu-tcg-pseries-4.2.ppc64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-4.2.s390x-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/s390-default-cpu-tcg-ccw-virtio-4.2.s390x-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/x86_64-default-cpu-kvm-pc-4.2.x86_64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/x86_64-default-cpu-kvm-q35-4.2.x86_64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/x86_64-default-cpu-tcg-pc-4.2.x86_64-latest.xml
create mode 100644
tests/qemuxml2xmloutdata/x86_64-default-cpu-tcg-q35-4.2.x86_64-latest.xml
--
2.23.0