dcavalca / rpms / qemu

Forked from rpms/qemu 11 months ago
Clone

Blame 0113-hw-virtio-serial-bus-replay-guest-open-on-destinatio.patch

6986e1
From ab88ff277044974715aab3fd88b168c00605d193 Mon Sep 17 00:00:00 2001
22d63f
From: Alon Levy <alevy@redhat.com>
22d63f
Date: Fri, 16 Nov 2012 16:24:47 +0200
22d63f
Subject: [PATCH] hw/virtio-serial-bus: replay guest open on destination
22d63f
22d63f
This is rewrite of a patch carried in Fedora previously based
22d63f
on new code upstream, here is the original message, it still applies:
22d63f
(the original fedora patch was commit id
22d63f
a9bc20afc1f0604ee81c23b7c67d627e51d2e8d4, this is useful for grepping in
22d63f
logs, it isn't in upstream)
22d63f
22d63f
When migrating a host with with a spice agent running the mouse becomes
22d63f
non operational after the migration. This is rhbz #725965.
22d63f
22d63f
The problem is that after migration spice doesn't know the guest agent
22d63f
is open.  Spice is just a char dev here. And a chardev cannot query it's
22d63f
device, the device has to let the chardev know when it is open. Right
22d63f
now after migration the chardev which is recreated is in it's default
22d63f
state, which assumes the guest is disconnected.
22d63f
22d63f
Char devices carry no information across migration, but the
22d63f
virtio-serial does already carry the guest_connected state. This patch
22d63f
passes that bit to the chardev.
22d63f
---
22d63f
 hw/virtio-serial-bus.c | 6 ++++++
22d63f
 1 file changed, 6 insertions(+)
22d63f
22d63f
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
22d63f
index 155da58..fd19984 100644
22d63f
--- a/hw/virtio-serial-bus.c
22d63f
+++ b/hw/virtio-serial-bus.c
22d63f
@@ -641,6 +641,7 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
22d63f
     VirtIOSerial *s = opaque;
22d63f
     VirtIOSerialPort *port;
22d63f
     uint8_t host_connected;
22d63f
+    VirtIOSerialPortClass *vsc;
22d63f
 
22d63f
     for (i = 0 ; i < s->post_load.nr_active_ports; ++i) {
22d63f
         port = s->post_load.connected[i].port;
22d63f
@@ -653,6 +654,11 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
22d63f
             send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
22d63f
                                port->host_connected);
22d63f
         }
22d63f
+        vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
22d63f
+        if (port->guest_connected && vsc->guest_open) {
22d63f
+            /* replay guest open */
22d63f
+            vsc->guest_open(port);
22d63f
+        }
22d63f
     }
22d63f
     g_free(s->post_load.connected);
22d63f
     s->post_load.connected = NULL;
22d63f
-- 
6986e1
1.8.1
22d63f