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

Andrew Thrift andrew at networklabs.co.nz
Thu Nov 6 03:25:10 CET 2014


Hi Alexandre,

Will this potentially fix the Disk Move issues I reported a few weeks back ?


On Thu, Nov 6, 2014 at 4:09 AM, Alexandre Derumier <aderumier at odiso.com>
wrote:

> reported in drive-mirror,
>
> if we cancel the job and we try to free the rbd volume,
> it seem that rbd storage take 2-3 seconds to release the volume
> or it's throwing an "image still has watchers".
>
> This patch try to wait 10s with 10retries before dying
>
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  PVE/Storage/RBDPlugin.pm |   15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
> index 1026d81..3bfff4c 100644
> --- a/PVE/Storage/RBDPlugin.pm
> +++ b/PVE/Storage/RBDPlugin.pm
> @@ -409,7 +409,20 @@ sub free_image {
>      run_rbd_command($cmd, errmsg => "rbd snap purge '$volname' error");
>
>      $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/);
> +
> +       die "image still has watchers" if $i > 10;
> +       last if !$err;
> +    }
>
>      return undef;
>  }
> --
> 1.7.10.4
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20141106/aec43461/attachment.htm>


More information about the pve-devel mailing list