d4cdad
From 8e92fe9feebc319c019feb8c28941e322524932f Mon Sep 17 00:00:00 2001
d4cdad
From: Alon Levy <alevy@redhat.com>
d4cdad
Date: Thu, 28 Jul 2011 15:08:48 +0300
d4cdad
Subject: [PATCH 117/118] virtio-serial-bus: replay guest_open on migration
d4cdad
d4cdad
When migrating a host with with a spice agent running the mouse becomes
d4cdad
non operational after the migration. This is rhbz #725965.
d4cdad
d4cdad
The problem is that after migration spice doesn't know the guest agent is open.
d4cdad
Spice is just a char dev here. And a chardev cannot query it's device, the
d4cdad
device has to let the chardev know when it is open. Right now after migration
d4cdad
the chardev which is recreated is in it's default state, which assumes the
d4cdad
guest is disconnected.
d4cdad
d4cdad
Char devices carry no information across migration, but the virtio-serial does
d4cdad
already carry the guest_connected state. This patch passes that bit to the
d4cdad
chardev.
d4cdad
d4cdad
Signed-off-by: Alon Levy <alevy@redhat.com>
d4cdad
---
d4cdad
 hw/virtio-serial-bus.c |    6 ++++++
d4cdad
 1 files changed, 6 insertions(+), 0 deletions(-)
d4cdad
d4cdad
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
d4cdad
index a4825b9..e5f343f 100644
d4cdad
--- a/hw/virtio-serial-bus.c
d4cdad
+++ b/hw/virtio-serial-bus.c
d4cdad
@@ -618,6 +618,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
d4cdad
     for (i = 0; i < nr_active_ports; i++) {
d4cdad
         uint32_t id;
d4cdad
         bool host_connected;
d4cdad
+        VirtIOSerialPortInfo *info;
d4cdad
d4cdad
         id = qemu_get_be32(f);
d4cdad
         port = find_port_by_id(s, id);
d4cdad
@@ -626,6 +627,11 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
d4cdad
         }
d4cdad
d4cdad
         port->guest_connected = qemu_get_byte(f);
d4cdad
+        info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info);
d4cdad
+        if (port->guest_connected && info->guest_open) {
d4cdad
+            /* replay guest open */
d4cdad
+            info->guest_open(port);
d4cdad
+        }
d4cdad
         host_connected = qemu_get_byte(f);
d4cdad
         if (host_connected != port->host_connected) {
d4cdad
             /*
d4cdad
-- 
d4cdad
1.7.7.5
d4cdad