[pve-devel] [PATCH qemu-server] destroy_vm: allow vdisk_free to fail

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Dec 20 12:30:57 CET 2016


otherwise we end up with undeletable VM configs in case
vdisk_free fails (which could happen because of cluster-wide
lock contention, storage problems, ..).

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/QemuServer.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 43dd97a..aeb710a 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2082,7 +2082,11 @@ sub destroy_vm {
 	my ($path, $owner) = PVE::Storage::path($storecfg, $volid);
 	return if !$path || !$owner || ($owner != $vmid);
 
-	PVE::Storage::vdisk_free($storecfg, $volid);
+	eval {
+	    PVE::Storage::vdisk_free($storecfg, $volid);
+	};
+	warn "Could not remove disk '$volid', check manually: $@" if $@;
+
     });
 
     if ($keep_empty_config) {
-- 
2.1.4





More information about the pve-devel mailing list