[pve-devel] [PATCH 02/09] If remove of a base-image fails because of dependent clones we must recreate the lun since dependent clones require access to the image.

mir at datanom.net mir at datanom.net
Mon Aug 12 19:55:28 CEST 2013


From: Michael Rasmussen <mir at datanom.net>

Signed-off-by: Michael Rasmussen <mir at datanom.net>
---
 PVE/Storage/ZFSPlugin.pm | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index 909f71f..b02a87a 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -495,10 +495,16 @@ sub free_image {
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
 
-	eval {
-    	zfs_delete_lu($scfg, $name);
-	};
-   	zfs_delete_zvol($scfg, $name);
+    zfs_delete_lu($scfg, $name);
+    eval {
+        zfs_delete_zvol($scfg, $name);
+    };
+    do {
+        my $err = $@;
+        zfs_create_lu($scfg, $name);
+        zfs_add_lun_mapping_entry($scfg, $name);
+        die "1: $err";
+    } if $@;
 
     return undef;
 }
-- 
1.8.4.rc2




More information about the pve-devel mailing list