[pve-devel] [PATCH qemu-server 2/5] remove replicated volumes on purge
Fabian Ebner
f.ebner at proxmox.com
Wed Oct 14 13:36:25 CEST 2020
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
PVE/API2/Qemu.pm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 8da616a..c6b1088 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -17,6 +17,7 @@ use PVE::Exception qw(raise raise_param_exc raise_perm_exc);
use PVE::Storage;
use PVE::JSONSchema qw(get_standard_option);
use PVE::RESTHandler;
+use PVE::Replication;
use PVE::ReplicationConfig;
use PVE::GuestHelpers;
use PVE::QemuConfig;
@@ -1539,7 +1540,14 @@ __PACKAGE__->register_method({
PVE::Firewall::remove_vmfw_conf($vmid);
if ($param->{purge}) {
print "purging VM $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::QemuConfig', $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