public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 4/9] api: status: rely on get_formats() method for determining format-related info
Date: Mon, 21 Jul 2025 14:10:49 +0200	[thread overview]
Message-ID: <20250721121124.77526-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250721121124.77526-1-f.ebner@proxmox.com>

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>
---
 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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-07-21 12:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 12:10 [pve-devel] [PATCH-SERIES storage/qemu-server 0/9] storage configuration-dependent format info Fiona Ebner
2025-07-21 12:10 ` [pve-devel] [PATCH storage 1/9] api change log: improve style consistency a bit Fiona Ebner
2025-07-21 12:10 ` [pve-devel] [PATCH storage 2/9] plugin: add get_formats() method and use it instead of default_format() Fiona Ebner
2025-07-22 12:13   ` Wolfgang Bumiller
2025-07-21 12:10 ` [pve-devel] [PATCH storage 3/9] lvm plugin: implement get_formats() method Fiona Ebner
2025-07-21 12:10 ` Fiona Ebner [this message]
2025-07-21 12:10 ` [pve-devel] [PATCH storage 5/9] introduce resolve_format_hint() helper Fiona Ebner
2025-07-21 12:10 ` [pve-devel] [PATCH storage 6/9] default format helper: only return default format Fiona Ebner
2025-07-21 12:10 ` [pve-devel] [PATCH qemu-server 7/9] make tidy Fiona Ebner
2025-07-21 12:10 ` [pve-devel] [PATCH qemu-server 8/9] resolve destination disk format helper: drop unused variable Fiona Ebner
2025-07-21 12:10 ` [pve-devel] [PATCH qemu-server 9/9] use storage layer's resolve_format_hint() helper where appropriate Fiona Ebner
2025-07-21 16:26 ` [pve-devel] [PATCH-SERIES storage/qemu-server 0/9] storage configuration-dependent format info Max R. Carrara
2025-07-22 13:03 ` [pve-devel] applied-series: " Wolfgang Bumiller
2025-07-22 14:17   ` Max R. Carrara
2025-07-23 11:49     ` Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250721121124.77526-5-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal