qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/2] help libvirt know what's up with qga


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 0/2] help libvirt know what's up with qga
Date: Thu, 29 May 2014 13:47:12 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 05/29/2014 01:36 PM, Laszlo Ersek wrote:
> In this series I try to implement the ideas that (I believe) were
> suggested by Gerd and Amit in
> <https://bugzilla.redhat.com/show_bug.cgi?id=1080376>.
> 
> When the guest agent exits or dies (disconnects from the virtio-serial
> port), the backend (eg. a host-side unix domain socket) doesn't (in
> general, can't) reflect it. This lack of info tends to trip up libvirt
> in some cases, waiting indefinitely for an agent that doesn't exist.
> 
> The series adds two monitor events that report about virtio-serial ports
> being opened and closed (for online notification), and extends the
> "query-chardev" QMP command's return type with a "frontend_open" bool
> (for querying at late libvirt startup).

Cool!

> 
> Admittedly, these two don't report on the same level (frontend vs.
> backend), but the association is under libvirt's control, so it should
> be fine, and it helps keep the series non-intrusive. (Also known as, "I
> have a fleeting chance implementing it, having authored neither chardev
> nor virtio-serial".)
> 
> The series can be tested with libvirt immediately, as follows:
> 
>   1. set up qga as usual
> 
>   2. add the following XML element under the /domain element in the
>      domain config:
> 
>      <qemu:commandline 
> xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
>        <qemu:arg value='-global'/>
>        <qemu:arg value='virtserialport.report_connstate=true'/>
>      </qemu:commandline>
> 
>      (libvirt ignores unrecognized events, see
>      qemuMonitorJSONIOProcessEvent())

Actually, while libvirt.so ignores unrecognized events, libvirt-qemu.so
understands them just fine!  You can set up:

virsh qemu-monitor-event $dom serport --no-case --regex --pretty --loop

to set up a listening loop that will fire on all case-insensitive events
matching the regex "serport" (basically, the two events added in this
patch) that occur on $dom, until you get tired and hit Ctrl-C.

> 
>   3. configure libvirtd to log QEMU monitor and agent traffic;
>      in "libvirtd.conf", set
> 
>      log_filters="1:qemu_monitor_ 1:qemu_agent"
>      log_outputs="1:file:/var/log/libvirt/libvirtd.log"

No need to resort to log snooping when you can just use virsh :)

> 
>   4. in the guest, start & stop the guest agent, and in lockstep:
>      - on the host, issue:
>        virsh qemu-monitor-command DOMAIN --pretty \
>            '{"execute":"query-chardev"}'
> 
>      - on the host, grep the libvirtd log for the new events:
>        egrep 'QEMU_MONITOR_RECV_EVENT: .*VSERPORT_(DIS)?CONNECTED' \
>            /var/log/libvirt/libvirtd.log
> 
> RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1080376
> 
> Laszlo Ersek (2):
>   virtio-serial: report frontend connection state via monitor
>   char: report frontend open/closed state in 'query-chardev'
> 
>  qapi-schema.json          |  8 +++++++-
>  include/monitor/monitor.h |  2 ++
>  hw/char/virtio-console.c  | 20 +++++++++++++++++---
>  monitor.c                 |  2 ++
>  qemu-char.c               |  2 ++
>  docs/qmp/qmp-events.txt   | 34 ++++++++++++++++++++++++++++++++++
>  qmp-commands.hx           | 19 ++++++++++++++-----
>  7 files changed, 78 insertions(+), 9 deletions(-)
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]