Skip to content

Commit

Permalink
lib/ZnapZend.pm: sendRecvCleanup(): reconcile sendRaw and autoCreatio…
Browse files Browse the repository at this point in the history
…n condition clause when a destination sub-dataset is missing [#650]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jun 2, 2024
1 parent 49c9cb1 commit d075800
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/ZnapZend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ my $refreshBackupPlans = sub {
$backupSet->{"dst_$key" . '_valid'} =
$self->zZfs->dataSetExists($backupSet->{"dst_$key"}) or do {

# Do not automatically create destination when using
# feature sendRaw, receiving a raw encrypted stream
# is not supported on unencrypted datasets
if ($autoCreation && !$self->sendRaw) {
my ($zpool) = $backupSet->{"dst_$key"} =~ /(^[^\/]+)\//;

Expand Down Expand Up @@ -588,6 +591,9 @@ my $sendRecvCleanup = sub {
$backupSet->{"dst_$key" . '_valid'} =
$self->zZfs->dataSetExists($backupSet->{"dst_$key"}) or do {

# Do not automatically create destination when using
# feature sendRaw, receiving a raw encrypted stream
# is not supported on unencrypted datasets
if ($autoCreation && !$self->sendRaw) {
my ($zpool) = $backupSet->{"dst_$key"} =~ /(^[^\/]+)\//;

Expand All @@ -606,6 +612,8 @@ my $sendRecvCleanup = sub {
}
};
}
# TOTHINK: Is the sendRaw comparison correct here for the intent
# and purpose of PR https://github.com/oetiker/znapzend/pull/496 ?
( $backupSet->{"dst_$key" . '_valid'} || ($self->sendRaw && $autoCreation) ) or do {
my $errmsg = "destination '" . $backupSet->{"dst_$key"}
. "' does not exist or is offline; ignoring it for this round...";
Expand Down Expand Up @@ -664,7 +672,10 @@ my $sendRecvCleanup = sub {

# Time to check if the target sub-dataset exists
# at all (unless we would auto-create one anyway).
if ((!$autoCreation || !$self->sendRaw) && !($self->zZfs->dataSetExists($dstDataSet))) {
# Do not automatically create destination when using
# feature sendRaw, receiving a raw encrypted stream
# is not supported on unencrypted datasets.
if ((!$autoCreation || $self->sendRaw) && !($self->zZfs->dataSetExists($dstDataSet))) {
my $errmsg = "sub-destination '" . $dstDataSet
. "' does not exist or is offline; ignoring it for this round... Consider "
. ( $autoCreation || $self->sendRaw ? "" : "running znapzend --autoCreation or " )
Expand Down

0 comments on commit d075800

Please sign in to comment.