NAK, see inline

On September 10, 2019 3:27 pm, Oguz Bektas wrote:
> restore from unpriv to priv causes a problem with the log-in, since the
> /etc/securetty file isn't modified after a restore to reflect the change
> (/dev/lxc/tty1 and so on).
> 
> template_fixup is normally called in post_create_hook, but we have no 
> $password
> or $ssh_keys to call the hook with during restore. instead we call 
> template_fixup by
> itself to fix the ttys on some distributions.
> 
> Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
> ---
>  src/PVE/API2/LXC.pm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 26c4f88..738556b 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
> @@ -413,10 +413,11 @@ __PACKAGE__->register_method({
>                   $bwlimit = PVE::Storage::get_bandwidth_limit('restore', 
> [keys %used_storages], $bwlimit);
>                   PVE::LXC::Create::restore_archive($archive, $rootdir, 
> $conf, $ignore_unpack_errors, $bwlimit);
>  
> +                 my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir); # 
> detect OS

this makes decisions based on $conf (e.g., explicit 'ostype: unmanaged')

>                   if ($restore) {
>                       PVE::LXC::Create::restore_configuration($vmid, 
> $rootdir, $conf, !$is_root, $unique, $skip_fw_config_restore);

when restoring, the full $conf is only available here.

> +                     $lxc_setup->template_fixup($conf);
>                   } else {
> -                     my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir); 
> # detect OS
>                       PVE::LXC::Config->write_config($vmid, $conf); # safe 
> config (after OS detection)
>                       $lxc_setup->post_create_hook($password, $ssh_keys);
>                   }
> -- 
> 2.20.1
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to