[pve-devel] applied: [PATCH qemu-server] start: fork before entering scope

Thomas Lamprecht t.lamprecht at proxmox.com
Tue May 8 09:26:43 CEST 2018


Am 05/07/2018 um 12:09 PM schrieb Wolfgang Bumiller:
> To avoid potential cleanup & post-start actions to cause
> unwanted processes (such as gpg-agent) to be started as part
> of the scope, as the enter_systemd_scope() function causes
> the current process to enter the scope.
> 

makes sense to me to not bring the parent process into the scope,
tested a bit around, found no regressions, as expected from this:

applied

> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---
> This either fixes the 'scope already exists' issue some people have with
> backups, or narrows it down to something that happens from out of
> qemu...
> 
>   PVE/QemuServer.pm | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 015c725..0c63d6c 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -4841,6 +4841,13 @@ sub vm_start {
>   	}
>   	$properties{timeout} = 10 if $statefile; # setting up the scope shoul be quick
>   
> +	my $run_qemu = sub {
> +	    PVE::Tools::run_fork sub {
> +		PVE::Tools::enter_systemd_scope($vmid, "Proxmox VE VM $vmid", %properties);
> +		run_command($cmd, %run_params);
> +	    };
> +	};
> +
>   	if ($conf->{hugepages}) {
>   
>   	    my $code = sub {
> @@ -4850,11 +4857,7 @@ sub vm_start {
>   		PVE::QemuServer::Memory::hugepages_mount();
>   		PVE::QemuServer::Memory::hugepages_allocate($hugepages_topology, $hugepages_host_topology);
>   
> -		eval  {
> -		    PVE::Tools::enter_systemd_scope($vmid, "Proxmox VE VM $vmid", %properties);
> -		    run_command($cmd, %run_params);
> -		};
> -
> +		eval { $run_qemu->() };
>   		if (my $err = $@) {
>   		    PVE::QemuServer::Memory::hugepages_reset($hugepages_host_topology);
>   		    die $err;
> @@ -4865,10 +4868,7 @@ sub vm_start {
>   	    eval { PVE::QemuServer::Memory::hugepages_update_locked($code); };
>   
>   	} else {
> -	    eval  {
> -		PVE::Tools::enter_systemd_scope($vmid, "Proxmox VE VM $vmid", %properties);
> -		run_command($cmd, %run_params);
> -	    };
> +	    eval { $run_qemu->() };
>   	}
>   
>   	if (my $err = $@) {
> 





More information about the pve-devel mailing list