mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-06 17:47:31 +00: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:
parent
b9719d15ab
commit
5fe03fd8ee
@ -5215,12 +5215,24 @@ sub qemu_drive_mirror {
|
|||||||
};
|
};
|
||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
eval { vm_mon_cmd($vmid, "block-job-cancel", device => "drive-$drive"); };
|
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";
|
die "mirroring error: $err";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($vmiddst != $vmid) {
|
if ($vmiddst != $vmid) {
|
||||||
# if we clone a disk for a new target vm, we don't switch the disk
|
# 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");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user