summary refs log tree commit diff stats
path: root/hw/usb/redirect.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-09-27 17:25:45 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-10-11 09:32:10 +0200
commit5c16f767813602fbf57414e2a11057e252e0d422 (patch)
treed2b44f131b746f274a3d3e1353a45b1fdd45a427 /hw/usb/redirect.c
parentdbbf01958e777b6f03fc4ab425879f84800b9cda (diff)
downloadfocaccia-qemu-5c16f767813602fbf57414e2a11057e252e0d422.tar.gz
focaccia-qemu-5c16f767813602fbf57414e2a11057e252e0d422.zip
usb-redir: Don't make migration fail in none seamless case
Instead simple disconnect the device like host redirection does on
migration.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/redirect.c')
-rw-r--r--hw/usb/redirect.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 5e0f98daf2..2283565b0c 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1614,12 +1614,17 @@ static int usbredir_get_parser(QEMUFile *f, void *priv, size_t unused)
     }
 
     /*
-     * Our chardev should be open already at this point, otherwise
-     * the usbredir channel will be broken (ie spice without seamless)
+     * If our chardev is not open already at this point the usbredir connection
+     * has been broken (non seamless migration, or restore from disk).
+     *
+     * In this case create a temporary parser to receive the migration data,
+     * and schedule the close_bh to report the device as disconnected to the
+     * guest and to destroy the parser again.
      */
     if (dev->parser == NULL) {
-        ERROR("get_parser called with closed chardev, failing migration\n");
-        return -1;
+        WARNING("usb-redir connection broken during migration\n");
+        usbredir_create_parser(dev);
+        qemu_bh_schedule(dev->chardev_close_bh);
     }
 
     data = g_malloc(len);