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

Maximiliano Sandoval m.sandoval at proxmox.com
Tue Nov 19 12:53:38 CET 2024


Gabriel Goller <g.goller at proxmox.com> writes:

> @@ -1066,7 +1061,12 @@ sub update_net {
>  		if ($have_sdn && $bridge_changed) {
>  		    PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
>  		}
> -		PVE::LXC::net_tap_plug($veth, $newnet);
> +		eval { PVE::LXC::net_tap_plug($veth, $newnet) };
> +		if ($@) {
> +		    my $err = $@;

		if (my $err = $@) {

Small nit, is a bit nicer.

> +		    PVE::LXC::net_tap_plug($veth, $oldnet);
> +		    die "$err\n";
> +		}
>
>  		# This includes the rate:
>  		foreach (qw(bridge tag firewall rate link_down)) {





More information about the pve-devel mailing list