From 3d79cf5536e43ca10b8f5a98df3fefbcbfd56d00 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 21 Jun 2023 09:13:50 +0200 Subject: [PATCH] vm start: always reset any failed-state of the VM systemd scope The scope can get into failed state for some issues like OOM kills of the whole scope, in that case a user cannot re-start the VM until they manually reset it. Do this for now inline to avoid a pve-common bump as done in [0] (location was suggested by me thinking we could maybe do it over dbus, but as we have a stop command here already it probably doesn't matters) [0]: https://lists.proxmox.com/pipermail/pve-devel/2023-June/057770.html Originally-by: Fiona Ebner Signed-off-by: Thomas Lamprecht --- PVE/QemuServer.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 02a2d528..35d3c1eb 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5873,6 +5873,7 @@ sub vm_start_nolock { my %silence_std_outs = (outfunc => sub {}, errfunc => sub {}); + eval { run_command(['/bin/systemctl', 'reset-failed', "$vmid.scope"], %silence_std_outs) }; eval { run_command(['/bin/systemctl', 'stop', "$vmid.scope"], %silence_std_outs) }; # Issues with the above 'stop' not being fully completed are extremely rare, a very low # timeout should be more than enough here...