[pve-devel] [PATCH qemu-server] Create linked clone failed, uninitialized storage

Alwin Antreich a.antreich at proxmox.com
Fri Apr 5 14:35:45 CEST 2019


When creating a linked clone the storage parameter is not defined. The
get_bandwidth_limit method got a undef element for its storage_list and
therefore failed on trying to set the bandwidth limit.

This patch only pushes the storage parameter into the storage_list array
if it is defined.

Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 PVE/API2/Qemu.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 5469089..638455e 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2854,7 +2854,9 @@ __PACKAGE__->register_method({
 			my $skipcomplete = ($total_jobs != $i); # finish after last drive
 
 			my $src_sid = PVE::Storage::parse_volume_id($drive->{file});
-			my $clonelimit = PVE::Storage::get_bandwidth_limit('clone', [$src_sid, $storage], $bwlimit);
+			my $storage_list = [$src_sid];
+			push @$storage_list, $storage if (defined($storage));
+			my $clonelimit = PVE::Storage::get_bandwidth_limit('clone', $storage_list, $bwlimit);
 
 			my $newdrive = PVE::QemuServer::clone_disk($storecfg, $vmid, $running, $opt, $drive, $snapname,
 								   $newid, $storage, $format, $fullclone->{$opt}, $newvollist,
-- 
2.11.0





More information about the pve-devel mailing list