[libvirt] [PATCHv2 2/3] virsystemd: Don't fail to start VM if DBus isn't available or compiled in

Peter Krempa pkrempa at redhat.com
Mon Aug 19 10:32:06 UTC 2013


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.
---
 src/util/virsystemd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 251b846..1c41ffc 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -145,8 +145,8 @@ int virSystemdCreateMachine(const char *name,
     char *username = NULL;
     char *slicename = NULL;

-    if (!(conn = virDBusGetSystemBus()))
-        return -1;
+    if (!(conn = virDBusHasSystemBus()))
+        return -2;

     if (privileged) {
         if (virAsprintf(&machinename, "%s-%s", drivername, name) < 0)
-- 
1.8.3.2




More information about the libvir-list mailing list