Suppose we are taking a snapshot of VM 100's disk-0. The dir_glob_foreach runs over $path=/subvolume/images/100, lists all snapshot names and appends their names to the path of the disk, e.g. /subvolume/images/vm-100-disk-0@SNAP_NAME, but the original directory $path might contain a second disk `vm-100-disk-1` which is also listed by the dir_glib_foreach.
By using the helper we only iterate over the snapshots of the guest. Signed-off-by: Maximiliano Sandoval <m.sando...@proxmox.com> --- src/PVE/Storage/BTRFSPlugin.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm index e5c3e08..8f4691b 100644 --- a/src/PVE/Storage/BTRFSPlugin.pm +++ b/src/PVE/Storage/BTRFSPlugin.pm @@ -796,8 +796,9 @@ sub volume_export { if (ref($with_snapshots) eq 'ARRAY') { push @$cmd, (map { "$path\@$_" } ($with_snapshots // [])->@*), $path; } else { - dir_glob_foreach(dirname($path), $BTRFS_VOL_REGEX, sub { - push @$cmd, "$path\@$_[2]" if !(defined($snapshot) && $_[2] eq $snapshot); + foreach_snapshot_of_subvol($path, sub { + my ($snap_name) = @_; + push @$cmd, "$path\@$snap_name" if !(defined($snapshot) && $snap_name eq $snapshot); }); } $path .= "\@$snapshot" if defined($snapshot); -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel