introduce resolve_format_hint() helper

Callers interested in the list of valid formats from
storage_default_format() actually want this functionality.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner
2025-07-21 14:10:50 +02:00
committed by Wolfgang Bumiller
parent ad20e4faef
commit c86d8f6d80

View File

@ -1681,6 +1681,17 @@ sub storage_default_format {
wantarray ? ($formats->{default}, [sort keys $formats->{valid}->%*]) : $formats->{default};
}
sub resolve_format_hint {
my ($cfg, $storeid, $format_hint) = @_;
my $scfg = storage_config($cfg, $storeid);
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
my $formats = $plugin->get_formats($scfg, $storeid);
return $format_hint if $format_hint && $formats->{valid}->{$format_hint};
return $formats->{default};
}
sub vgroup_is_used {
my ($cfg, $vgname) = @_;