From: Oguz Bektas Date: Thu, 25 Feb 2021 14:11:16 +0000 (+0100) Subject: fix #3313: restore: keep unprivileged status from archive config X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8ffdc11670931ad52df9627968b360e81701383f;p=pve-container.git fix #3313: restore: keep unprivileged status from archive config Since pct defaults to privileged containers, it restores the container as privileged when `--unprivileged 1` is not passed. Instead we should check the old configuration and retrieve it from there. This way, when one creates an unprivileged container, it will be still be unprivileged after restore, if not overwritten by API arguments. Signed-off-by: Oguz Bektas Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index 6af2bbf..df0cc88 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -362,6 +362,9 @@ __PACKAGE__->register_method({ # 'lxc.idmap' entries. We need to make sure that the extracted contents # of the container match up with the restored configuration afterwards: $conf->{lxc} = $orig_conf->{lxc} if $is_root; + + $conf->{unprivileged} = $orig_conf->{unprivileged} + if !defined($unprivileged) && defined($orig_conf->{unprivileged}); } } if ($storage_only_mode) {