]> git.proxmox.com Git - pve-container.git/commitdiff
clone: allow clone to same storage without specifying storage parameter
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 15 Mar 2018 12:01:07 +0000 (13:01 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 15 Mar 2018 13:10:58 +0000 (14:10 +0100)
src/PVE/API2/LXC.pm

index e59eb10ebd7bb1b90de303de004c1d73e30b0ea6..4c1912c079e93704cff114c32324727c66f8759d 100644 (file)
@@ -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);