From 8ffdc11670931ad52df9627968b360e81701383f Mon Sep 17 00:00:00 2001 From: Oguz Bektas Date: Thu, 25 Feb 2021 15:11:16 +0100 Subject: [PATCH] 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 --- src/PVE/API2/LXC.pm | 3 +++ 1 file changed, 3 insertions(+) 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) { -- 2.39.5