5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-10 01:18:01 +03:00

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 <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2018-02-16 12:44:58 +01:00 committed by Fabian Grünbichler
parent 230406dc52
commit 3c23aa808c

View File

@ -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}