From ee43cd487c6a39180a0c6a68389e2050ddd5b4e4 Mon Sep 17 00:00:00 2001 From: Alwin Antreich Date: Fri, 5 Apr 2019 14:35:45 +0200 Subject: [PATCH] fix creating clone if target storage is same as source storage the clone API calls (target) 'storage' parameter is optional as we simply use the source storage in this case, but we did not handle this case when we added the bandwidth_limit abillity, address that. This patch only pushes the storage parameter into the storage_list array if it is defined. Signed-off-by: Alwin Antreich Signed-off-by: Thomas Lamprecht --- 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.39.2