prevent partial storage deletion if the template has a linked clone container
Signed-off-by: Stefan Hrdlicka <s.hrdli...@proxmox.com> --- src/PVE/LXC.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index fe68f75..7164462 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -865,6 +865,18 @@ sub destroy_lxc_container { $purge_unreferenced, $ignore_storage_errors) = @_; my $volids = {}; + + if ($conf->{template}) { + PVE::LXC::Config->foreach_volume_full($conf, {incldue_unused => 1}, sub { + my ($ms, $mountpoint) = @_; + my $volid = $mountpoint->{volume}; + return if !$volid || $volid =~ m|^/|; + my $result; + eval{ $result = PVE::Storage::volume_is_base_and_used($storage_cfg, $volid) }; + die "base volume '$volid' is still in use by linked cloned\n" if $result; + }); + } + my $remove_volume = sub { my ($ms, $mountpoint) = @_; -- 2.30.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel