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

Michael Köppl m.koeppl at proxmox.com
Tue May 27 18:01:38 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>
---
 PVE/QemuServer.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index c55617bd..c0170a38 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2131,7 +2131,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