From: Dietmar Maurer Date: Thu, 15 Mar 2018 12:01:07 +0000 (+0100) Subject: clone: allow clone to same storage without specifying storage parameter X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d7b775db8b306b922f8492e02c06b0e29c10f4cd;p=pve-container.git clone: allow clone to same storage without specifying storage parameter --- diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index e59eb10..4c1912c 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1263,9 +1263,6 @@ __PACKAGE__->register_method({ my $storage = extract_param($param, 'storage'); - die "Full clone requires a target storage.\n" - if $param->{full} && !$storage; - my $localnode = PVE::INotify::nodename(); my $storecfg = PVE::Storage::config(); @@ -1385,7 +1382,8 @@ __PACKAGE__->register_method({ my $newvolid; if ($fullclone->{$opt}) { print "create full clone of mountpoint $opt ($volid)\n"; - $newvolid = PVE::LXC::copy_volume($mp, $newid, $storage, $storecfg, $newconf, $snapname); + my $target_storage = $storage // PVE::Storage::parse_volume_id($volid); + $newvolid = PVE::LXC::copy_volume($mp, $newid, $target_storage, $storecfg, $newconf, $snapname); } else { print "create linked clone of mount point $opt ($volid)\n"; $newvolid = PVE::Storage::vdisk_clone($storecfg, $volid, $newid, $snapname);