]> git.proxmox.com Git - pve-container.git/commitdiff
For clone+copy features, make sure a valid format for the target is supported
authorFabian Ebner <f.ebner@proxmox.com>
Mon, 23 Mar 2020 11:18:51 +0000 (12:18 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 27 Mar 2020 07:50:46 +0000 (08:50 +0100)
using the new option valid_target_formats. This is
necessary, because clone_image can result in a qcow2 image
being created (on directory based storages) which is not
valid for LXC.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
src/PVE/API2/LXC.pm
src/PVE/LXC/Config.pm

index a5aa5fc1b5ad781472a098fb4e1388d032979585..ddf417bf3f104b8ffe35237b6c8a4499ec869d22 100644 (file)
@@ -1440,7 +1440,7 @@ __PACKAGE__->register_method({
                            } else {
                                # not full means clone instead of copy
                                die "Linked clone feature for '$volid' is not available\n"
-                                   if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid, $snapname, $running);
+                                   if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid, $snapname, $running, {'valid_target_formats' => ['raw', 'subvol']});
                            }
 
                            $mountpoints->{$opt} = $mp;
index 0909773f312432526d2f64f5ca42e1f06681b437..1434dc8ec4425a5c1bb5e1da875a10c4c6f44a2e 100644 (file)
@@ -62,6 +62,11 @@ sub has_feature {
     my ($class, $feature, $conf, $storecfg, $snapname, $running, $backup_only) = @_;
     my $err;
 
+    my $opts;
+    if ($feature eq 'copy' || $feature eq 'clone') {
+       $opts = {'valid_target_formats' => ['raw', 'subvol']};
+    }
+
     $class->foreach_mountpoint($conf, sub {
        my ($ms, $mountpoint) = @_;
 
@@ -71,7 +76,7 @@ sub has_feature {
        $err = 1
            if !PVE::Storage::volume_has_feature($storecfg, $feature,
                                                 $mountpoint->{volume},
-                                                $snapname, $running);
+                                                $snapname, $running, $opts);
     });
 
     return $err ? 0 : 1;