On 11/19/19 10:13 AM, Fabian Ebner wrote:
When 'content_types' included both 'images' and 'rootdir', a single volume
could appear twice in the volume list. This also fixes the same kind of
duplication in 'pvesm list'.

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

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 88da231..5ce3ef8 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -937,6 +937,7 @@ sub list_volumes {
      my ($class, $storeid, $scfg, $vmid, $content_types) = @_;
my $res = [];
+    my $seen = {};
foreach my $ct (@$content_types) {
        my $data;
@@ -960,8 +961,11 @@ sub list_volumes {
        next if !$data;
foreach my $item (@$data) {
-           $item->{content} = $ct;
-           push @$res, $item;
+           if (!$seen->{$item->{volid}}) {
+               $seen->{$item->{volid}} = 1;
+               $item->{content} = $ct;
+               push @$res, $item;
+           }
        }
      }

Please just ignore this. Tim already sent a patch which also sets $item->{content} to the correct value, while mine doesn't.

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

Reply via email to