[pve-devel] [PATCH qemu-server 4/4] cpu config: Unify the default value for 'kvm'

Fiona Ebner f.ebner at proxmox.com
Mon Feb 19 15:47:26 CET 2024

Am 19.12.23 um 10:40 schrieb Filip Schauer:
> Make the default value for 'kvm' consistent and take into account
> whether the VM will run on the same CPU architecture as the host. This
> is a breaking change for VMs with a different CPU architecture running
> on an x86_64 host, since in this case the default CPU type for
> CPU hotplug switches from 'kvm64' to 'qemu64'.

On an x86_64 host, for guests using a different architecture (i.e.
aarch64), hot-plugging is already broken, because we try to hotplug a
CPU of type "$cpu-x86_64-cpu,XYZ" which won't work anyways:

vcpus: hotplug problem - VM 130 qmp command 'device_add' failed -
'kvm64-x86_64-cpu' is not a valid device model name

The actual breaking change is for the host arch being something other
than x86_64 (which isn't officially supported) and the VM being x86_64, ...

> @@ -414,9 +415,9 @@ sub get_custom_model {
>  # Print a QEMU device node for a given VM configuration for hotplugging CPUs
>  sub print_cpu_device {
> -    my ($conf, $id) = @_;
> +    my ($conf, $arch, $id) = @_;
> -    my $kvm = $conf->{kvm} // 1;
> +    my $kvm = $conf->{kvm} // is_native($arch);
>      my $cpu = get_default_cpu_type('x86_64', $kvm);

...because in that case, before this patch we got kvm64 here, but with
the patch we get qemu64 which would be a problem for live-migration.

>      if (my $cputype = $conf->{cpu}) {
>  	my $cpuconf = PVE::JSONSchema::parse_property_string('pve-vm-cpu-conf', $cputype)

More information about the pve-devel mailing list