]> git.proxmox.com Git - pve-zsync.git/commitdiff
check for correct incremental sync snapshot on destination
authorWolfgang Link <w.link@proxmox.com>
Wed, 18 Mar 2020 06:51:12 +0000 (07:51 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 19 Mar 2020 12:02:14 +0000 (13:02 +0100)
For an incremental sync you need the last_snap on both sides. The
call to the zfs list contains the snapshot. If the snapshot does not
exist, the command is returned with an error that we are catching.

Signed-off-by: Wolfgang Link <w.link@proxmox.com>
Reviewed-By: Fabian Ebner <f.ebner@proxmox.com>
Tested-By: Fabian Ebner <f.ebner@proxmox.com>
pve-zsync

index 25add923165a29f4c8d4e896d6ffd408bf720cb4..347866afb36e3bf5365869e318e3e8895fc1dfe6 100755 (executable)
--- a/pve-zsync
+++ b/pve-zsync
@@ -933,6 +933,7 @@ sub snapshot_destroy {
     }
 }
 
+# check if snapshot for incremental sync exist on dest side
 sub snapshot_exist {
     my ($source , $dest, $method, $dest_user) = @_;
 
@@ -942,22 +943,16 @@ sub snapshot_exist {
 
     my $path = $dest->{all};
     $path .= "/$source->{last_part}" if $source->{last_part};
-    $path .= "\@$source->{old_snap}";
+    $path .= "\@$source->{last_snap}";
 
     push @$cmd, $path;
 
-
-    my $text = "";
-    eval {$text =run_cmd($cmd);};
+    eval {run_cmd($cmd)};
     if (my $erro =$@) {
        warn "WARN: $erro";
        return undef;
     }
-
-    while ($text && $text =~ s/^(.*?)(\n|$)//) {
-       my $line =$1;
-       return 1 if $line =~ m/^.*$source->{old_snap}$/;
-    }
+    return 1;
 }
 
 sub send_image {