[libvirt] [PATCH] cgroup: Don't fail to start a VM when DBus isn't compiled in or running

Peter Krempa pkrempa at redhat.com
Wed Aug 14 13:39:48 UTC 2013


The systemd code to create cgroups has fallback means built in, but
fails to engage them if a host isn't running DBus or libvirtd is
compiled without DBus (yes, you still don't need to run DBus).

This patch changes the return value in case DBus isn't available to so
that the fallback code can be activated and cgroups are created
manually.
---
 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 251b846..25fcf96 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 (!(conn = virDBusGetSystemBus())) {
+        virResetLastError();
+        return -2;
+    }

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




More information about the libvir-list mailing list