]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virSystemdCreateMachine: Set dependencies for slices
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 21 Feb 2014 09:16:36 +0000 (10:16 +0100)
committerCole Robinson <crobinso@redhat.com>
Mon, 10 Mar 2014 13:16:35 +0000 (09:16 -0400)
https://bugzilla.redhat.com/show_bug.cgi?id=1031696

When creating a new domain, we let systemd know about it by calling
CreateMachine() function via dbus. Systemd then creates a scope and
places domain into it. However, later when the host is shutting
down, systemd computes the shutdown order to see what processes can
be shut down in parallel. And since we were not setting
dependencies at all, the slices (and thus domains) were most likely
killed before libvirt-guests.service. So user domains that had to
be saved, shut off, whatever were in fact killed.  This problem can
be solved by letting systemd know that scopes we're creating must
not be killed before libvirt-guests.service.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit ba79e3879e771417ee90e125d8b38743a867d7d1)

src/util/virsystemd.c

index 1ba37ccdfe74338748cb40342bc3e099eab133b6..4e2721bda7b5cd933fd8ce7c96e818f456735353 100644 (file)
@@ -242,8 +242,10 @@ int virSystemdCreateMachine(const char *name,
                           iscontainer ? "container" : "vm",
                           (unsigned int)pidleader,
                           rootdir ? rootdir : "",
-                          1, "Slice", "s",
-                          slicename) < 0)
+                          3,
+                          "Slice", "s", slicename,
+                          "After", "as", 1, "libvirtd.service",
+                          "Before", "as", 1, "libvirt-guests.service") < 0)
         goto cleanup;
 
     ret = 0;