On 11/20/19 3:49 PM, Oguz Bektas wrote:
> this allows pending changes to be applied when a reboot is issued inside
> the container.
> 
> Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
> ---
>  src/lxc-pve-prestart-hook | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook
> index c0965ab..b44b69a 100755
> --- a/src/lxc-pve-prestart-hook
> +++ b/src/lxc-pve-prestart-hook
> @@ -29,11 +29,18 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub {
>      return undef if ! -f PVE::LXC::Config->config_file($vmid);
>  
>      my $conf = PVE::LXC::Config->load_config($vmid);
> +    my $storage_cfg = PVE::Storage::config();
> +
> +    # apply pending changes if present
> +    if ($conf->{pending}) {
> +     PVE::LXC::Config->vmconfig_apply_pending($vmid, $conf, $storage_cfg);
> +     $conf = PVE::LXC::Config->load_config($vmid); # just to be sure
> +    }
> +
>      if (!$skiplock && !PVE::LXC::Config->has_lock($conf, 'mounted')) {
>       PVE::LXC::Config->check_lock($conf);
>      }
>  
> -    my $storage_cfg = PVE::Storage::config();
>  
>      my $vollist = PVE::LXC::Config->get_vm_volumes($conf);
>      my $loopdevlist = PVE::LXC::Config->get_vm_volumes($conf, 'rootfs');
> 

OK, Wolfgang talked to me and this does not makes sense for a lot
of changes, the LXC config was already written out, and LXC does not
care about changes to it at this point. So we'd need to do it as in
the stop hook for the next start. Funnily I tested something which
works as hotplug too, so did not noticed it :/

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

Reply via email to