render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
43fe83
From fb07bc1b5ac1e2cf3f0695de658e64ee79e84d54 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <fb07bc1b5ac1e2cf3f0695de658e64ee79e84d54.1381871412.git.jdenemar@redhat.com>
43fe83
From: Peter Krempa <pkrempa@redhat.com>
43fe83
Date: Mon, 14 Oct 2013 16:45:12 +0100
43fe83
Subject: [PATCH] virsystemd: Don't fail to start VM if DBus isn't available or
43fe83
 compiled in
43fe83
43fe83
For
43fe83
43fe83
  https://bugzilla.redhat.com/show_bug.cgi?id=1018730
43fe83
43fe83
On hosts that don't have the DBus service running or installed the new
43fe83
systemd cgroups code failed with hard error instead of falling back to
43fe83
"manual" cgroup creation.
43fe83
43fe83
Use the new helper to check for the system bus and use the fallback code
43fe83
in case it isn't available.
43fe83
43fe83
(cherry picked from commit ee3db56fe9d47f547c07e7e0f6475e7f7a0eea7f)
43fe83
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 src/util/virsystemd.c | 6 ++++--
43fe83
 1 file changed, 4 insertions(+), 2 deletions(-)
43fe83
43fe83
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
43fe83
index d0063a1..13370b5 100644
43fe83
--- a/src/util/virsystemd.c
43fe83
+++ b/src/util/virsystemd.c
43fe83
@@ -145,8 +145,10 @@ int virSystemdCreateMachine(const char *name,
43fe83
     char *username = NULL;
43fe83
     char *slicename = NULL;
43fe83
 
43fe83
-    if (!(conn = virDBusGetSystemBus()))
43fe83
-        return -1;
43fe83
+    if (!virDBusHasSystemBus())
43fe83
+        return -2;
43fe83
+
43fe83
+    conn = virDBusGetSystemBus();
43fe83
 
43fe83
     if (privileged) {
43fe83
         if (virAsprintf(&machinename, "%s-%s", drivername, name) < 0)
43fe83
-- 
43fe83
1.8.3.2
43fe83