[pve-devel] [RFC container] fix #2028: keep custom uid mapping during restore
Oguz Bektas
o.bektas at proxmox.com
Thu Dec 27 12:52:25 CET 2018
Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
src/PVE/API2/LXC.pm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 6b3395b..99bfd15 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -357,11 +357,14 @@ __PACKAGE__->register_method({
PVE::Cluster::check_cfs_quorum();
my $vollist = [];
-
eval {
+ my ($orig_conf, $orig_mp_param) = PVE::LXC::Create::recover_config($archive);
+ if ($authuser eq 'root at pam') {
+ @{$conf->{lxc}} = [grep { $_->[0] eq 'lxc.idmap' } @{$orig_conf->{lxc}}]; # do not remove lxc.idmap entries
+ }
if ($storage_only_mode) {
if ($restore) {
- (undef, $mp_param) = PVE::LXC::Create::recover_config($archive);
+ $mp_param = $orig_mp_param;
die "rootfs configuration could not be recovered, please check and specify manually!\n"
if !defined($mp_param->{rootfs});
PVE::LXC::Config->foreach_mountpoint($mp_param, sub {
--
2.11.0
More information about the pve-devel
mailing list