public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container 3/5] remove replicated volumes on purge
Date: Wed, 14 Oct 2020 13:36:26 +0200	[thread overview]
Message-ID: <20201014113628.14286-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20201014113628.14286-1-f.ebner@proxmox.com>

Signed-off-by: Fabian Ebner <f.ebner@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





  parent reply	other threads:[~2020-10-14 11:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 11:36 [pve-devel] [PATCH-SERIES] remove replicated volumes on guest purge Fabian Ebner
2020-10-14 11:36 ` [pve-devel] [PATCH guest-common 1/5] add list_local_jobs and run_full_removal functions Fabian Ebner
2020-10-14 11:36 ` [pve-devel] [PATCH qemu-server 2/5] remove replicated volumes on purge Fabian Ebner
2020-10-14 11:36 ` Fabian Ebner [this message]
2020-10-14 11:36 ` [pve-devel] [PATCH guest-common 4/5] remove the now unused remove_vmid_jobs Fabian Ebner
2020-10-14 11:36 ` [pve-devel] [PATCH guest-common 5/5] cleanup: iterate over values in find_local_replication_job Fabian Ebner
2021-01-28 16:20 ` [pve-devel] [PATCH-SERIES] remove replicated volumes on guest purge Thomas Lamprecht
2021-01-29 10:12   ` Fabian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201014113628.14286-4-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal