qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 2/2] char: report frontend open/closed state in 'que


From: Laszlo Ersek
Subject: [Qemu-devel] [PATCH 2/2] char: report frontend open/closed state in 'query-chardev'
Date: Thu, 29 May 2014 21:36:41 +0200

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 <address@hidden>
---
 qapi-schema.json |  8 +++++++-
 qemu-char.c      |  2 ++
 qmp-commands.hx  | 19 ++++++++++++++-----
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index 7bc33ea..7692f9f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -476,12 +476,18 @@
 #
 # @filename: the filename of the character device
 #
+# @frontend_open: #optional shows whether the frontend device attached to this
+#                 backend (eg. with the chardev=... option) is in open or
+#                 closed state (since 2.2)
+#
 # 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 17b476e..021f86c 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3439,6 +3439,8 @@ 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->has_frontend_open = true;
+        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 d8aa4ed..8901536 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, optional)
 
 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




reply via email to

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