]> git.proxmox.com Git - qemu-server.git/commitdiff
clone disk: don't modify drive parameter
authorFabian Ebner <f.ebner@proxmox.com>
Thu, 27 Jan 2022 14:01:55 +0000 (15:01 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 31 Jan 2022 12:10:33 +0000 (13:10 +0100)
While existing callers are not using the parameter after the call,
the modification is rather unexpected and could lead to bugs quickly.

Also avoid setting an undef value in the hash, but use delete instead.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/QemuServer.pm

index 4f531f2e507e28ae580724bf843b2c17ea64c28c..8aa19469303ee0e6951d646239d0031b0bab35cc 100644 (file)
@@ -7642,8 +7642,8 @@ sub clone_disk {
 no_data_clone:
     my ($size) = eval { PVE::Storage::volume_size_info($storecfg, $newvolid, 10) };
 
-    my $disk = $drive;
-    $disk->{format} = undef;
+    my $disk = dclone($drive);
+    delete $disk->{format};
     $disk->{file} = $newvolid;
     $disk->{size} = $size if defined($size);