qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
Cc: hdegoede@redhat.com, armbru@redhat.com
Subject: [Qemu-devel] [STABLE v2] virtio-serial-bus: replay guest_open on migration
Date: Wed, 27 Jul 2011 12:40:16 +0300	[thread overview]
Message-ID: <1311759616-6027-1-git-send-email-alevy@redhat.com> (raw)

When migrating a host with with a spice agent running the mouse becomes
non operational after the migration. This is rhbz #725965.

The problem is that after migration spice doesn't know the guest agent is open.
Spice is just a char dev here. And a chardev cannot query it's device, the
device has to let the chardev know when it is open. Right now after migration
the chardev which is recreated is in it's default state, which assumes the
guest is disconnected.

Char devices carry no information across migration, but the virtio-serial does
already carry the guest_connected state. This patch passes that bit to the
chardev.

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/virtio-serial-bus.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index c5eb931..4a6d932 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -618,6 +618,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
     for (i = 0; i < nr_active_ports; i++) {
         uint32_t id;
         bool host_connected;
+        VirtIOSerialPortInfo *info;
 
         id = qemu_get_be32(f);
         port = find_port_by_id(s, id);
@@ -626,6 +627,11 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
         }
 
         port->guest_connected = qemu_get_byte(f);
+        info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info);
+        if (port->guest_connected && info->guest_open) {
+            /* replay guest open */
+            info->guest_open(port);
+        }
         host_connected = qemu_get_byte(f);
         if (host_connected != port->host_connected) {
             /*
-- 
1.7.6

                 reply	other threads:[~2011-07-27  9:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311759616-6027-1-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=armbru@redhat.com \
    --cc=hdegoede@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).