]> git.proxmox.com Git - qemu-server.git/commitdiff
vm start: always reset any failed-state of the VM systemd scope
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Jun 2023 07:13:50 +0000 (09:13 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Jun 2023 07:14:47 +0000 (09:14 +0200)
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>
PVE/QemuServer.pm

index 02a2d528c81871d91fd2da463c17e0e438d2f029..35d3c1eb03070f7f9c40f0e9e95550e1e7451006 100644 (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...