public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Gabriel Goller <g.goller@proxmox.com>
Subject: [pve-devel] applied: [PATCH container] fix: avoid invalid config creation on hotplug failure
Date: Tue, 19 Nov 2024 14:07:56 +0100	[thread overview]
Message-ID: <8e46917a-48d6-4ee0-9717-9670afa24908@proxmox.com> (raw)
In-Reply-To: <20241119112913.211216-1-g.goller@proxmox.com>

I changed subject prefix to "network config:"

Am 19.11.24 um 12:29 schrieb Gabriel Goller:
> If the hotplug of an interface on a lxc container fails for whatever
> reason, the configuration will be broken and needs to manually fixed.
> 
> For example when adding a network interface with a bridge to a evpn vnet
> (which doesn't support vlans) and we add a vlan tag, the interface will
> be created even though we get an error. This will result in a broken
> config (a interface without a bridge), which will cause the container to
> not start anymore. Furthermore the veth interface will remain in a
> `nomaster` state, which means the interface isn't connected to anything.
> To solve this you would need to remove the interface manually from the
> config.
> 
> To fix this we remove the logic that writes the intermediary config as
> the config is wrong. This obviously reduces the consistency of the
> config in some way, although that shouldn't be a problem (as it's
> illegal anyway). We also need to revert to the old config in case the
> new config can't be applied.
> 
> We also abort the api handler if we get an error updating the pending
> config – this is not really necessary in this case, as we refrain from
> writing the bad config completely. But it is nevertheless a good
> practice because we won't write any other potentially bad config which
> was produced during an erroneous pending config update.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/API2/LXC/Config.pm |  3 +++
>  src/PVE/LXC.pm             | 12 ++++++------
>  2 files changed, 9 insertions(+), 6 deletions(-)
> 
>

applied, thanks!

made a small follow-up for handling potential error from the rollback and
implementing Maximiliano's code style suggestion.


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

      parent reply	other threads:[~2024-11-19 13:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 11:29 [pve-devel] " Gabriel Goller
2024-11-19 11:53 ` Maximiliano Sandoval
2024-11-19 13:07 ` Thomas Lamprecht [this message]

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=8e46917a-48d6-4ee0-9717-9670afa24908@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=g.goller@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