[pve-devel] [PATCH qemu-server v3 8/8] api: qemu machine capabilities: add description for pveX variants

Dominik Csapak d.csapak at proxmox.com
Fri Apr 4 14:53:44 CEST 2025


and retroactively add descriptions for previous bumps.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v2:
* added additional sentence to new machine model description

 PVE/API2/Qemu/Machine.pm  |  9 +++++++++
 PVE/QemuServer/Machine.pm | 15 +++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/PVE/API2/Qemu/Machine.pm b/PVE/API2/Qemu/Machine.pm
index bbd814f0..83145f89 100644
--- a/PVE/API2/Qemu/Machine.pm
+++ b/PVE/API2/Qemu/Machine.pm
@@ -46,6 +46,12 @@ __PACKAGE__->register_method({
 		    type => 'string',
 		    description => "The machine version.",
 		},
+		description => {
+		    type => 'string',
+		    optional => 1,
+		    description => 'Notable changes that version introduces, only used for +pveX"
+			." versions.',
+		},
 	    },
 	},
     },
@@ -67,6 +73,9 @@ __PACKAGE__->register_method({
 			version => $version,
 		    };
 
+		    my $desc = PVE::QemuServer::Machine::get_pve_version_description($version);
+		    $entry->{description} = $desc if defined($desc);
+
 		    push $to_add->@*, $entry;
 		}
 	    }
diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
index 47667aac..2056aad0 100644
--- a/PVE/QemuServer/Machine.pm
+++ b/PVE/QemuServer/Machine.pm
@@ -15,6 +15,21 @@ our $PVE_MACHINE_VERSION = {
     '9.2' => 1,
 };
 
+# When bumping the pveX version, add a description why.
+my $PVE_MACHINE_VERSION_DESCRIPTIONS = {
+    '4.1+pve1' => 'Introduction of pveX versioning, no changes.',
+    '4.1+pve2' => 'Increases supported SCSI drive count.',
+    '9.2+pve1' => 'Disables S3/S4 power states. These are often problematic in virtualized guests.',
+};
+
+# returns the description of a given machine version with pve version, e.g. 9.2+pve1 or undef if
+# there is none
+sub get_pve_version_description {
+    my ($version) = @_;
+
+    return $PVE_MACHINE_VERSION_DESCRIPTIONS->{$version};
+}
+
 my $machine_fmt = {
     type => {
 	default_key => 1,
-- 
2.39.5





More information about the pve-devel mailing list