[libvirt] [PATCH] Add a systemtap script for watching QEMU monitor interactions

Eric Blake eblake at redhat.com
Wed Oct 26 21:16:21 UTC 2011


On 10/24/2011 08:37 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange at redhat.com>
>
> This change adds some systemtap/dtrace probes to the QEMU monitor
> client code. In particular it allows watching of all operations
> for a VM
>
> * examples/systemtap/qemu-monitor.stp: Watch all monitor commands
> * src/Makefile.am: Passing libdir/bindir/sbindir to dtrace2systemtap.pl
> * src/dtrace2systemtap.pl: Accept libdir/bindir/sbindir as args
>    and look for '# binary:' comment to mark probes against libvirtd
>    vs libvirt.so
> * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor_json.c,
>    src/qemu/qemu_monitor_text.c: Add probes for key functions
> ---
>   examples/systemtap/qemu-monitor.stp |   81 +++++++++++++++++++++++++++++++++++
>   src/Makefile.am                     |    2 +-
>   src/dtrace2systemtap.pl             |   15 ++++++-
>   src/probes.d                        |   20 +++++++++
>   src/qemu/qemu_monitor.c             |   31 ++++++++++++-
>   src/qemu/qemu_monitor_json.c        |    4 ++
>   src/qemu/qemu_monitor_text.c        |    3 +
>   7 files changed, 150 insertions(+), 6 deletions(-)
>   create mode 100644 examples/systemtap/qemu-monitor.stp

> @@ -66,7 +72,7 @@ while (<>) {
>   		die "unexpected data $_ on line $.";
>   	    }
>   	} else {
> -	    die "unexpected data $_ on line $.";
> +	    #die "unexpected data $_ on line $.";

Alon pointed this out.

> @@ -183,6 +183,8 @@ static void qemuMonitorFree(qemuMonitorPtr mon)
>   int qemuMonitorRef(qemuMonitorPtr mon)
>   {
>       mon->refs++;
> +    PROBE(QEMU_MONITOR_UNREF,
> +          "mon=%p refs=%d", mon, mon->refs);

It looks weird seeing an UNREF inside qemuMonitorRef.  Did you mean 
QEMU_MONITOR_REF?

ACK with those points addressed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list