[pve-devel] [PATCH container 3/5] remove replicated volumes on purge

Fabian Ebner f.ebner at proxmox.com
Wed Oct 14 13:36:26 CEST 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/PVE/API2/LXC.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 9ecfb12..9fc7d98 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -15,6 +15,7 @@ use PVE::Firewall;
 use PVE::Storage;
 use PVE::RESTHandler;
 use PVE::RPCEnvironment;
+use PVE::Replication;
 use PVE::ReplicationConfig;
 use PVE::LXC;
 use PVE::LXC::Create;
@@ -694,7 +695,14 @@ __PACKAGE__->register_method({
 	    PVE::Firewall::remove_vmfw_conf($vmid);
 	    if ($param->{purge}) {
 	        print "purging CT $vmid from related configurations..\n";
-		PVE::ReplicationConfig::remove_vmid_jobs($vmid);
+
+		my $repl_conf = PVE::ReplicationConfig->new();
+		my $jobs = $repl_conf->list_local_jobs($vmid);
+		foreach my $job (@{$jobs}) {
+		    eval { PVE::Replication::run_full_removal('PVE::LXC::Config', $job); };
+		    warn $@ if $@;
+		}
+
 		PVE::VZDump::Plugin::remove_vmid_from_backup_jobs($vmid);
 
 		if ($ha_managed) {
-- 
2.20.1






More information about the pve-devel mailing list