qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: qemu-devel@nongnu.org, mprivozn@redhat.com, kraxel@redhat.com,
	amit.shah@redhat.com, eblake@redhat.com, lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH for-2.1 v2 2/2] char: report frontend open/closed state in 'query-chardev'
Date: Thu, 26 Jun 2014 13:11:15 +0200	[thread overview]
Message-ID: <1403781075-30989-3-git-send-email-lersek@redhat.com> (raw)
In-Reply-To: <1403781075-30989-1-git-send-email-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
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v2:
    - rename "frontend_open" to "frontend-open" in the schema [Eric]
    - "frontend-open" is mandatory [Eric]
    - advertise / target qemu-2.1 with the new field

 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 d1dc8be..4f968c6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -210,14 +210,20 @@
 # @label: the label of the character device
 #
 # @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 2e50a10..98fb0ab 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3703,8 +3703,9 @@ ChardevInfoList *qmp_query_chardev(Error **errp)
         ChardevInfoList *info = g_malloc0(sizeof(*info));
         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
@@ -1920,21 +1920,30 @@ of all devices.
 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":"monitor",
-            "filename":"stdio"
+            "label": "charchannel0",
+            "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server",
+            "frontend-open": false
          },
          {
-            "label":"serial0",
-            "filename":"vc"
+            "label": "charmonitor",
+            "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server",
+            "frontend-open": true
+         },
+         {
+            "label": "charserial0",
+            "filename": "pty:/dev/pts/2",
+            "frontend-open": true
          }
       ]
    }
 
-- 
1.8.3.1

  parent reply	other threads:[~2014-06-26 11:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 11:11 [Qemu-devel] [PATCH for-2.1 v2 0/2] help libvirt know what's up with qga Laszlo Ersek
2014-06-26 11:11 ` [Qemu-devel] [PATCH for-2.1 v2 1/2] virtio-serial: report frontend connection state via monitor Laszlo Ersek
2014-06-26 12:15   ` Eric Blake
2014-06-26 11:11 ` Laszlo Ersek [this message]
2014-06-26 12:09   ` [Qemu-devel] [PATCH for-2.1 v2 2/2] char: report frontend open/closed state in 'query-chardev' Eric Blake
2014-06-26 13:38     ` Laszlo Ersek
2014-06-26 15:09       ` Eric Blake
2014-06-26 11:30 ` [Qemu-devel] [PATCH for-2.1 v2 0/2] help libvirt know what's up with qga Amit Shah

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=1403781075-30989-3-git-send-email-lersek@redhat.com \
    --to=lersek@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mprivozn@redhat.com \
    --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).