PVE::LXC::Create::restore_archive($archive, $rootdir, $conf, $ignore_unpack_errors);
if ($restore) {
- PVE::LXC::Create::restore_configuration($vmid, $rootdir, $conf);
+ PVE::LXC::Create::restore_configuration($vmid, $rootdir, $conf, $authuser ne 'root@pam');
} else {
my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir); # detect OS
PVE::LXC::Config->write_config($vmid, $conf); # safe config (after OS detection)
}
sub restore_configuration {
- my ($vmid, $rootdir, $conf) = @_;
+ my ($vmid, $rootdir, $conf, $restricted) = @_;
# restore: try to extract configuration from archive
next if $key eq 'digest' || $key eq 'rootfs' || $key eq 'snapshots' || $key eq 'unprivileged' || $key eq 'parent';
next if $key =~ /^mp\d+$/; # don't recover mountpoints
next if $key =~ /^unused\d+$/; # don't recover unused disks
+ if ($restricted && $key eq 'lxc') {
+ warn "skipping custom lxc options, restore manually as root:\n";
+ warn "--------------------------------\n";
+ my $lxc_list = $oldconf->{'lxc'};
+ foreach my $lxc_opt (@$lxc_list) {
+ warn "$lxc_opt->[0]: $lxc_opt->[1]\n"
+ }
+ warn "--------------------------------\n";
+ next;
+ }
$conf->{$key} = $oldconf->{$key} if !defined($conf->{$key});
}
unlink($pct_cfg_fn);