Fixes bug #7092 as well as a regression [0] in combination with HA
shutdown policy 'migrate' caused by commit 1f2c5146 ("migrate: remove
left-over dbus-vmstate instance when migrating without conntrack
state"). Currently, the HA migrations do not migrate the conntrack
state and before this patch, the dbus.service is stopped too early
during shutdown, before the LRM migrations. This led to failure when
trying to check for a left-over dbus-vmstate instance, because
the Net::DBus->system() call would fail.

It is not enough to record the After=dbus.service dependency, because
systemd would already stop the vmid.scope even while processes in it
are still running. Add a Before=pve-ha-lrm.service and for consistency
Before=pve-guests.service to record the ordering on shutdown. This
ensures that the scope units are still around until the LRM or guests
service had the chance to stop, and usually, handle the remaining
running guests itself.

[0]: https://forum.proxmox.com/threads/169739/post-825256

Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7092
Co-developed-by: Maximiliano Sandoval <[email protected]>
Co-developed-by: Fabian Grünbichler <[email protected]>
Signed-off-by: Fiona Ebner <[email protected]>
---
 src/PVE/QemuServer.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index d634251b..69991843 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -5718,6 +5718,10 @@ sub vm_start_nolock {
         KillMode => 'process',
         SendSIGKILL => 0,
         TimeoutStopUSec => ULONG_MAX, # infinity
+        After => ['dbus.service'],
+        # The point is ordering the VMID.scope after these during stop.
+        # During start-up, the slice/scopes are not enabled.
+        Before => ['pve-ha-lrm.service', 'pve-guests.service'],
     );
 
     if (PVE::CGroup::cgroup_mode() == 2) {
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to