Seems to be a regression introduced with f360d7f16b094fa258cf82d2557d06f3284435e4 (related to #2028). $conf->{'lxc'} would always be defined, hence we never replaced it with the restored options.
We now merge LXC options individually. We can't just overwrite, since that would undo the fix mentioned above. Signed-off-by: Stefan Reiter <s.rei...@proxmox.com> --- src/PVE/LXC/Create.pm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm index 029c940..3f893e5 100644 --- a/src/PVE/LXC/Create.pm +++ b/src/PVE/LXC/Create.pm @@ -175,16 +175,27 @@ sub restore_configuration { # we know if it was a template in the restore API call and check if the target # storage supports creating a template there next if $key =~ /^template$/; - if ($restricted && $key eq 'lxc') { - warn "skipping custom lxc options, restore manually as root:\n"; - warn "--------------------------------\n"; + + if ($key eq 'lxc') { my $lxc_list = $oldconf->{'lxc'}; - foreach my $lxc_opt (@$lxc_list) { - warn "$lxc_opt->[0]: $lxc_opt->[1]\n" + if ($restricted) { + warn "skipping custom lxc options, restore manually as root:\n"; + warn "--------------------------------\n"; + foreach my $lxc_opt (@$lxc_list) { + warn "$lxc_opt->[0]: $lxc_opt->[1]\n" + } + warn "--------------------------------\n"; + } else { + # merge lxc options individually + $conf->{$key} = [] if !defined($conf->{$key}); + foreach my $lxc_opt (@$lxc_list) { + push(@{$conf->{$key}}, $lxc_opt) + if !grep {$_->{0} eq $lxc_opt->[0]} @{$conf->{$key}}; + } } - warn "--------------------------------\n"; next; } + if ($unique && $key =~ /^net\d+$/) { my $net = PVE::LXC::Config->parse_lxc_network($oldconf->{$key}); my $dc = PVE::Cluster::cfs_read_file('datacenter.cfg'); -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel