From c5a8e04fcda35efe72eb23fcb089607871b0c2c1 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 23 May 2017 18:05:12 +0200 Subject: [PATCH] do not allow destroy if there are replication jobs --- src/PVE/API2/LXC.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index 47dcb08..a23b944 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -13,6 +13,7 @@ use PVE::Firewall; use PVE::Storage; use PVE::RESTHandler; use PVE::RPCEnvironment; +use PVE::ReplicationConfig; use PVE::LXC; use PVE::LXC::Create; use PVE::LXC::Migrate; @@ -603,6 +604,10 @@ __PACKAGE__->register_method({ die "unable to remove CT $vmid - used in HA resources\n" if PVE::HA::Config::vm_is_ha_managed($vmid); + # do not allow destroy if there are replication jobs + my $repl_conf = PVE::ReplicationConfig->new(); + $repl_conf->check_for_existing_jobs($vmid); + my $running_error_msg = "unable to destroy CT $vmid - container is running\n"; die $running_error_msg if PVE::LXC::check_running($vmid); # check early -- 2.39.2