[pve-devel] [PATCH guest-common 2/2] replication: don't sync to offline targets on error states
Wolfgang Bumiller
w.bumiller at proxmox.com
Tue Jun 27 10:53:13 CEST 2017
There's no point in trying to replicate to a target node
which is offline. Note that if we're not already in an
error state we do still give it a try in order for this to
get logged as an error at least once.
---
PVE/ReplicationState.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm
index 2ef31b5..e064545 100644
--- a/PVE/ReplicationState.pm
+++ b/PVE/ReplicationState.pm
@@ -233,9 +233,10 @@ sub job_status {
# only consider guest on local node
next if $vms->{ids}->{$vmid}->{node} ne $local_node;
+ my $target = $jobcfg->{target};
if (!$jobcfg->{remove_job}) {
# never sync to local node
- next if $jobcfg->{target} eq $local_node;
+ next if $target eq $local_node;
next if $jobcfg->{disable};
}
@@ -252,7 +253,10 @@ sub job_status {
# todo: consider fail_count? How many retries?
} else {
if (my $fail_count = $state->{fail_count}) {
- $next_sync = $state->{last_try} + 60*($fail_count < 3 ? 5*$fail_count : 30);
+ my $members = PVE::Cluster::get_members();
+ if (!$fail_count || ($members->{$target} && $members->{$target}->{online})) {
+ $next_sync = $state->{last_try} + 60*($fail_count < 3 ? 5*$fail_count : 30);
+ }
} else {
my $schedule = $jobcfg->{schedule} || '*/15';
my $calspec = PVE::CalendarEvent::parse_calendar_event($schedule);
--
2.11.0
More information about the pve-devel
mailing list