Am 06.03.25 um 11:44 schrieb Dominik Csapak:
> When creating or updating guests with ostype windows, we want to pin the
> machine version to a specific one. Since introduction of that feature,
> we never bumped the pve machine version, so this was missing.
> 
> Append the pve machine version if it's not 0 so we don't add that
> unnecessarily.
> 
> Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
> ---
>  PVE/QemuServer/Machine.pm | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
> index e3da8e21..ebaf2dcc 100644
> --- a/PVE/QemuServer/Machine.pm
> +++ b/PVE/QemuServer/Machine.pm
> @@ -274,7 +274,17 @@ sub check_and_pin_machine_string {
>      if (!$machine || $machine =~ m/^(?:pc|q35|virt)$/) {
>       # always pin Windows' machine version on create, they get confused too 
> easily
>       if (PVE::QemuServer::Helpers::windows_version($ostype)) {
> -         $machine_conf->{type} = 
> windows_get_pinned_machine_version($machine);
> +         my $kvmversion = PVE::QemuServer::Helpers::kvm_user_version();
> +         my $pin_version = get_installed_machine_version($kvmversion);

Nit: I'd call this $base_version like the argument it's passed-in as.
It's not necessarily the version that is going to be pinned.

> +
> +         # pin to the current pveX version to make use of most current 
> features if > 0
> +         my $pvever = get_pve_version($kvmversion);
> +         if ($pvever > 0) {
> +             $pin_version .= "+pve$pvever";
> +         }

I feel this logic should go into windows_get_pinned_machine_version()
itself.

> +
> +         $machine_conf->{type} = 
> windows_get_pinned_machine_version($machine, $pin_version, $kvmversion);
> +
>           print "pinning machine type to '$machine_conf->{type}' for Windows 
> guest OS\n";
>       }
>      }



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

Reply via email to