From: Fabian Ebner Date: Mon, 23 Mar 2020 11:18:51 +0000 (+0100) Subject: For clone+copy features, make sure a valid format for the target is supported X-Git-Url: https://git.proxmox.com/?p=pve-container.git;a=commitdiff_plain;h=4a954457e01295f6f319e7f968b2db9657f81c6b For clone+copy features, make sure a valid format for the target is supported 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 --- diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index a5aa5fc..ddf417b 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -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; diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm index 0909773..1434dc8 100644 --- a/src/PVE/LXC/Config.pm +++ b/src/PVE/LXC/Config.pm @@ -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;