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

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

On 08/14/2013 07:39 AM, Peter Krempa wrote:
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(-)
ACK, and worth having in 1.1.2.
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)
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 08/30/13 22:31, Eric Blake wrote:
On 08/14/2013 07:39 AM, Peter Krempa wrote:
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(-)
ACK, and worth having in 1.1.2.
This patch was overridden by a series of patches ( http://www.redhat.com/archives/libvir-list/2013-August/msg00845.html and the previous versions) as I found more issues with DBus while playing with the build after sending the initial patch, but I forgot to self-NACK this version :/ Sorry for wasting your time with reviewing this. The series in question is already pushed. Peter
participants (2)
-
Eric Blake
-
Peter Krempa