introduce 'pve-storage-image-format' standard option for image format

The new 'pve-storage-image-format' standard option uses a simple enum
instead of a subroutine verifier. Since the 'pve-storage-format'
format that is replaced by it was used in pve-guest-common's
StorageTunnel, the format cannot be removed without a versioned
breaks.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fiona Ebner
2025-03-05 11:49:22 +01:00
committed by Thomas Lamprecht
parent 559867f79b
commit 2569cb4604
3 changed files with 36 additions and 8 deletions

View File

@ -184,11 +184,10 @@ my $defaultData = {
type => 'string', format => 'pve-storage-path',
optional => 1,
},
'format' => {
format => get_standard_option('pve-storage-image-format', {
description => "Default image format.",
type => 'string', format => 'pve-storage-format',
optional => 1,
},
}),
preallocation => {
description => "Preallocation mode for raw and qcow2 images. " .
"Using 'metadata' on raw images results in preallocation=off.",
@ -342,6 +341,10 @@ sub verify_content {
return $ct;
}
# NOTE the 'pve-storage-format' is deprecated, use the 'pve-storage-image-format' standard option
# from Storage/Common.pm instead
# TODO PVE 9 - remove after doing a versioned breaks for pve-guest-common, which was using this
# format.
PVE::JSONSchema::register_format('pve-storage-format', \&verify_format);
sub verify_format {
my ($fmt, $noerr) = @_;