[pve-devel] [PATCH] rbd : free_image : retry if rbd has watchers

Alexandre DERUMIER aderumier at odiso.com
Thu Nov 6 14:07:09 CET 2014


>>And what happens if we get other errors? 

Currently It's retrying until $i > ~0

but we could add a die directly if $err !~ image still has watchers
----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Jeudi 6 Novembre 2014 12:23:10 
Objet: RE: [pve-devel] [PATCH] rbd : free_image : retry if rbd has watchers 

> $cmd = &$rbd_cmd($scfg, $storeid, 'rm', $name); 
> - run_rbd_command($cmd, errmsg => "rbd rm '$volname' error"); 
> + 
> + my $i = 0; 
> + while(1){ 
> + $i++; 
> + eval { 
> + run_rbd_command($cmd, errmsg => "rbd rm '$volname' error"); 
> + }; 
> + my $err = $@; 
> + 
> + sleep 1 if ($err && $err =~ m/image still has watchers/); 

And what happens if we get other errors? 

> + 
> + die "image still has watchers" if $i > 10; 
> + last if !$err; 
> + } 



More information about the pve-devel mailing list