Commit 526c6c9f authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#370] catch the error and retry 3 times

parent af818457
......@@ -241,9 +241,10 @@ sub search_volume_re($self,$pattern,$refresh=0) {
confess "'$pattern' doesn't look like a regexp to me ".ref($pattern)
if !ref($pattern) || ref($pattern) ne 'Regexp';
$self->_refresh_storage_pools() if $refresh;
my @volume;
for my $pool ($self->vm->list_storage_pools) {
$pool->refresh() if $refresh;
for my $vol ( $pool->list_all_volumes()) {
my ($file) = $vol->get_path =~ m{.*/(.*)};
next if $file !~ $pattern;
......@@ -264,7 +265,10 @@ sub search_volume_re($self,$pattern,$refresh=0) {
sub _refresh_storage_pools($self) {
for my $pool ($self->vm->list_storage_pools) {
$pool->refresh();
eval { $pool->refresh() };
last if !$@;
warn $@ if $@ !~ /pool .* has asynchronous jobs running/;
sleep 1;
}
}
......
......@@ -228,7 +228,8 @@ sub _remove_old_disks_kvm {
eval { $dir_img = $vm->dir_img() };
return if !$dir_img;
eval { $vm->storage_pool->refresh() };
$vm->_refresh_storage_pools();
ok(!$@,"Expecting error = '' , got '".($@ or '')."'"
." after refresh storage pool") or return;
opendir my $ls,$dir_img or return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment