Commit 262561c4 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

fix(qcow): check the volume is not in use

parent 51cc9588
......@@ -50,6 +50,13 @@ sub prepare_base($self) {
}
sub clone($self, $file_clone) {
my $n = 10;
for (;;) {
my @stat = stat($self->file);
last if time-$stat[9] || $n--<0;
sleep 1;
die "Error: ".$self->file." looks active" if $n-- <0;
}
my @cmd = ($QEMU_IMG,'create'
,'-f','qcow2'
,"-b", $self->file
......@@ -138,14 +145,5 @@ sub block_commit($self) {
my @cmd = ($QEMU_IMG,'commit','-q','-d');
my ($out, $err) = $self->vm->run_command(@cmd, $self->file);
warn $err if $err;
for (;;) {
return if !-e $self->file;
my $t0 = time;
my @stat = stat($self->file);
my $mtime = $stat[9];
return if $t0 - $mtime > 0;
sleep 1;
}
}
1;
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