]> git.proxmox.com Git - qemu-server.git/commitdiff
fix creating clone if target storage is same as source storage
authorAlwin Antreich <a.antreich@proxmox.com>
Fri, 5 Apr 2019 12:35:45 +0000 (14:35 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 5 Apr 2019 12:46:53 +0000 (14:46 +0200)
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>
PVE/API2/Qemu.pm

index 54690896d009b07978c1a5fc701b240cf2fd1196..638455e2f6c3100d45346ec14bd721921d9a1d2a 100644 (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,