When creating/changing the network interface of a container, the
parse_lxc_network can have side-effects, e.g., it adds a new random
MAC hwaddr if the netX format-string did not had any. Thus, we need
to call print_lxc_network again in order to have the correct,
up-to-date, property string in the config file.
Apparently this was a regression introduced with the pending changes
series.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
} elsif ($opt =~ m/^net(\d+)$/) {
my $netid = $1;
my $net = $class->parse_lxc_network($value);
} 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
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
if !$class->is_volume_in_use($conf, $conf->{$opt}, 1, 1);
}
}
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);