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 --- 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 (31): tests: Add capabilities for QEMU 4.2.0 on s390x domcapstest: Add test case for QEMU 4.2.0 on s390x 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 VIR_AUTOPTR in qemuMonitorJSONGetCPUDefinitions qemu: Change return type of virQEMUCapsFetchCPUDefinitions qemu: Introduce qemuMonitorCPUDefs struct qemu: Flatten qemuMonitorCPUDefs.cpus build: Export virStringListCopy internal API qemu: Add qemuMonitorCPUDefsCopy qemu: Use VIR_AUTOFREE in virQEMUCapsLoadCPUModels 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: Probe for default CPU types qemu: Introduce virQEMUCapsGetMachineDefaultCPU qemu: Drop unused virQEMUCapsGetDefaultMachine qemu: Use VIR_AUTOUNREF in qemuDomainDefPostParse conf: Define VIR_AUTOPTR for virCPUDef 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 | 8 - src/libvirt_private.syms | 3 +- src/qemu/qemu_capabilities.c | 358 +- src/qemu/qemu_capabilities.h | 15 +- src/qemu/qemu_domain.c | 84 +- src/qemu/qemu_driver.c | 4 +- src/qemu/qemu_monitor.c | 74 +- src/qemu/qemu_monitor.h | 18 +- src/qemu/qemu_monitor_json.c | 82 +- src/qemu/qemu_monitor_json.h | 2 +- src/qemu/qemu_process.c | 24 +- tests/cputest.c | 7 +- .../domaincapsschemadata/qemu_4.2.0.s390x.xml | 202 + tests/domaincapstest.c | 4 + .../caps_2.10.0.aarch64.xml | 126 +- .../caps_2.10.0.ppc64.xml | 512 +- .../caps_2.10.0.s390x.xml | 264 +- .../caps_2.10.0.x86_64.xml | 132 +- .../caps_2.11.0.s390x.xml | 264 +- .../caps_2.11.0.x86_64.xml | 136 +- .../caps_2.12.0.aarch64.xml | 136 +- .../caps_2.12.0.ppc64.xml | 516 +- .../caps_2.12.0.s390x.xml | 264 +- .../caps_2.12.0.x86_64.xml | 180 +- .../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 512 +- .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 256 +- .../caps_2.9.0.x86_64.xml | 128 +- .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 516 +- .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 272 +- .../caps_3.0.0.x86_64.xml | 184 +- .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 516 +- .../caps_3.1.0.x86_64.xml | 196 +- .../caps_4.0.0.aarch64.xml | 148 +- .../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 516 +- .../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 284 +- .../caps_4.0.0.x86_64.xml | 196 +- .../caps_4.1.0.x86_64.xml | 400 +- .../caps_4.2.0.aarch64.xml | 242 +- .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 574 +- .../caps_4.2.0.s390x.replies | 22414 ++++++++++++++++ .../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 3345 +++ .../caps_4.2.0.x86_64.xml | 492 +- tests/qemumonitorjsontest.c | 38 +- ...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 | 38 + .../ppc64-default-cpu-kvm-pseries-2.7.xml | 22 + ...ault-cpu-kvm-pseries-3.1.ppc64-latest.args | 38 + .../ppc64-default-cpu-kvm-pseries-3.1.xml | 22 + ...ault-cpu-kvm-pseries-4.2.ppc64-latest.args | 38 + .../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 | 31 + .../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 | 15 + ...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 | 45 + ...fault-cpu-kvm-pseries-3.1.ppc64-latest.xml | 45 + ...fault-cpu-kvm-pseries-4.2.ppc64-latest.xml | 45 + ...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 | 23 + ...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 + 113 files changed, 31926 insertions(+), 4317 deletions(-) create mode 100644 tests/domaincapsschemadata/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 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list