[pve-devel] applied: [PATCH container] fix #2453: actually write random MAC addresses in config

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Nov 6 17:59:07 CET 2019


On 11/6/19 3:58 PM, Oguz Bektas wrote:
> apparently this was a regression introduced with the pending changes series.
> when creating/changing the network interface of a container, we need to use
> $print_lxc_network in order to have the correct property string in the config
> file.
> 
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
>  src/PVE/LXC/Config.pm | 5 +++++
>  1 file changed, 5 insertions(+)
> 

applied, but noted in the commit message that the side-effects from
parse_lxc_network cause the need for this. Thanks!

> diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
> index 2699d3d..7e51b8d 100644
> --- a/src/PVE/LXC/Config.pm
> +++ b/src/PVE/LXC/Config.pm
> @@ -1211,6 +1211,7 @@ sub vmconfig_hotplug_pending {
>  	    } elsif ($opt =~ m/^net(\d+)$/) {
>  		my $netid = $1;
>  		my $net = $class->parse_lxc_network($value);
> +		$value = $class->print_lxc_network($net);
>  		PVE::LXC::update_net($vmid, $conf, $opt, $net, $netid, $rootdir);
>  	    } elsif ($opt eq 'memory' || $opt eq 'swap') {
>  		if (!$hotplug_memory_done) { # don't call twice if both opts are passed
> @@ -1297,6 +1298,10 @@ sub vmconfig_apply_pending {
>  			    if !$class->is_volume_in_use($conf, $conf->{$opt}, 1, 1);
>  		    }
>  		}
> +	    } elsif ($opt =~ m/^net(\d+)$/) {
> +		my $netid = $1;
> +		my $net = $class->parse_lxc_network($conf->{pending}->{$opt});
> +		$conf->{pending}->{$opt} = $class->print_lxc_network($net);
>  	    }
>  	};
>  	if (my $err = $@) {
> 





More information about the pve-devel mailing list