5
0
mirror of git://git.proxmox.com/git/pve-guest-common.git synced 2024-12-23 17:34:10 +03:00

implement remove_vmid_jobs for ReplicationConfig

Allows to remove replication jobs from the config based on the vmid.

Preparations for #1291 fix

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-07-01 15:43:48 +02:00 committed by Thomas Lamprecht
parent 59af4860a1
commit 1daaf2ea3f

View File

@ -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) = @_;