[pve-devel] [PATCH v3 guest-common 2/2] fix #1291: implement remove_vmid_jobs for ReplicationConfig
Christian Ebner
c.ebner at proxmox.com
Mon Jul 1 15:43:48 CEST 2019
Allows to remove replication jobs from the config based on the vmid.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
PVE/ReplicationConfig.pm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
index d597799..e58597e 100644
--- a/PVE/ReplicationConfig.pm
+++ b/PVE/ReplicationConfig.pm
@@ -258,6 +258,20 @@ sub delete_job {
lock($code);
}
+sub remove_vmid_jobs {
+ my ($vmid) = @_;
+
+ my $code = sub {
+ my $cfg = __PACKAGE__->new();
+ foreach my $id (keys %{$cfg->{ids}}) {
+ delete $cfg->{ids}->{$id} if ($cfg->{ids}->{$id}->{guest} == $vmid);
+ }
+ $cfg->write();
+ };
+
+ lock($code);
+}
+
sub swap_source_target_nolock {
my ($jobid) = @_;
--
2.20.1
More information about the pve-devel
mailing list