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 <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-06-21 09:13:50 +02:00
parent 728404c03d
commit 3d79cf5536

View File

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