clone disk: don't modify drive parameter

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>
This commit is contained in:
Fabian Ebner 2022-01-27 15:01:55 +01:00 committed by Fabian Grünbichler
parent bdf6ba1e7d
commit 3b53c47155

View File

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