From 1b485263b3c2158b487c582b450ebcf721e6a79a Mon Sep 17 00:00:00 2001 From: Mira Limbeck Date: Fri, 15 Jan 2021 12:49:24 +0100 Subject: [PATCH] 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 --- PVE/QemuServer.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 54278e5..ae9d6dd 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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; } -- 2.39.2