[pve-devel] [PATCH qemu-server] Simplify QEMU version check and require 3.0+
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Feb 10 11:45:36 CET 2020
On 2/10/20 11:31 AM, Stefan Reiter wrote:
> Some of the recent QMP changes require at least 2.12.0, but since the
> oldest version we officially package for 6.x is 4.0.0 anyway, checking
> for at least 3.0 should not break anyone's setup.
>
> Note that this does not affect machine version checks, only the
> installed QEMU binary version.
>
> Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> ---
>
> Previous minimum was 0.15, but I have a feeling that even if you managed to
> install QEMU 0.15 somehow, it wouldn't have worked anyway.
>
> 3.0 is a reasonable requirement IMO, although technically 2.12 would probably
> work too, if there's a use-case for using such an outdated QEMU.
>
> PVE/QemuServer.pm | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 318ee54..de09d90 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -3405,7 +3405,6 @@ sub config_to_command {
> my $devices = [];
> my $pciaddr = '';
> my $bridges = {};
> - my $vernum = 0; # unknown
> my $ostype = $conf->{ostype};
> my $winversion = windows_version($ostype);
> my $kvm = $conf->{kvm};
> @@ -3415,6 +3414,11 @@ sub config_to_command {
> my $kvm_binary = get_command_for_arch($arch);
> my $kvmver = kvm_user_version($kvm_binary);
>
> + $kvmver =~ m/^(\d+)\.(\d+)/;
> + if ($1 < 3) {
> + die "Detected old QEMU binary ('$kvmver', at least 3.0 is required)\n";
> + }
this is a slight change in behavior though, previously we died if the regex did not
match, as $vernum defaulted to zero and thus was < 15000. Now we do not anymore,
(kvm_user_version does not die on failed detection)
Maybe:
my (undef, $vmajor, $vminor) = $kvmver =~ m/^(\d+)\.(\d+)/;
if (!$vmajor || $vmajor < 3) {
die ...
> +
> my $add_pve_version = min_version($kvmver, 4, 1);
>
> my $machine_type = get_vm_machine($conf, $forcemachine, $arch, $add_pve_version);
> @@ -3430,14 +3434,6 @@ sub config_to_command {
> if !defined kvm_version();
> }
>
> - if ($kvmver =~ m/^(\d+)\.(\d+)$/) {
> - $vernum = $1*1000000+$2*1000;
> - } elsif ($kvmver =~ m/^(\d+)\.(\d+)\.(\d+)$/) {
> - $vernum = $1*1000000+$2*1000+$3;
> - }
> -
> - die "detected old qemu-kvm binary ($kvmver)\n" if $vernum < 15000;
> -
> my $q35 = PVE::QemuServer::Machine::machine_type_is_q35($conf);
> my $hotplug_features = parse_hotplug_features(defined($conf->{hotplug}) ? $conf->{hotplug} : '1');
> my $use_old_bios_files = undef;
>
More information about the pve-devel
mailing list