From 3c23aa808ccc946bad92d9bc63b6f833c61d0f52 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 16 Feb 2018 12:44:58 +0100 Subject: [PATCH] start: always stop an existing $vmid.scope Checking for the cgroup directory is a kind of time-of-check time-of-use race condition stop-mode backups seem to occasionally run into on some systems. Signed-off-by: Wolfgang Bumiller --- PVE/QemuServer.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 628ca33..7d0f65c 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -4894,10 +4894,11 @@ sub vm_start { PVE::Storage::activate_volumes($storecfg, $vollist); - if (!check_running($vmid, 1) && -d "/sys/fs/cgroup/systemd/qemu.slice/$vmid.scope") { - my $cmd = []; - push @$cmd, '/bin/systemctl', 'stop', "$vmid.scope"; - eval { run_command($cmd); }; + if (!check_running($vmid, 1)) { + eval { + run_command(['/bin/systemctl', 'stop', "$vmid.scope"], + outfunc => sub {}, errfunc => sub {}); + }; } my $cpuunits = defined($conf->{cpuunits}) ? $conf->{cpuunits} -- 2.39.2