[pve-devel] [PATCH container 1/2] template_create: remove volume activation

Aaron Lauterer a.lauterer at proxmox.com
Fri Nov 26 11:19:37 CET 2021

This caused problems, especially with RBD volumes as they would get
mapped under the current vm-xxx-disk-y name and never unmapped. After
the rename to base-xxx-disk-y the old, now orphaned, mapping still
exists which can then cause problems when removing that MP or the whole
container as RBD won't let the image be removed. Only a manual `rbd
unmap` of the orphaned mapping or a reboot of the node would help.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
I am not sure why we activated the volumes anyway at this step as we do
not do that for VMs over in qemu-server. If we want to make sure they
are present we should probably rather use
PVE::Storage::activate_storage or activate_storage_list.

 src/PVE/LXC.pm | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index b07d986..ce10c55 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1241,8 +1241,6 @@ sub template_create {
 	my $volid = $mountpoint->{volume};
-	PVE::Storage::activate_volumes($storecfg, [$volid]);
 	my $template_volid = PVE::Storage::vdisk_create_base($storecfg, $volid);
 	$mountpoint->{volume} = $template_volid;
 	$conf->{$ms} = PVE::LXC::Config->print_ct_mountpoint($mountpoint, $ms eq "rootfs");

More information about the pve-devel mailing list