[libvirt] [dbus PATCH v3 1/5] introduce support for GDBus implementation

Pavel Hrdina phrdina at redhat.com
Thu Mar 22 12:10:14 UTC 2018


On Wed, Mar 21, 2018 at 02:21:05PM +0000, Daniel P. Berrangé wrote:
> On Wed, Mar 21, 2018 at 11:02:43AM +0100, Pavel Hrdina wrote:
> > We will switch to GDBus implementation of D-Bus protocol because
> > sd-bus implementation is not thread safe.
> > 
> > Processing messages in threads is essential since Libvirt API can
> > take some significant amount of time to return and that would block
> > the whole libvirt-dbus daemon.
> > 
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> > 
> > Changes in v3:
> >   - fixed a bug while loading XML interface files, now it fails
> >     gracefully with error message
> > 
> > Changes in v2:
> >   - changed glib2 required version to 2.44.0, required for the
> >     auto-cleanup macros
> >   - changed libvirt-glib required version to 0.0.7
> > 
> >  README               |   1 +
> >  configure.ac         |  12 ++
> >  data/Makefile.am     |   5 +
> >  libvirt-dbus.spec.in |   6 +
> >  src/Makefile.am      |  17 ++-
> >  src/gdbus.c          | 398 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  src/gdbus.h          | 108 ++++++++++++++
> >  test/Makefile.am     |   3 +-
> >  test/travis-run      |   2 +-
> >  9 files changed, 547 insertions(+), 5 deletions(-)
> >  create mode 100644 src/gdbus.c
> >  create mode 100644 src/gdbus.h
> > 
> > diff --git a/README b/README
> > index 754d957..a85114e 100644
> > --- a/README
> > +++ b/README
> > @@ -58,6 +58,7 @@ The packages required to build libvirt-dbus are
> >  
> >   - systemd-211
> >   - libvirt
> > + - glib2
> >  
> >  Patches submissions
> >  ===================
> > diff --git a/configure.ac b/configure.ac
> > index df1a375..0e3bc01 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -11,10 +11,14 @@ AC_USE_SYSTEM_EXTENSIONS
> >  
> >  AM_SILENT_RULES([yes])
> >  
> > +GLIB2_REQUIRED=2.44.0
> >  LIBVIRT_REQUIRED=1.2.8
> >  SYSTEMD_REQUIRED=211
> > +LIBVIRT_GLIB_REQUIRED=0.0.7
> > +AC_SUBST([GLIB2_REQUIRED]) dnl used in the .spec file
> >  AC_SUBST([LIBVIRT_REQUIRED]) dnl used in the .spec file
> >  AC_SUBST([SYSTEMD_REQUIRED]) dnl used in the .spec file
> > +AC_SUBST([LIBVIRT_GLIB_REQUIRED]) dnl used in the .spec file
> >  
> >  LIBVIRT_DBUS_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
> >  LIBVIRT_DBUS_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
> > @@ -34,8 +38,11 @@ AC_PROG_MKDIR_P
> >  AM_PROG_CC_C_O
> >  AC_PROG_CC_STDC
> >  
> > +PKG_CHECK_MODULES(GIO2, gio-unix-2.0 >= GLIB2_REQUIRED)
> > +PKG_CHECK_MODULES(GLIB2, glib-2.0 >= GLIB2_REQUIRED)
> >  PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED)
> >  PKG_CHECK_MODULES(SYSTEMD, libsystemd >= $SYSTEMD_REQUIRED)
> > +PKG_CHECK_MODULES(LIBVIRT_GLIB, libvirt-glib-1.0 >= LIBVIRT_GLIB_REQUIRED)
> >  
> >  LIBVIRT_COMPILE_WARNINGS
> >  LIBVIRT_LINKER_RELRO
> > @@ -56,6 +63,11 @@ LIBVIRT_ARG_WITH([DBUS_SYSTEM_POLICIES], [where D-Bus system policies directory
> >  DBUS_SYSTEM_POLICIES_DIR="$with_dbus_system_policies"
> >  AC_SUBST(DBUS_SYSTEM_POLICIES_DIR)
> >  
> > +LIBVIRT_ARG_WITH([DBUS_INTERFACES], [where D-Bus interfaces directory is],
> > +                 ['$(datadir)/dbus-1/interfaces'])
> > +DBUS_INTERFACES_DIR="$with_dbus_interfaces"
> > +AC_SUBST([DBUS_INTERFACES_DIR])
> 
> FYI, you can actually get the default value for this from
> pkg-config
> 
>  $ pkgconf --variable interfaces_dir dbus-1
>  /usr/share/dbus-1/interfaces
> 
> And arguably don't need to make that configurable install dir
> at all with args. Not a blocker for this though, so fine if
> you patch that separately.
> 
> You would need a BuildRequires on dbus-devel to get the pkgconfig
> file though.

I was looking into it and the interfaces_dir variable was introduced
in dbus 1.9.2 which would not work on CentOS 7, where the dbus version
is 1.6.12.  Moreover, they don't have variable for policies dir, so
it might be better to keep it like it is.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180322/f83a9f04/attachment-0001.sig>


More information about the libvir-list mailing list