render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c401cc
From a28149b0990898255be8a8f17f66b429d14d6c42 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <a28149b0990898255be8a8f17f66b429d14d6c42@dist-git>
c401cc
From: Michal Privoznik <mprivozn@redhat.com>
c401cc
Date: Mon, 24 Feb 2014 13:12:03 +0100
c401cc
Subject: [PATCH] virSystemdCreateMachine: Set dependencies for slices
c401cc
c401cc
RHEL-7.0: https://bugzilla.redhat.com/show_bug.cgi?id=1032695
c401cc
F20: https://bugzilla.redhat.com/show_bug.cgi?id=1031696
c401cc
c401cc
When creating a new domain, we let systemd know about it by calling
c401cc
CreateMachine() function via dbus. Systemd then creates a scope and
c401cc
places domain into it. However, later when the host is shutting
c401cc
down, systemd computes the shutdown order to see what processes can
c401cc
be shut down in parallel. And since we were not setting
c401cc
dependencies at all, the slices (and thus domains) were most likely
c401cc
killed before libvirt-guests.service. So user domains that had to
c401cc
be saved, shut off, whatever were in fact killed.  This problem can
c401cc
be solved by letting systemd know that scopes we're creating must
c401cc
not be killed before libvirt-guests.service.
c401cc
c401cc
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c401cc
(cherry picked from commit ba79e3879e771417ee90e125d8b38743a867d7d1)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/util/virsystemd.c | 6 ++++--
c401cc
 1 file changed, 4 insertions(+), 2 deletions(-)
c401cc
c401cc
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
c401cc
index 503fff7..9247c92 100644
c401cc
--- a/src/util/virsystemd.c
c401cc
+++ b/src/util/virsystemd.c
c401cc
@@ -243,8 +243,10 @@ int virSystemdCreateMachine(const char *name,
c401cc
                           iscontainer ? "container" : "vm",
c401cc
                           (unsigned int)pidleader,
c401cc
                           rootdir ? rootdir : "",
c401cc
-                          1, "Slice", "s",
c401cc
-                          slicename) < 0)
c401cc
+                          3,
c401cc
+                          "Slice", "s", slicename,
c401cc
+                          "After", "as", 1, "libvirtd.service",
c401cc
+                          "Before", "as", 1, "libvirt-guests.service") < 0)
c401cc
         goto cleanup;
c401cc
 
c401cc
     ret = 0;
c401cc
-- 
c401cc
1.9.0
c401cc