[pve-devel] [PATCH storage] zfs: sorted snapshot list: use -r parameter

Fabian Ebner f.ebner at proxmox.com
Mon Jan 10 10:34:00 CET 2022


Some versions of ZFS do not automatically display the child snapshots
when '-t snapshot' is used, but require '-r' to be present
additionally[1].

Because of that, commit ac5c1af led to a regression[0] in the context
of ZFS over iSCSI. Fix it, by adding a -r flag again.

[0]: https://forum.proxmox.com/threads/102683/
[1]: https://forum.proxmox.com/threads/102683/post-442577

Fixes: ac5c1af ("zfspool: add zfs_get_sorted_snapshot_list helper")
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/Storage/ZFSPoolPlugin.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 5f6befd..25cfdf3 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -398,9 +398,11 @@ sub zfs_list_zvol {
 sub zfs_get_sorted_snapshot_list {
     my ($class, $scfg, $volname, $sort_params) = @_;
 
+    my @params = ('-H', '-r', '-t', 'snapshot', '-o', 'name', $sort_params->@*);
+
     my $vname = ($class->parse_volname($volname))[1];
+    push @params, "$scfg->{pool}\/$vname";
 
-    my @params = ('-H', '-t', 'snapshot', '-o', 'name', $sort_params->@*, "$scfg->{pool}\/$vname");
     my $text = $class->zfs_request($scfg, undef, 'list', @params);
     my @snapshots = split(/\n/, $text);
 
-- 
2.30.2





More information about the pve-devel mailing list