mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 16:15:19 +00:00
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.
This commit is contained in:
parent
318df5a05f
commit
d83ce91fd4
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user