Commit cbfc5881 authored by Dietmar Maurer's avatar Dietmar Maurer

be careful when removing snapshot

Seems umount return before the snapshot device is unused, so we
need to try several times.
parent 64b71fe3
......@@ -280,7 +280,20 @@ sub cleanup {
}
if ($task->{cleanup}->{lvm_snapshot}) {
$self->cmd_noerr ("lvremove -f $di->{snapdev}") if -b $di->{snapdev};
# loop, because we often get 'LV in use: not deactivating'
my $wait = 1;
while(-b $di->{snapdev}) {
eval { $self->cmd("lvremove -f $di->{snapdev}"); };
last if !$@;
if ($wait >= 64) {
$self->logerr($@);
last;
}
$self->loginfo("lvremove failed - trying again in $wait seconds");
sleep($wait);
$wait = $wait*2;
}
}
if ($task->{cleanup}->{etc_vzdump}) {
......
Markdown is supported
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