[pve-devel] [PATCH qemu-server v2 8/8] api: qemu machine capabilities: add description for pveX variants
Fiona Ebner
f.ebner at proxmox.com
Fri Apr 4 14:04:45 CEST 2025
Am 07.03.25 um 15:44 schrieb Dominik Csapak:
> 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.',
Style nit: line too long.
> + },
> },
> },
> },
> @@ -67,6 +72,10 @@ __PACKAGE__->register_method({
> version => $version,
> };
>
> + if (my $description = PVE::QemuServer::Machine::get_pve_version_description($version)) {
Style nit: line too long. Maybe have the function call be its own line
and then test the variable (can also be post-if then).
> + $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,
More information about the pve-devel
mailing list