all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH zsync 4/6] snapshot_get: make interface agnostic to source/dest
Date: Tue, 11 May 2021 14:59:53 +0200	[thread overview]
Message-ID: <20210511125955.25105-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210511125955.25105-1-f.ebner@proxmox.com>

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 pve-zsync | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/pve-zsync b/pve-zsync
index ff05f46..c162230 100755
--- a/pve-zsync
+++ b/pve-zsync
@@ -677,7 +677,15 @@ sub sync {
 	my $sync_path = sub {
 	    my ($source, $dest, $job, $param, $date) = @_;
 
-	    ($dest->{old_snap}, $dest->{last_snap}) = snapshot_get($source, $dest, $param->{maxsnap}, $param->{name}, $param->{dest_user});
+	    my $dest_dataset = target_dataset($source, $dest);
+
+	    ($dest->{old_snap}, $dest->{last_snap}) = snapshot_get(
+		$dest_dataset,
+		$param->{maxsnap},
+		$param->{name},
+		$dest->{ip},
+		$param->{dest_user},
+	    );
 
 	    prepare_prepended_target($source, $dest, $param->{dest_user}) if defined($dest->{prepend});
 
@@ -746,14 +754,12 @@ sub sync {
 }
 
 sub snapshot_get{
-    my ($source, $dest, $max_snap, $name, $dest_user) = @_;
+    my ($dataset, $max_snap, $name, $ip, $user) = @_;
 
     my $cmd = [];
-    push @$cmd, 'ssh', "$dest_user\@$dest->{ip}", '--', if $dest->{ip};
+    push @$cmd, 'ssh', "$user\@$ip", '--', if $ip;
     push @$cmd, 'zfs', 'list', '-r', '-t', 'snapshot', '-Ho', 'name', '-S', 'creation';
-
-    my $path = target_dataset($source, $dest);
-    push @$cmd, $path;
+    push @$cmd, $dataset;
 
     my $raw;
     eval {$raw = run_cmd($cmd)};
-- 
2.20.1





  parent reply	other threads:[~2021-05-11 13:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 12:59 [pve-devel] [PATCH-SERIES zsync] fix #3351: allow keeping a different number of snapshots on source and destination Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 1/6] param_to_job: handle --maxsnap 0 on creation Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 2/6] usage: improve maxsnap description Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 3/6] remove all old snapshots belonging to a job Fabian Ebner
2021-05-11 12:59 ` Fabian Ebner [this message]
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 5/6] snapshot_destroy: make interface agnostic to source/dest Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 6/6] fix #3351: allow keeping a different number of snapshots on source and destination Fabian Ebner
2021-05-24 16:00   ` Bruce Wainer
2021-05-25  5:10     ` Thomas Lamprecht
2021-05-25 12:02 ` [pve-devel] applied-series: [PATCH-SERIES zsync] " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210511125955.25105-5-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal