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

Dominik Csapak d.csapak at proxmox.com
Fri Mar 7 15:44:35 CET 2025


and retroactively add descriptions for previous bumps.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
new in v2
 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 11eba34b..d9aaa6af 100644
--- a/PVE/API2/Qemu/Machine.pm
+++ b/PVE/API2/Qemu/Machine.pm
@@ -46,6 +46,11 @@ __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 +72,10 @@ __PACKAGE__->register_method({
 			version => $version,
 		    };
 
+		    if (my $description = PVE::QemuServer::Machine::get_pve_version_description($version)) {
+			$entry->{description} = $description;
+		    }
+
 		    push $to_add->@*, $entry;
 		}
 	    }
diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
index 9864d401..f4b2d099 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.',
+};
+
+# 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