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 <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Alwin Antreich 2019-04-05 14:35:45 +02:00 committed by Thomas Lamprecht
parent c68305a497
commit ee43cd487c

View File

@ -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,