api: status: rely on get_formats() method for determining format-related info

Rely on get_formats() rather than just the static plugin data in the
'status' API call. This removes the need for the special casing for
LVM storages without the 'snapshot-as-volume-chain' option. It also
fixes the issue that the 'format' storage configuration option to
override the default format was previously ignored there.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner
2025-07-21 14:10:49 +02:00
committed by Wolfgang Bumiller
parent dd2efb7846
commit ad20e4faef
2 changed files with 3 additions and 8 deletions

View File

@ -220,12 +220,6 @@ __PACKAGE__->register_method({
$data->{used_fraction} = ($data->{used} // 0) / $data->{total};
}
# TODO: add support to the storage plugin system to allow returing different supported
# formats depending on the storage config instead, this is just a stop gap!
if (lc($data->{type}) eq 'lvm') {
$data->{format}->[0]->{qcow2} = 0 if !$scfg->{'snapshot-as-volume-chain'};
}
$res->{$storeid} = $data;
}

View File

@ -1511,9 +1511,10 @@ sub storage_info {
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
if ($includeformat) {
my $formats = $plugin->get_formats($scfg, $storeid);
$info->{$storeid}->{format} = [$formats->{valid}, $formats->{default}];
my $pd = $plugin->plugindata();
$info->{$storeid}->{format} = $pd->{format}
if $pd->{format};
$info->{$storeid}->{select_existing} = $pd->{select_existing}
if $pd->{select_existing};
}