initial replication without intermediate snapshots should use the created sync snapshot

This commit is contained in:
Christoph Klaffl 2019-03-14 17:35:58 +01:00
parent 234cc61e3a
commit 736d031979
No known key found for this signature in database
GPG Key ID: FC1C525C2A47CC28
1 changed files with 8 additions and 1 deletions

View File

@ -376,7 +376,13 @@ sub syncdataset {
}
# if --no-stream is specified, our full needs to be the newest snapshot, not the oldest.
if (defined $args{'no-stream'}) { $oldestsnap = getnewestsnapshot(\%snaps); }
if (defined $args{'no-stream'}) {
if (defined ($args{'no-sync-snap'}) ) {
$oldestsnap = getnewestsnapshot(\%snaps);
} else {
$oldestsnap = $newsyncsnap;
}
}
my $oldestsnapescaped = escapeshellparam($oldestsnap);
my $sendcmd = "$sourcesudocmd $zfscmd send $sendoptions $sourcefsescaped\@$oldestsnapescaped";
@ -1199,6 +1205,7 @@ sub newsyncsnap {
my %date = getdate();
my $snapname = "syncoid\_$identifier$hostid\_$date{'stamp'}";
my $snapcmd = "$rhost $mysudocmd $zfscmd snapshot $fsescaped\@$snapname\n";
if ($debug) { print "DEBUG: creating sync snapshot using \"$snapcmd\"...\n"; }
system($snapcmd) == 0 or do {
warn "CRITICAL ERROR: $snapcmd failed: $?";
if ($exitcode < 2) { $exitcode = 2; }