by only including filenames that are also valid when actually parsing them,
things like snapshot files or files not following our naming scheme are no
longer candidates for rescanning or included in other output.

Co-authored-by: Shannon Sterz <s.st...@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>
---
 src/PVE/Storage/Plugin.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index c08f5a5..affe7b0 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1555,6 +1555,10 @@ sub list_images {
 
         next if !$vollist && defined($vmid) && ($owner ne $vmid);
 
+        # skip files that are snapshots or have invalid names
+        my ($parsed_name) = eval { parse_name_dir(basename($fn)) };
+        next if !defined($parsed_name);
+
         my ($size, undef, $used, $parent, $ctime) = eval { file_size_info($fn, 
undef, $format); };
         if (my $err = $@) {
             die $err if $err !~ m/Image is not in \S+ format$/;
-- 
2.39.5



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

Reply via email to