[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.

Alexandre DERUMIER aderumier at odiso.com
Mon Jun 24 07:05:58 CEST 2013


"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: mir at datanom.net 
À: devel at lists.claws-mail.org, pve-devel at pve.proxmox.com 
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 <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.3.1 

_______________________________________________ 
pve-devel mailing list 
pve-devel at pve.proxmox.com 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 



More information about the pve-devel mailing list