5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-25 06:03:52 +03:00

block-job-cancel : wait that jobs is really finished

block-job-cancel is async, we need to check that job is really finished

before try to free the volume

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier 2014-11-07 10:10:47 +01:00 committed by Dietmar Maurer
parent b9719d15ab
commit 5fe03fd8ee

View File

@ -5215,12 +5215,24 @@ sub qemu_drive_mirror {
};
if (my $err = $@) {
eval { vm_mon_cmd($vmid, "block-job-cancel", device => "drive-$drive"); };
while (1) {
my $stats = vm_mon_cmd($vmid, "query-block-jobs");
my $stat = @$stats[0];
last if !$stat;
sleep 1;
}
die "mirroring error: $err";
}
if ($vmiddst != $vmid) {
# if we clone a disk for a new target vm, we don't switch the disk
vm_mon_cmd($vmid, "block-job-cancel", device => "drive-$drive");
while (1) {
my $stats = vm_mon_cmd($vmid, "query-block-jobs");
my $stat = @$stats[0];
last if !$stat;
sleep 1;
}
}
}
}