[pve-devel] applied: [PATCH container] fix: avoid invalid config creation on hotplug failure

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Nov 19 14:07:56 CET 2024


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




More information about the pve-devel mailing list