[pve-devel] [PATCH qemu-server v3 08/18] move get_installed_machine_version() helper to machine module

Fiona Ebner f.ebner at proxmox.com
Fri Jan 17 13:08:07 CET 2025


Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer.pm         | 9 +--------
 PVE/QemuServer/Machine.pm | 7 +++++++
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 82795767..ee7bb017 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3271,13 +3271,6 @@ sub vga_conf_has_spice {
     return $1 || 1;
 }
 
-sub get_installed_machine_version {
-    my ($kvmversion) = @_;
-    $kvmversion = kvm_user_version() if !defined($kvmversion);
-    $kvmversion =~ m/^(\d+\.\d+)/;
-    return $1;
-}
-
 sub windows_get_pinned_machine_version {
     my ($machine, $base_version, $kvmversion) = @_;
 
@@ -3285,7 +3278,7 @@ sub windows_get_pinned_machine_version {
     if (!defined($base_version) ||
 	!PVE::QemuServer::Machine::can_run_pve_machine_version($base_version, $kvmversion)
     ) {
-	$pin_version = get_installed_machine_version($kvmversion);
+	$pin_version = PVE::QemuServer::Machine::get_installed_machine_version($kvmversion);
     }
     if (!$machine || $machine eq 'pc') {
 	$machine = "pc-i440fx-$pin_version";
diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
index 5a039244..075554f4 100644
--- a/PVE/QemuServer/Machine.pm
+++ b/PVE/QemuServer/Machine.pm
@@ -186,4 +186,11 @@ sub qemu_machine_pxe {
     return $machine;
 }
 
+sub get_installed_machine_version {
+    my ($kvmversion) = @_;
+    $kvmversion = PVE::QemuServer::Helpers::kvm_user_version() if !defined($kvmversion);
+    $kvmversion =~ m/^(\d+\.\d+)/;
+    return $1;
+}
+
 1;
-- 
2.39.5





More information about the pve-devel mailing list