[pve-devel] [PATCH qemu-server v8 2/4] fix #3711: make removal of VM possible if store does not exist anymore

Michael Köppl m.koeppl at proxmox.com
Thu Jun 26 18:06:24 CEST 2025


Similar to the handling of storage errors in other parts of
destroy_vm(), an error during the call to PVE::Storage::path() should
not stop the VM from being destroyed. Instead, the user should be warned
and the function should continue.

Originally-by: Stefan Hrdlicka <s.hrdlicka at proxmox.com>
 [ MK: log_warn if check fails instead of ignoring error ]
Signed-off-by: Michael Köppl <m.koeppl at proxmox.com>
---
 src/PVE/QemuServer.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 365e1183..91b0d1e0 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -1915,7 +1915,8 @@ sub destroy_vm {
         return if !$volid || $volid =~ m|^/|;
         return if $volids->{$volid};
 
-        my ($path, $owner) = PVE::Storage::path($storecfg, $volid);
+        my ($path, $owner) = eval { PVE::Storage::path($storecfg, $volid) };
+        log_warn("failed to get path and owner of volume '$volid': $@") if $@;
         return if !$path || !$owner || ($owner != $vmid);
 
         $volids->{$volid} = 1;
-- 
2.39.5





More information about the pve-devel mailing list