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