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

Oguz Bektas o.bektas at proxmox.com
Wed Nov 6 15:58:55 CET 2019


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(+)

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 = $@) {
-- 
2.20.1




More information about the pve-devel mailing list