all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 2/4] vdisk list: allow specifying content type
Date: Mon, 22 Mar 2021 15:32:41 +0100	[thread overview]
Message-ID: <20210322143243.6606-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210322143243.6606-1-f.ebner@proxmox.com>

and only scan storages that support it if specified.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/Storage.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 19f675d..eaa86fb 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -932,7 +932,7 @@ sub vdisk_free {
 }
 
 sub vdisk_list {
-    my ($cfg, $storeid, $vmid, $vollist) = @_;
+    my ($cfg, $storeid, $vmid, $vollist, $ctype) = @_;
 
     my $ids = $cfg->{ids};
 
@@ -955,6 +955,7 @@ sub vdisk_list {
 	    next if $storeid && $storeid ne $sid;
 	    next if !storage_check_enabled($cfg, $sid, undef, 1);
 	    my $content = $ids->{$sid}->{content};
+	    next if defined($ctype) && !$content->{$ctype};
 	    next if !($content->{rootdir} || $content->{images});
 	    push @$storage_list, $sid;
 	}
@@ -965,7 +966,9 @@ sub vdisk_list {
     activate_storage_list($cfg, $storage_list, $cache);
 
     # FIXME PVE 7.0: only scan storages with the correct content types
-    foreach my $sid (keys %$ids) {
+    my $scan = defined($ctype) ? $storage_list : [ keys %{$ids} ];
+
+    foreach my $sid (@{$scan}) {
 	next if $storeid && $storeid ne $sid;
 	next if !storage_check_enabled($cfg, $sid, undef, 1);
 
-- 
2.20.1





  reply	other threads:[~2021-03-22 14:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 14:32 [pve-devel] [PATCH storage 1/4] Revert "vdisk list: only collect images from storages with an appropriate content type" Fabian Ebner
2021-03-22 14:32 ` Fabian Ebner [this message]
2021-03-31  8:26   ` [pve-devel] applied: [PATCH storage 2/4] vdisk list: allow specifying content type Thomas Lamprecht
2021-03-22 14:32 ` [pve-devel] [PATCH container 3/4] filter by content type when using vdisk_list Fabian Ebner
2021-04-18 16:05   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-22 14:32 ` [pve-devel] [PATCH qemu-server 4/4] " Fabian Ebner
2021-04-18 16:05   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-31  8:26 ` [pve-devel] applied: [PATCH storage 1/4] Revert "vdisk list: only collect images from storages with an appropriate content type" Thomas Lamprecht

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=20210322143243.6606-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal