[pve-devel] [PATCH qemu-server] start: fork before entering scope
Wolfgang Bumiller
w.bumiller at proxmox.com
Mon May 7 12:09:10 CEST 2018
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.
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 = $@) {
--
2.11.0
More information about the pve-devel
mailing list