[pve-devel] [PATCH storage 4/9] api: status: rely on get_formats() method for determining format-related info
Fiona Ebner
f.ebner at proxmox.com
Mon Jul 21 14:10:49 CEST 2025
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 at proxmox.com>
---
src/PVE/API2/Storage/Status.pm | 6 ------
src/PVE/Storage.pm | 5 +++--
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/PVE/API2/Storage/Status.pm b/src/PVE/API2/Storage/Status.pm
index 25933f8..c172073 100644
--- a/src/PVE/API2/Storage/Status.pm
+++ b/src/PVE/API2/Storage/Status.pm
@@ -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;
}
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index 1faf893..3286144 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -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};
}
--
2.47.2
More information about the pve-devel
mailing list