when we don't have a specific machine version on a windows guest, we use
the creation meta info to pin the machine version. Currently we always
append the pve machine version from the current installed kvm version,
which is not necessarily the version we pinned the guest to.

Instead, use either the info from the creation meta info if it exists,
or use 'pve0'.

For non-windows machines, we used the current QEMU machine version so we
should use the pve machine version from that too.

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 PVE/QemuServer/Machine.pm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
index f1acde8f..e3da8e21 100644
--- a/PVE/QemuServer/Machine.pm
+++ b/PVE/QemuServer/Machine.pm
@@ -237,14 +237,19 @@ sub get_vm_machine {
                if 
(PVE::QemuServer::Helpers::min_version($meta->{'creation-qemu'}, 9, 1)) {
                    # need only major.minor
                    ($base_version) = ($meta->{'creation-qemu'} =~ 
m/^(\d+.\d+)/);
+                   # append pve machine version if we have one
+                   if (my $pvever = $meta->{'creation-pve-machine'}) {
+                       $base_version .= "+pve$pvever"
+                   }
                }
            }
            $machine = windows_get_pinned_machine_version($machine, 
$base_version, $kvmversion);
+       } else{
+           $arch //= 'x86_64';
+           $machine ||= default_machine_for_arch($arch);
+           my $pvever = get_pve_version($kvmversion);
+           $machine .= "+pve$pvever";
        }
-       $arch //= 'x86_64';
-       $machine ||= default_machine_for_arch($arch);
-       my $pvever = get_pve_version($kvmversion);
-       $machine .= "+pve$pvever";
     }
 
     if ($machine !~ m/\+pve\d+?(?:\.pxe)?$/) {
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to