public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 storage] zfs: use -r parameter when listing snapshots
@ 2022-01-10 11:50 Fabian Ebner
  2022-01-10 12:40 ` [pve-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2022-01-10 11:50 UTC (permalink / raw)
  To: pve-devel

Some versions of ZFS do not automatically display the child snapshots
when '-t snapshot' is used, but require '-r' to be present
additionally[1]. And in general, it's cleaner to specify the flag
explicitly.

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

The volume_snapshot_info function is currently only used in the
context of replication and that requires a local ZFS pool, but it
would be affected by the same issue if it is ever used in the context
of ZFS over iSCSI, so also add -r there.

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

Fixes: 8c20d8a ("plugin: add volume_snapshot_info function")
Fixes: ac5c1af ("zfspool: add zfs_get_sorted_snapshot_list helper")
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

Changes from v1:
    * Add -r in volume_snapshot_info too.

 PVE/Storage/ZFSPoolPlugin.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 5f6befd..e952a5c 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);
 
@@ -513,9 +515,11 @@ sub volume_rollback_is_possible {
 sub volume_snapshot_info {
     my ($class, $scfg, $storeid, $volname) = @_;
 
+    my @params = ('-Hp', '-r', '-t', 'snapshot', '-o', 'name,guid,creation');
+
     my $vname = ($class->parse_volname($volname))[1];
+    push @params, "$scfg->{pool}\/$vname";
 
-    my @params = ('-Hp', '-t', 'snapshot', '-o', 'name,guid,creation', "$scfg->{pool}\/$vname");
     my $text = $class->zfs_request($scfg, undef, 'list', @params);
     my @lines = split(/\n/, $text);
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH v2 storage] zfs: use -r parameter when listing snapshots
  2022-01-10 11:50 [pve-devel] [PATCH v2 storage] zfs: use -r parameter when listing snapshots Fabian Ebner
@ 2022-01-10 12:40 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2022-01-10 12:40 UTC (permalink / raw)
  To: Proxmox VE development discussion

thanks! (and a big 'huh?' to those implementations - not relevant for 
us, but forcing '-r' to query snapshots seems rather strange..)

On January 10, 2022 12:50 pm, Fabian Ebner wrote:
> Some versions of ZFS do not automatically display the child snapshots
> when '-t snapshot' is used, but require '-r' to be present
> additionally[1]. And in general, it's cleaner to specify the flag
> explicitly.
> 
> Because of that, commit ac5c1af led to a regression[0] in the context
> of ZFS over iSCSI with zfs_get_sorted_snapshot_list. Fix it, by adding
> a -r flag again.
> 
> The volume_snapshot_info function is currently only used in the
> context of replication and that requires a local ZFS pool, but it
> would be affected by the same issue if it is ever used in the context
> of ZFS over iSCSI, so also add -r there.
> 
> [0]: https://forum.proxmox.com/threads/102683/
> [1]: https://forum.proxmox.com/threads/102683/post-442577
> 
> Fixes: 8c20d8a ("plugin: add volume_snapshot_info function")
> Fixes: ac5c1af ("zfspool: add zfs_get_sorted_snapshot_list helper")
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> 
> Changes from v1:
>     * Add -r in volume_snapshot_info too.
> 
>  PVE/Storage/ZFSPoolPlugin.pm | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
> index 5f6befd..e952a5c 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);
>  
> @@ -513,9 +515,11 @@ sub volume_rollback_is_possible {
>  sub volume_snapshot_info {
>      my ($class, $scfg, $storeid, $volname) = @_;
>  
> +    my @params = ('-Hp', '-r', '-t', 'snapshot', '-o', 'name,guid,creation');
> +
>      my $vname = ($class->parse_volname($volname))[1];
> +    push @params, "$scfg->{pool}\/$vname";
>  
> -    my @params = ('-Hp', '-t', 'snapshot', '-o', 'name,guid,creation', "$scfg->{pool}\/$vname");
>      my $text = $class->zfs_request($scfg, undef, 'list', @params);
>      my @lines = split(/\n/, $text);
>  
> -- 
> 2.30.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-10 12:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 11:50 [pve-devel] [PATCH v2 storage] zfs: use -r parameter when listing snapshots Fabian Ebner
2022-01-10 12:40 ` [pve-devel] applied: " Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal