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

Daniel P. Berrange berrange at redhat.com
Fri Aug 16 15:47:23 UTC 2013


On Fri, Aug 16, 2013 at 04:48:31PM +0200, 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.
> 
> Additionally, the functions no longer report errors as they were
> reported over and over again and were no hard errors.
> ---
>  daemon/libvirtd.c                 |  2 +-
>  daemon/remote.c                   |  2 +-
>  src/node_device/node_device_hal.c |  2 +-
>  src/nwfilter/nwfilter_driver.c    |  4 ++--
>  src/rpc/virnetserver.c            |  2 +-
>  src/util/virdbus.c                | 15 ++++++++-------
>  src/util/virdbus.h                |  2 +-
>  src/util/virsystemd.c             |  4 ++--
>  8 files changed, 17 insertions(+), 16 deletions(-)

> diff --git a/src/util/virdbus.h b/src/util/virdbus.h
> index 39de479..a30dbc3 100644
> --- a/src/util/virdbus.h
> +++ b/src/util/virdbus.h
> @@ -31,7 +31,7 @@
>  # endif
>  # include "internal.h"
> 
> -DBusConnection *virDBusGetSystemBus(void);
> +DBusConnection *virDBusGetSystemBus(bool fatal);
>  DBusConnection *virDBusGetSessionBus(void);

I'm really not at all a fan of 'bool fatal' like args to control
error reporting.

I think in this case we should have a

   bool virDBusHasSystemBus(void)

method, which calls can use to determine if dbus is available. If
not available then they can take a separate codepath as needed.

This avoids the need to try something we expect to fail and then
try to discard the errors.

This would make the first patch uneccessary too.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list