peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

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

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