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