public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container v2 2/2] restore: also remove firewall config after failed restore
Date: Tue, 29 Nov 2022 15:00:19 +0100	[thread overview]
Message-ID: <20221129140019.203126-2-d.tschlatscher@proxmox.com> (raw)
In-Reply-To: <20221129140019.203126-1-d.tschlatscher@proxmox.com>

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 <d.tschlatscher@proxmox.com>
---
Changes from v1:
* Moved into destroy_config_on_error check

 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.30.2





  reply	other threads:[~2022-11-29 14:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 14:00 [pve-devel] [PATCH container v2 1/2] restore: clean up config when invalid source archive is given Daniel Tschlatscher
2022-11-29 14:00 ` Daniel Tschlatscher [this message]
2022-12-22 12:54 ` [pve-devel] applied-series: " Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221129140019.203126-2-d.tschlatscher@proxmox.com \
    --to=d.tschlatscher@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal