From 3bfbd9003ddfc241a1fd8860bdea349aed2dd6c5 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Mon, 23 Mar 2020 12:18:53 +0100 Subject: [PATCH] fix #1904: convert to base image when moving a volume of a template Signed-off-by: Fabian Ebner --- src/PVE/API2/LXC.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index c724118..307fd90 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1818,7 +1818,13 @@ __PACKAGE__->register_method({ my $source_storage = PVE::Storage::parse_volume_id($old_volid); my $movelimit = PVE::Storage::get_bandwidth_limit('move', [$source_storage, $storage], $bwlimit); $new_volid = PVE::LXC::copy_volume($mpdata, $vmid, $storage, $storage_cfg, $conf, undef, $movelimit); - $mpdata->{volume} = $new_volid; + if (PVE::LXC::Config->is_template($conf)) { + PVE::Storage::activate_volumes($storage_cfg, [ $new_volid ]); + my $template_volid = PVE::Storage::vdisk_create_base($storage_cfg, $new_volid); + $mpdata->{volume} = $template_volid; + } else { + $mpdata->{volume} = $new_volid; + } PVE::LXC::Config->lock_config($vmid, sub { my $digest = $conf->{digest}; -- 2.39.2