"If remove of a base-image fails because of     dependent clones we must 
recreate the lun since dependent       clones require access to the image."

I don't have tested the code yet, (Remap lun on hanging free_image is good), 
but it's not a problem for clones if the base image is not accessible through 
iscsi.

Also, I think it's not possible to delete the base image (through proxmox api) 
if clones exist. We check if a base image have clones before delete it.




----- Mail original ----- 

De: [email protected] 
À: [email protected], [email protected] 
Envoyé: Dimanche 23 Juin 2013 22:33:57 
Objet: [pve-devel] [PATCH 2/7] If remove of a base-image fails because of 
dependent clones we must recreate the lun since dependent clones require access 
to the image. 

From: Michael Rasmussen <[email protected]> 

Signed-off-by: Michael Rasmussen <[email protected]> 
--- 
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.3.1 

_______________________________________________ 
pve-devel mailing list 
[email protected] 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 
_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to