continue replication on more critical errors
This commit is contained in:
parent
63eec4994c
commit
9668567a87
20
syncoid
20
syncoid
|
@ -233,6 +233,10 @@ sub syncdataset {
|
||||||
if (!defined $args{'no-sync-snap'}) {
|
if (!defined $args{'no-sync-snap'}) {
|
||||||
# create a new syncoid snapshot on the source filesystem.
|
# create a new syncoid snapshot on the source filesystem.
|
||||||
$newsyncsnap = newsyncsnap($sourcehost,$sourcefs,$sourceisroot);
|
$newsyncsnap = newsyncsnap($sourcehost,$sourcefs,$sourceisroot);
|
||||||
|
if (!$newsyncsnap) {
|
||||||
|
# we already whined about the error
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
# we don't want sync snapshots created, so use the newest snapshot we can find.
|
# we don't want sync snapshots created, so use the newest snapshot we can find.
|
||||||
$newsyncsnap = getnewestsnapshot($sourcehost,$sourcefs,$sourceisroot);
|
$newsyncsnap = getnewestsnapshot($sourcehost,$sourcefs,$sourceisroot);
|
||||||
|
@ -267,6 +271,11 @@ sub syncdataset {
|
||||||
}
|
}
|
||||||
my $oldestsnap = getoldestsnapshot(\%snaps);
|
my $oldestsnap = getoldestsnapshot(\%snaps);
|
||||||
if (! $oldestsnap) {
|
if (! $oldestsnap) {
|
||||||
|
if (defined ($args{'no-sync-snap'}) ) {
|
||||||
|
# we already whined about the missing snapshots
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
# getoldestsnapshot() returned false, so use new sync snapshot
|
# getoldestsnapshot() returned false, so use new sync snapshot
|
||||||
if ($debug) { print "DEBUG: getoldestsnapshot() returned false, so using $newsyncsnap.\n"; }
|
if ($debug) { print "DEBUG: getoldestsnapshot() returned false, so using $newsyncsnap.\n"; }
|
||||||
$oldestsnap = $newsyncsnap;
|
$oldestsnap = $newsyncsnap;
|
||||||
|
@ -752,7 +761,7 @@ sub getoldestsnapshot {
|
||||||
# must not have had any snapshots on source - luckily, we already made one, amirite?
|
# must not have had any snapshots on source - luckily, we already made one, amirite?
|
||||||
if (defined ($args{'no-sync-snap'}) ) {
|
if (defined ($args{'no-sync-snap'}) ) {
|
||||||
# well, actually we set --no-sync-snap, so no we *didn't* already make one. Whoops.
|
# well, actually we set --no-sync-snap, so no we *didn't* already make one. Whoops.
|
||||||
die "CRIT: --no-sync-snap is set, and getoldestsnapshot() could not find any snapshots on source!\n";
|
warn "CRIT: --no-sync-snap is set, and getoldestsnapshot() could not find any snapshots on source!\n";
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -774,6 +783,7 @@ sub getnewestsnapshot {
|
||||||
# we also probably need an argument to mute this WARN, for people who deliberately exclude
|
# we also probably need an argument to mute this WARN, for people who deliberately exclude
|
||||||
# datasets from recursive replication this way.
|
# datasets from recursive replication this way.
|
||||||
warn "WARN: --no-sync-snap is set, and getnewestsnapshot() could not find any snapshots on source for current dataset. Continuing.\n";
|
warn "WARN: --no-sync-snap is set, and getnewestsnapshot() could not find any snapshots on source for current dataset. Continuing.\n";
|
||||||
|
if ($exitcode < 2) { $exitcode = 2; }
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -961,8 +971,12 @@ sub newsyncsnap {
|
||||||
my %date = getdate();
|
my %date = getdate();
|
||||||
my $snapname = "syncoid\_$identifier$hostid\_$date{'stamp'}";
|
my $snapname = "syncoid\_$identifier$hostid\_$date{'stamp'}";
|
||||||
my $snapcmd = "$rhost $mysudocmd $zfscmd snapshot $fsescaped\@$snapname\n";
|
my $snapcmd = "$rhost $mysudocmd $zfscmd snapshot $fsescaped\@$snapname\n";
|
||||||
system($snapcmd) == 0
|
system($snapcmd) == 0 or do {
|
||||||
or die "CRITICAL ERROR: $snapcmd failed: $?";
|
warn "CRITICAL ERROR: $snapcmd failed: $?";
|
||||||
|
if ($exitcode < 2) { $exitcode = 2; }
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
return $snapname;
|
return $snapname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue