merging $conf->{lxc} causes lxc.idmap entries to be duplicated in the
restored configuration. instead, we can overwrite the contents from the
extracted configuration file. this way we don't duplicate these entries.
(having duplicate idmap entries causes container to crash during start)

Co-developed-by: Stefan Reiter <s.rei...@proxmox.com>
Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
---
 src/PVE/LXC/Create.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm
index a46a50c..8b2cfc9 100644
--- a/src/PVE/LXC/Create.pm
+++ b/src/PVE/LXC/Create.pm
@@ -186,7 +186,9 @@ sub restore_configuration {
                    }
                    warn "--------------------------------\n";
                } else {
-                   @{$conf->{$key}} = (@$lxc_list, @{$conf->{$key}});
+                   # $conf->{lxc} can only have lxc.idmap
+                   # so we can overwrite the current $conf from $oldconf
+                   $conf->{$key} = $lxc_list;
                }
                next;
            }
-- 
2.20.1

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to