Skip to contentSkip to conversation

virtio-serial: propagate guest_connected to the port on post_load

PATCH New Hans de Goede 1 participant 2 messages Mar 24, 2013

lore
Share & tools
lore
#0 lore raw

cover virtio-serial: propagate guest_connected to the port on post_load

Here is a new attempt on fixing the spicevmc needing the guest_connected value post-migration, as discussed in various other threads.

Note this patch applies on top of my frontend-open handling cleanup series I just posted.

#1 lore raw

PATCH 1/1 virtio-serial: propagate guest_connected to the port on post_load

From: Alon Levy <[email protected]>

When migrating a host with with a spice agent running the mouse becomes non operational after the migration due to the agent state being inconsistent between the guest and the client.

After migration the spicevmc backend on the destination has never been notified of the (non 0) guest_connected state. Virtio-serial holds this state information and migrates it, this patch properly propagates this information to virtio-console and through that to interested chardev backends.

rhbz #725965

---
 hw/virtio-serial-bus.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/virtio-serial-bus.c +5 -0
index eb7af21..a9cb114 100644
@@ -579,6 +579,7 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
     VirtIOSerial *s = opaque;
     VirtIOSerialPort *port;
     uint8_t host_connected;
+    VirtIOSerialPortClass *vsc;
 
     if (!s->post_load) {
         return;
@@ -594,6 +595,10 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
             send_control_event(s, port->id, VIRTIO_CONSOLE_PORT_OPEN,
                                port->host_connected);
         }
+        vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
+        if (vsc->set_guest_connected) {
+            vsc->set_guest_connected(port, port->guest_connected);
+        }
     }
     g_free(s->post_load->connected);
     qemu_free_timer(s->post_load->timer);
Signature · 1 line
1.8.1.4