Blame 0634-usb-redir-Don-t-make-migration-fail-in-none-seamless.patch

5544c1
From c57b03073357e813ade4b3b34f6c1e3c0de394c2 Mon Sep 17 00:00:00 2001
ca70dc
From: Hans de Goede <hdegoede@redhat.com>
ca70dc
Date: Thu, 27 Sep 2012 16:57:41 +0200
5544c1
Subject: [PATCH] usb-redir: Don't make migration fail in none seamless case
ca70dc
ca70dc
Instead simple disconnect the device like host redirection does on
ca70dc
migration.
ca70dc
ca70dc
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ca70dc
---
ca70dc
 hw/usb/redirect.c | 13 +++++++++----
ca70dc
 1 file changed, 9 insertions(+), 4 deletions(-)
ca70dc
ca70dc
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
ca70dc
index 5d16aff..022ba42 100644
ca70dc
--- a/hw/usb/redirect.c
ca70dc
+++ b/hw/usb/redirect.c
ca70dc
@@ -1637,12 +1637,17 @@ static int usbredir_get_parser(QEMUFile *f, void *priv, size_t unused)
ca70dc
     }
ca70dc
 
ca70dc
     /*
ca70dc
-     * Our chardev should be open already at this point, otherwise
ca70dc
-     * the usbredir channel will be broken (ie spice without seamless)
ca70dc
+     * If our chardev is not open already at this point the usbredir connection
ca70dc
+     * has been broken (non seamless migration, or restore from disk).
ca70dc
+     *
ca70dc
+     * In this case create a temporary parser to receive the migration data,
ca70dc
+     * and schedule the close_bh to report the device as disconnected to the
ca70dc
+     * guest and to destroy the parser again.
ca70dc
      */
ca70dc
     if (dev->parser == NULL) {
ca70dc
-        ERROR("get_parser called with closed chardev, failing migration\n");
ca70dc
-        return -1;
ca70dc
+        WARNING("usb-redir connection broken during migration\n");
ca70dc
+        usbredir_create_parser(dev);
ca70dc
+        qemu_bh_schedule(dev->chardev_close_bh);
ca70dc
     }
ca70dc
 
ca70dc
     data = g_malloc(len);
ca70dc
-- 
5544c1
1.7.12.1
ca70dc