From: Luiz Capitulino <lcapitulino@redhat.com>
To: peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws
Subject: [Qemu-devel] [PULL 6/8] virtio-serial: report frontend connection state via monitor
Date: Fri, 27 Jun 2014 15:42:01 -0400 [thread overview]
Message-ID: <1403898123-22963-7-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1403898123-22963-1-git-send-email-lcapitulino@redhat.com>
From: Laszlo Ersek <lersek@redhat.com>
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>
---
hw/char/virtio-console.c | 12 +++++++++---
monitor.c | 1 +
qapi/event.json | 14 ++++++++++++++
3 files changed, 24 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 */
diff --git a/monitor.c b/monitor.c
index fd34ab7..5718d0b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -588,6 +588,7 @@ static void monitor_qapi_event_init(void)
monitor_qapi_event_throttle(QAPI_EVENT_BALLOON_CHANGE, 1000);
monitor_qapi_event_throttle(QAPI_EVENT_QUORUM_REPORT_BAD, 1000);
monitor_qapi_event_throttle(QAPI_EVENT_QUORUM_FAILURE, 1000);
+ monitor_qapi_event_throttle(QAPI_EVENT_VSERPORT_CHANGE, 1000);
qmp_event_set_func_emit(monitor_qapi_event_queue);
}
diff --git a/qapi/event.json b/qapi/event.json
index 8f817b1..ff97aeb 100644
--- a/qapi/event.json
+++ b/qapi/event.json
@@ -316,3 +316,17 @@
{ 'event': 'QUORUM_REPORT_BAD',
'data': { '*error': 'str', 'node-name': 'str',
'sector-num': 'int', 'sector-count': 'int' } }
+
+##
+# @VSERPORT_CHANGE
+#
+# Emitted when the guest opens or closes a virtio-serial port.
+#
+# @id: device identifier of the virtio-serial port
+#
+# @open: true if the guest has opened the virtio-serial port
+#
+# Since: 2.1
+##
+{ 'event': 'VSERPORT_CHANGE',
+ 'data': { 'id': 'str', 'open': 'bool' } }
--
1.9.3
next prev parent reply other threads:[~2014-06-27 19:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-27 19:41 [Qemu-devel] [PULL for-2.1 0/8] QMP queue Luiz Capitulino
2014-06-27 19:41 ` [Qemu-devel] [PULL 1/8] qapi: move event defines Luiz Capitulino
2014-06-27 19:41 ` [Qemu-devel] [PULL 2/8] qapi: ignore generated event files Luiz Capitulino
2014-06-27 19:41 ` [Qemu-devel] [PULL 3/8] qapi script: clean up in scripts Luiz Capitulino
2014-06-27 19:41 ` [Qemu-devel] [PULL 4/8] qapi event: clean up in callers Luiz Capitulino
2014-06-27 19:42 ` [Qemu-devel] [PULL 5/8] qmp: add qmp-events.txt back Luiz Capitulino
2014-06-27 19:42 ` Luiz Capitulino [this message]
2014-06-27 19:42 ` [Qemu-devel] [PULL 7/8] char: report frontend open/closed state in 'query-chardev' Luiz Capitulino
2014-06-27 19:42 ` [Qemu-devel] [PULL 8/8] docs/qmp: Fix documentation of BLOCK_JOB_READY to match code Luiz Capitulino
2014-06-29 14:24 ` [Qemu-devel] [PULL for-2.1 0/8] QMP queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403898123-22963-7-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).