fix drive-mirror completion with cloudinit

On clone_vm when cloning the disks while the VM is running, we use
drive-mirror. We skip completion until the last disk, but with a
cloudinit disk there's no drive-mirror and so no completion done. If it
is the last disk in the hash, we never complete the drive-mirror jobs
and no further cloning is possible as there are already active jobs
using the disks.

To fix it we have to call qemu_drive_mirror_monitor directly in the case
of cloudinit when completion is requested and there are jobs defined.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
This commit is contained in:
Mira Limbeck 2021-01-15 12:49:24 +01:00 committed by Thomas Lamprecht
parent 211785ee50
commit 1b485263b3

View File

@ -6965,6 +6965,12 @@ sub clone_disk {
PVE::Storage::activate_volumes($storecfg, [$newvolid]);
if (drive_is_cloudinit($drive)) {
# when cloning multiple disks (e.g. during clone_vm) it might be the last disk
# if this is the case, we have to complete any block-jobs still there from
# previous drive-mirrors
if (($completion eq 'complete') && (scalar(keys %$jobs) > 0)) {
qemu_drive_mirror_monitor($vmid, $newvmid, $jobs, $completion, $qga);
}
goto no_data_clone;
}