diff options
author | Laszlo Ersek <lersek@redhat.com> | 2014-06-26 17:50:02 +0200 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-06-27 09:33:27 -0400 |
commit | e2ae6159de2482ee5e22532301eb7f2795828d07 (patch) | |
tree | cc35e7385fc1befbb12608953f277f6cc9800700 /hw | |
parent | dfab489214bcf88f1b81796118aaae3808620604 (diff) | |
download | hqemu-e2ae6159de2482ee5e22532301eb7f2795828d07.zip hqemu-e2ae6159de2482ee5e22532301eb7f2795828d07.tar.gz |
virtio-serial: report frontend connection state via monitor
Libvirt wants to know about the guest-side connection state of some
virtio-serial ports (in particular the one(s) assigned to guest agent(s)).
Report such states with a new monitor event.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1080376
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/char/virtio-console.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 6c8be0f..54eb15f 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -14,6 +14,7 @@ #include "qemu/error-report.h" #include "trace.h" #include "hw/virtio/virtio-serial.h" +#include "qapi-event.h" #define TYPE_VIRTIO_CONSOLE_SERIAL_PORT "virtserialport" #define VIRTIO_CONSOLE(obj) \ @@ -81,11 +82,16 @@ static ssize_t flush_buf(VirtIOSerialPort *port, static void set_guest_connected(VirtIOSerialPort *port, int guest_connected) { VirtConsole *vcon = VIRTIO_CONSOLE(port); + DeviceState *dev = DEVICE(port); - if (!vcon->chr) { - return; + if (vcon->chr) { + qemu_chr_fe_set_open(vcon->chr, guest_connected); + } + + if (dev->id) { + qapi_event_send_vserport_change(dev->id, guest_connected, + &error_abort); } - qemu_chr_fe_set_open(vcon->chr, guest_connected); } /* Readiness of the guest to accept data on a port */ |