Errors during deletion of a mountpoint volume should not stop users from
destroying a container. Instead of failing, a warning is printed and the
destruction of the container continues.

Originally-by: Stefan Hrdlicka <s.hrdli...@proxmox.com>
 [ MK: remove ignore-storage-errors param ]
Signed-off-by: Michael Köppl <m.koe...@proxmox.com>
---
 src/PVE/LXC.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 2b9f0cf..20ff54e 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -953,7 +953,8 @@ sub destroy_lxc_container {
        return if $volids->{$volume};
        $volids->{$volume} = 1;
 
-       delete_mountpoint_volume($storage_cfg, $vmid, $volume);
+       eval { delete_mountpoint_volume($storage_cfg, $vmid, $volume); };
+       PVE::RESTEnvironment::log_warn("failed to delete mountpoint volume 
$volume: $@") if $@;
     };
     PVE::LXC::Config->foreach_volume_full($conf, {include_unused => 1}, 
$remove_volume);
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to