[pve-devel] applied: [PATCH container] fix #2117: don't keep custom idmap in pct pipe restore
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Mar 4 13:42:44 CET 2019
On 3/4/19 11:02 AM, Oguz Bektas wrote:
> while doing a pct restore operation, custom id mappings were being
> obtained from the archive file to be used in the newly created container.
> this fails when using pipe restore, since there is no file for the
> mappings to be recovered from.
>
> Co-Authored by: Mira Limbeck <m.limbeck at proxmox.com>
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
> src/PVE/API2/LXC.pm | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
applied, with a small followup moving the my $orig_conf to the scope it's used,
thanks!
>
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 27d26d5..1cc2979 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
> @@ -331,10 +331,11 @@ __PACKAGE__->register_method({
> my $vollist = [];
> eval {
> my $orig_mp_param; # only used if $restore
> + my $orig_conf;
> if ($restore) {
> die "can't overwrite running container\n" if PVE::LXC::check_running($vmid);
> - (my $orig_conf, $orig_mp_param) = PVE::LXC::Create::recover_config($archive);
> - if ($is_root) {
> + if ($is_root && $archive ne '-') {
> + ($orig_conf, $orig_mp_param) = PVE::LXC::Create::recover_config($archive);
> # When we're root call 'restore_configuration' with ristricted=0,
> # causing it to restore the raw lxc entries, among which there may be
> # 'lxc.idmap' entries. We need to make sure that the extracted contents
> @@ -344,6 +345,9 @@ __PACKAGE__->register_method({
> }
> if ($storage_only_mode) {
> if ($restore) {
> + if (!defined $orig_mp_param) {
> + (undef, $orig_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});
>
More information about the pve-devel
mailing list