dcavalca / rpms / qemu

Forked from rpms/qemu 11 months ago
Clone

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

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