Patchwork [4/4] spice-qemu-char: register interface on post load

login
register
mail settings
Submitter Alon Levy
Date March 20, 2013, 9:55 a.m.
Message ID <1363773314-32332-5-git-send-email-alevy@redhat.com>
Download mbox | patch
Permalink /patch/229304/
State New
Headers show

Comments

Alon Levy - March 20, 2013, 9:55 a.m.
The target has not seen the guest_connected event via
spice_chr_guest_open or spice_chr_write, and so spice server wrongly
assumes there is no agent active, while the client continues to send
motion events only by the agent channel, which the server ignores. The
net effect is that the mouse is static in the guest.

By registering the interface on post load spice server will pass on the
agent messages fixing the mouse behavior after migration.

RHBZ #725965

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 spice-qemu-char.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch

diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 8a9236d..c6aed58 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -205,6 +205,14 @@  static void print_allowed_subtypes(void)
     fprintf(stderr, "\n");
 }
 
+static void spice_chr_post_load(struct CharDriverState *chr,
+                                     int connected)
+{
+    if (connected) {
+        spice_chr_guest_open(chr);
+    }
+}
+
 static CharDriverState *chr_open(const char *subtype)
 {
     CharDriverState *chr;
@@ -220,6 +228,7 @@  static CharDriverState *chr_open(const char *subtype)
     chr->chr_close = spice_chr_close;
     chr->chr_guest_open = spice_chr_guest_open;
     chr->chr_guest_close = spice_chr_guest_close;
+    chr->chr_post_load = spice_chr_post_load;
 
     QLIST_INSERT_HEAD(&spice_chars, s, next);