[pve-devel] [PATCH qemu-server] restore: better error handling for vdisk deletion

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Sep 15 13:24:35 CEST 2016


when restoring into an existing VM, we don't want to die
half-way through because we can't delete one of the existing
volumes. instead, warn about the deletion failure, but
continue anyway. the not deleted disk is then added as
unused automatically.
---
 PVE/QemuServer.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index c3a53c9..dbd85a0 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5343,7 +5343,10 @@ sub restore_vma_archive {
 		# Note: only delete disk we want to restore
 		# other volumes will become unused
 		if ($virtdev_hash->{$ds}) {
-		    PVE::Storage::vdisk_free($cfg, $volid);
+		    eval { PVE::Storage::vdisk_free($cfg, $volid); };
+		    if (my $err = $@) {
+			warn $err;
+		    }
 		}
 	    });
 
-- 
2.1.4





More information about the pve-devel mailing list