From 62a991db9be664dd6743ae81c7f37143b0993393 Mon Sep 17 00:00:00 2001 From: Daniel Tschlatscher Date: Tue, 29 Nov 2022 15:00:19 +0100 Subject: [PATCH] restore: also remove firewall config after failed restore Before, a failed restore would only remove the container config, but the firewall config would remain. Now, the firewall config is also removed, except for the case when the user only has the VM.Backup permission. In this case the firewall would not have been restored/changed by us and is left as is. Signed-off-by: Daniel Tschlatscher --- src/PVE/API2/LXC.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index f2113de..50c9eaf 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -499,6 +499,11 @@ __PACKAGE__->register_method({ if ($destroy_config_on_error) { eval { PVE::LXC::Config->destroy_config($vmid) }; warn $@ if $@; + + if (!$skip_fw_config_restore) { # Only if user has permission to change the fw + PVE::Firewall::remove_vmfw_conf($vmid); + warn $@ if $@; + } } die "$emsg $err"; } -- 2.39.5