]> xenbits.xensource.com Git - libvirt.git/commit
qemu: Store default CPU in domain XML
authorJiri Denemark <jdenemar@redhat.com>
Thu, 26 Sep 2019 16:42:02 +0000 (18:42 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 20 Nov 2019 16:22:07 +0000 (17:22 +0100)
commit5e939cea896fb3373a6f68f86e325c657429ed3d
treef7d8219fb4dbf305ca8ce215efd987b5da92648b
parent4a79d391b56180e011c0c028d071b67c8949bd35
qemu: Store default CPU in domain XML

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.

Architecture specific notes
- aarch64: We only set the default CPU for TCG domains as KVM requires
  explicit "-cpu host" to work.

- ppc64: The default CPU for KVM is "host" thanks to some hacks in QEMU,
  we will translate the default model to the model corresponding to the
  host CPU ("POWER8" on a Power8 host, "POWER9" on Power9 host, etc.).
  This is not a problem as the corresponding CPU model is in fact an
  alias for "host". This is probably not ideal, but it's not wrong and
  the default virtual CPU configured by libvirt is the same QEMU would
  use. TCG uses various CPU models depending on machine type and its
  version.

- s390x: The default CPU for KVM is "host" while TCG defaults to "qemu".

- x86_64: The default CPU model (qemu64) is not runnable on any host
  with KVM, but QEMU just disables unavailable features and starts
  happily.

https://bugzilla.redhat.com/show_bug.cgi?id=1598151
https://bugzilla.redhat.com/show_bug.cgi?id=1598162

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
51 files changed:
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/aarch64-default-cpu-tcg-virt-4.2.aarch64-latest.args
tests/qemuxml2argvdata/disk-cache.x86_64-latest.args
tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args
tests/qemuxml2argvdata/disk-cdrom-tray.x86_64-latest.args
tests/qemuxml2argvdata/disk-copy_on_read.x86_64-latest.args
tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-latest.args
tests/qemuxml2argvdata/disk-floppy-q35-2_11.x86_64-latest.args
tests/qemuxml2argvdata/disk-floppy-q35-2_9.x86_64-latest.args
tests/qemuxml2argvdata/os-firmware-bios.x86_64-latest.args
tests/qemuxml2argvdata/os-firmware-efi-secboot.x86_64-latest.args
tests/qemuxml2argvdata/os-firmware-efi.x86_64-latest.args
tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-2.7.ppc64-latest.args
tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-3.1.ppc64-latest.args
tests/qemuxml2argvdata/ppc64-default-cpu-kvm-pseries-4.2.ppc64-latest.args
tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-2.7.ppc64-latest.args
tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-3.1.ppc64-latest.args
tests/qemuxml2argvdata/ppc64-default-cpu-tcg-pseries-4.2.ppc64-latest.args
tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-4.2.s390x-latest.args
tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-4.2.s390x-latest.args
tests/qemuxml2argvdata/tpm-emulator-tpm2-enc.x86_64-latest.args
tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.args
tests/qemuxml2argvdata/tpm-emulator.x86_64-latest.args
tests/qemuxml2argvdata/tseg-explicit-size.x86_64-latest.args
tests/qemuxml2argvdata/vhost-vsock-auto.x86_64-latest.args
tests/qemuxml2argvdata/vhost-vsock.x86_64-latest.args
tests/qemuxml2argvdata/x86_64-default-cpu-kvm-pc-4.2.x86_64-latest.args
tests/qemuxml2argvdata/x86_64-default-cpu-kvm-q35-4.2.x86_64-latest.args
tests/qemuxml2argvdata/x86_64-default-cpu-tcg-pc-4.2.x86_64-latest.args
tests/qemuxml2argvdata/x86_64-default-cpu-tcg-q35-4.2.x86_64-latest.args
tests/qemuxml2xmloutdata/aarch64-default-cpu-tcg-virt-4.2.aarch64-latest.xml
tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml
tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml
tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml
tests/qemuxml2xmloutdata/ppc64-default-cpu-kvm-pseries-2.7.ppc64-latest.xml
tests/qemuxml2xmloutdata/ppc64-default-cpu-kvm-pseries-3.1.ppc64-latest.xml
tests/qemuxml2xmloutdata/ppc64-default-cpu-kvm-pseries-4.2.ppc64-latest.xml
tests/qemuxml2xmloutdata/ppc64-default-cpu-tcg-pseries-2.7.ppc64-latest.xml
tests/qemuxml2xmloutdata/ppc64-default-cpu-tcg-pseries-3.1.ppc64-latest.xml
tests/qemuxml2xmloutdata/ppc64-default-cpu-tcg-pseries-4.2.ppc64-latest.xml
tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-4.2.s390x-latest.xml
tests/qemuxml2xmloutdata/s390-default-cpu-tcg-ccw-virtio-4.2.s390x-latest.xml
tests/qemuxml2xmloutdata/tpm-emulator-tpm2-enc.x86_64-latest.xml
tests/qemuxml2xmloutdata/tpm-emulator-tpm2.x86_64-latest.xml
tests/qemuxml2xmloutdata/tpm-emulator.x86_64-latest.xml
tests/qemuxml2xmloutdata/tpm-passthrough-crb.x86_64-latest.xml
tests/qemuxml2xmloutdata/tpm-passthrough.x86_64-latest.xml
tests/qemuxml2xmloutdata/x86_64-default-cpu-kvm-pc-4.2.x86_64-latest.xml
tests/qemuxml2xmloutdata/x86_64-default-cpu-kvm-q35-4.2.x86_64-latest.xml
tests/qemuxml2xmloutdata/x86_64-default-cpu-tcg-pc-4.2.x86_64-latest.xml
tests/qemuxml2xmloutdata/x86_64-default-cpu-tcg-q35-4.2.x86_64-latest.xml