[pve-devel] [pve-guest-commom 2/2] PVE::ReplicationConfig add delete_job helper

Dietmar Maurer dietmar at proxmox.com
Mon Jun 12 06:55:36 CEST 2017


Moved from PVE::Replication.

Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 PVE/ReplicationConfig.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
index 01e7206..845d9c3 100644
--- a/PVE/ReplicationConfig.pm
+++ b/PVE/ReplicationConfig.pm
@@ -209,6 +209,18 @@ sub check_for_existing_jobs {
     return undef;
 }
 
+sub delete_job {
+    my ($jobid) = @_;
+
+    my $code = sub {
+	my $cfg = __PACKAGE__->new();
+	delete $cfg->{ids}->{$jobid};
+	$cfg->write();
+    };
+
+    lock($code);
+}
+
 package PVE::ReplicationConfig::Cluster;
 
 use base qw(PVE::ReplicationConfig);
-- 
2.11.0




More information about the pve-devel mailing list