On 3/6/25 15:32, Fiona Ebner wrote:
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.
sure>
+
+ # 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.
if we'd do that, we'd automatically get the newest pve version for the windows
workaround in
get_vm_machine, which is the reverse you suggested IIUC ? (e.g. use pve0 in
that case)
and using a parameter to control that seem weird for this one call...
+
+ $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