]> git.proxmox.com Git - pve-container.git/commitdiff
fix #1904: convert to base image when moving a volume of a template
authorFabian Ebner <f.ebner@proxmox.com>
Mon, 23 Mar 2020 11:18:53 +0000 (12:18 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 27 Mar 2020 07:50:46 +0000 (08:50 +0100)
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
src/PVE/API2/LXC.pm

index c7241185c6f01b1c335ed574cd20c2ea1096a56e..307fd907e2e83321ca22342b0cea010785d284d7 100644 (file)
@@ -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};