]> git.proxmox.com Git - pve-container.git/commitdiff
fix #2028: keep custom uid mapping during restore
authorOguz Bektas <o.bektas@proxmox.com>
Thu, 27 Dec 2018 11:52:25 +0000 (12:52 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 27 Dec 2018 12:49:29 +0000 (13:49 +0100)
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
src/PVE/API2/LXC.pm

index 6b3395bea1e2d0bbf149fadd5576869b7b97197b..99bfd15a978bce7c6eee943a63679c3e9115d668 100644 (file)
@@ -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@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 {