[pve-devel] [PATCH guest-common] replication: add schedule_job_now helper

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Jun 28 11:35:06 CEST 2017


---
 PVE/ReplicationState.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm
index 74c95f9..43c8a76 100644
--- a/PVE/ReplicationState.pm
+++ b/PVE/ReplicationState.pm
@@ -317,4 +317,16 @@ sub get_next_job {
     return undef;
 }
 
+sub schedule_job_now {
+    my ($jobcfg) = @_;
+    PVE::GuestHelpers::guest_migration_lock($jobcfg->{guest}, undef, sub {
+	PVE::Tools::lock_file($state_lock, 10, sub {
+	    my $state = read_job_state($jobcfg);
+	    $state->{last_try} = 0;
+	    write_job_state($jobcfg, $state);
+	});
+	die $@ if $@;
+    });
+}
+
 1;
-- 
2.11.0





More information about the pve-devel mailing list