peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0112-virtio-serial-bus-replay-guest_open-on-migration.patch

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