[pve-devel] [PATCH qemu-server] fix #5572: avoid warning about uninitialized value when cloning cloudinit disk

Fiona Ebner f.ebner at proxmox.com
Wed Jul 3 10:40:32 CEST 2024


Some callers like the move disk API endpoint do not pass an explicit
completion argument. This is not an issue in general, because
qemu_drive_mirror_monitor() defaults to 'complete'. However, there was
a string comparision for the cloudinit case that can trigger a warning
about the value being uninitialized.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 9fac4a47..cf348cac 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -8280,7 +8280,7 @@ sub clone_disk {
 	    # 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)) {
+	    if (($completion && $completion eq 'complete') && (scalar(keys %$jobs) > 0)) {
 		qemu_drive_mirror_monitor($vmid, $newvmid, $jobs, $completion, $qga);
 	    }
 	    goto no_data_clone;
-- 
2.39.2





More information about the pve-devel mailing list