All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws
Subject: [Qemu-devel] [PULL 7/8] char: report frontend open/closed state in 'query-chardev'
Date: Fri, 27 Jun 2014 15:42:02 -0400	[thread overview]
Message-ID: <1403898123-22963-8-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>

In addition to the on-line reporting added in the previous patch, allow
libvirt to query frontend state independently of events.

Libvirt's path to identify the guest agent channel it cares about differs
between the event added in the previous patch and the QMP response field
added here. The event identifies the frontend device, by "id". The
'query-chardev' QMP command identifies the backend device (again by "id").
The association is under libvirt's control.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1080376

Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qapi-schema.json |  8 +++++++-
 qemu-char.c      |  1 +
 qmp-commands.hx  | 19 ++++++++++++++-----
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index c68a17f..2284f0f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -214,12 +214,18 @@
 #
 # @filename: the filename of the character device
 #
+# @frontend-open: shows whether the frontend device attached to this backend
+#                 (eg. with the chardev=... option) is in open or closed state
+#                 (since 2.1)
+#
 # Notes: @filename is encoded using the QEMU command line character device
 #        encoding.  See the QEMU man page for details.
 #
 # Since: 0.14.0
 ##
-{ 'type': 'ChardevInfo', 'data': {'label': 'str', 'filename': 'str'} }
+{ 'type': 'ChardevInfo', 'data': {'label': 'str',
+                                  'filename': 'str',
+                                  'frontend-open': 'bool'} }
 
 ##
 # @query-chardev:
diff --git a/qemu-char.c b/qemu-char.c
index cbd6b9a..51917de 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3705,6 +3705,7 @@ ChardevInfoList *qmp_query_chardev(Error **errp)
         info->value = g_malloc0(sizeof(*info->value));
         info->value->label = g_strdup(chr->label);
         info->value->filename = g_strdup(chr->filename);
+        info->value->frontend_open = chr->fe_open;
 
         info->next = chr_list;
         chr_list = info;
diff --git a/qmp-commands.hx b/qmp-commands.hx
index e4a1c80..35f5146 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1921,19 +1921,28 @@ Each json-object contain the following:
 
 - "label": device's label (json-string)
 - "filename": device's file (json-string)
+- "frontend-open": open/closed state of the frontend device attached to this
+                   backend (json-bool)
 
 Example:
 
 -> { "execute": "query-chardev" }
 <- {
-      "return":[
+      "return": [
+         {
+            "label": "charchannel0",
+            "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server",
+            "frontend-open": false
+         },
          {
-            "label":"monitor",
-            "filename":"stdio"
+            "label": "charmonitor",
+            "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server",
+            "frontend-open": true
          },
          {
-            "label":"serial0",
-            "filename":"vc"
+            "label": "charserial0",
+            "filename": "pty:/dev/pts/2",
+            "frontend-open": true
          }
       ]
    }
-- 
1.9.3

  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 ` [Qemu-devel] [PULL 6/8] virtio-serial: report frontend connection state via monitor Luiz Capitulino
2014-06-27 19:42 ` Luiz Capitulino [this message]
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-8-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.