From: Daniel P. Berrange Date: Tue, 11 Nov 2014 18:39:19 +0000 (+0000) Subject: Add systemd/dtrace probes for DBus APIs X-Git-Tag: v1.2.12-rc1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d83ce91fd4492c9267ffd2516dc24418b170a572;p=thirdparty%2Flibvirt.git Add systemd/dtrace probes for DBus APIs When debugging libvirt it is helpful to set probes around RPC calls. We already have probes for libvirt's native RPC layer, so it makes sense to add them for the DBus RPC layer too. --- diff --git a/src/libvirt_probes.d b/src/libvirt_probes.d index 340d665e82..c5bda5c974 100644 --- a/src/libvirt_probes.d +++ b/src/libvirt_probes.d @@ -15,6 +15,11 @@ provider libvirt { probe event_poll_run(int nfds, int timeout); + # file: src/util/virdbus.c + # prefix: dbus + probe dbus_method_call(const char *interface, const char *member, const char *object, const char *destination); + probe dbus_method_error(const char *interface, const char *member, const char *object, const char *destination, const char *name, const char *message); + probe dbus_method_reply(const char *interface, const char *member, const char *object, const char *destination); # file: src/util/virobject.c # prefix: object diff --git a/src/util/virdbus.c b/src/util/virdbus.c index ee8732c233..d9665c1f7f 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -27,6 +27,7 @@ #include "virlog.h" #include "virthread.h" #include "virstring.h" +#include "virprobe.h" #define VIR_FROM_THIS VIR_FROM_DBUS @@ -1521,20 +1522,35 @@ static int virDBusCall(DBusConnection *conn, DBusMessage *call, DBusMessage **replyout, - DBusError *error, - const char *member) + DBusError *error) + { DBusMessage *reply = NULL; DBusError localerror; int ret = -1; + const char *iface, *member, *path, *dest; if (!error) dbus_error_init(&localerror); + iface = dbus_message_get_interface(call); + member = dbus_message_get_member(call); + path = dbus_message_get_path(call); + dest = dbus_message_get_destination(call); + + PROBE(DBUS_METHOD_CALL, + "'%s.%s' on '%s' at '%s'", + iface, member, path, dest); + if (!(reply = dbus_connection_send_with_reply_and_block(conn, call, VIR_DBUS_METHOD_CALL_TIMEOUT_MILLIS, error ? error : &localerror))) { + PROBE(DBUS_METHOD_ERROR, + "'%s.%s' on '%s' at '%s' error %s: %s", + iface, member, path, dest, + error ? error->name : localerror.name, + error ? error->message : localerror.message); if (error) { ret = 0; } else { @@ -1544,6 +1560,10 @@ virDBusCall(DBusConnection *conn, goto cleanup; } + PROBE(DBUS_METHOD_REPLY, + "'%s.%s' on '%s' at '%s'", + iface, member, path, dest); + ret = 0; cleanup: @@ -1616,7 +1636,7 @@ int virDBusCallMethod(DBusConnection *conn, ret = -1; - ret = virDBusCall(conn, call, replyout, error, member); + ret = virDBusCall(conn, call, replyout, error); cleanup: if (call)