[pve-devel] [PATCH] rbd : free_image : retry if rbd has watchers
Alexandre DERUMIER
aderumier at odiso.com
Thu Nov 6 05:54:26 CET 2014
>>Will this potentially fix the Disk Move issues I reported a few weeks back ?
Not Yet :(
But It's already improve a little bit, because when a disk move failed, we try to delete the new mirrored disk,
and this is hanging too.
(bug in a bug).
I'm still unable to reproduce the hang when drive-mirror reach 100% :(
----- Mail original -----
De: "Andrew Thrift" <andrew at networklabs.co.nz>
À: "Alexandre Derumier" <aderumier at odiso.com>
Cc: pve-devel at pve.proxmox.com
Envoyé: Jeudi 6 Novembre 2014 03:25:10
Objet: Re: [pve-devel] [PATCH] rbd : free_image : retry if rbd has watchers
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
More information about the pve-devel
mailing list