diff mbox

[RFC,3/3] qemu-agent: add notify for qemu-ga boot

Message ID ac3ecbaddf0759fcf3486ab91d1b7e24a21a1b16.1429257498.git.chen.fan.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

chenfan April 17, 2015, 8:53 a.m. UTC
Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
---
 qga/main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Eric Blake April 21, 2015, 11:38 p.m. UTC | #1
On 04/17/2015 02:53 AM, Chen Fan wrote:
> Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
> ---
>  qga/main.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

I'm not sure that qga should be sending asynchronous messages (so far,
it only every replies synchronously).  As it is, we already wired up a
qemu event that fires any time the guest opens or closes the virtio
connection powering the agent; libvirt can already use those events to
know when the agent has opened the connection, and is presumably ready
to listen to commands after first booting.  So I don't think this patch
is needed.
diff mbox

Patch

diff --git a/qga/main.c b/qga/main.c
index 9939a2b..f011ce0 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -1170,6 +1170,19 @@  int main(int argc, char **argv)
         g_critical("failed to initialize guest agent channel");
         goto out_bad;
     }
+
+    /* send a notification to path */
+    if (ga_state->channel) {
+        QDict *qdict = qdict_new();
+        int ret;
+
+        qdict_put_obj(qdict, "status", QOBJECT(qstring_from_str("connected")));
+        ret = send_response(s, QOBJECT(qdict));
+        if (ret < 0) {
+            g_warning("error sending connected status");
+        }
+    }
+
 #ifndef _WIN32
     g_main_loop_run(ga_state->main_loop);
 #else