Re: [PATCH v2] DBus: introduce virDBusIsServiceEnabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 11, 2013 at 01:50:27PM +0100, Daniel P. Berrange wrote:
> On Wed, Sep 11, 2013 at 11:15:02AM +0800, Gao feng wrote:
> > This patch introduces virDBusIsServiceEnabled, we can use
> > this method to get if the service is supported.
> > 
> > In one case, if org.freedesktop.machine1 is unavailable on
> > host, we should skip creating machine through systemd.
> > 
> > Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
> > ---
> >  src/util/virdbus.c    | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  src/util/virdbus.h    |  1 +
> >  src/util/virsystemd.c | 17 +++++--------
> >  3 files changed, 73 insertions(+), 11 deletions(-)
> > 
> > diff --git a/src/util/virdbus.c b/src/util/virdbus.c
> > index 62c31be..ad3045a 100644
> > --- a/src/util/virdbus.c
> > +++ b/src/util/virdbus.c
> > @@ -1207,6 +1207,66 @@ int virDBusMessageRead(DBusMessage *msg,
> >      return ret;
> >  }
> >  
> > +/**
> > + * virDBusIsServiceEnabled:
> > + * @name: service name
> > + *
> > + * Retruns 0 if service is available, -1 on fatal error, or -2 if service is not available
> > + */
> > +int virDBusIsServiceEnabled(const char *name)
> > +{
> > +    DBusConnection *conn;
> > +    DBusMessage *reply = NULL;
> > +    DBusMessageIter iter, sub;
> > +    int ret = -1;
> > +
> > +    if (!virDBusHasSystemBus())
> > +        return -2;
> > +
> > +    conn = virDBusGetSystemBus();
> > +
> > +    if (virDBusCallMethod(conn,
> > +                          &reply,
> > +                          "org.freedesktop.DBus",
> > +                          "/org/freedesktop/DBus",
> > +                          "org.freedesktop.DBus",
> > +                          "ListActivatableNames",
> > +                          DBUS_TYPE_INVALID) < 0) {
> > +
> > +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > +                       _("ListActivatableNames failed"));
> 
> ACK, but no need for this, since virDBusCallMethod will already have
> reported the error.
> 
> I'll remove this virReportError and push it, so no need to repost.

I suck for forgetting to run 'make check' before pushing. I've just applied
a fix for the test suite problems.

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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]