[pve-devel] [PATCH qemu-server] fix drive-mirror completion with cloudinit

Mira Limbeck m.limbeck at proxmox.com
Fri Jan 15 12:49:24 CET 2021


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 at proxmox.com>
---
 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.20.1






More information about the pve-devel mailing list