[pve-devel] [PATCH qemu-server v3 1/1] fix #6613: pass purge param to delete_service_from_config

Michael Köppl m.koeppl at proxmox.com
Tue Sep 30 16:58:40 CEST 2025


This covers the case where users want to delete a VM that is also a HA
resource. If the purge param is set, the HA resource will also be
removed from the affinity rules referencing the resource. If the
affected rule only contains this one resource, the rule is also deleted.

Signed-off-by: Michael Köppl <m.koeppl at proxmox.com>
Tested-by: Daniel Kral <d.kral at proxmox.com>
Reviewed-by: Daniel Kral <d.kral at proxmox.com>
---
 src/PVE/API2/Qemu.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 594c5d48..68775834 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -2762,7 +2762,9 @@ __PACKAGE__->register_method({
                         PVE::VZDump::Plugin::remove_vmid_from_backup_jobs($vmid);
 
                         if ($ha_managed) {
-                            PVE::HA::Config::delete_service_from_config("vm:$vmid");
+                            PVE::HA::Config::delete_service_from_config(
+                                "vm:$vmid", $param->{purge},
+                            );
                             print "NOTE: removed VM $vmid from HA resource configuration.\n";
                         }
                     }
-- 
2.47.3





More information about the pve-devel mailing list