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

ca70dc
From adbc805b1f775ef8565bf8d074b45813daa2e779 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
ca70dc
Subject: [PATCH 372/372] usb-redir: Don't make migration fail in none
ca70dc
 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
-- 
ca70dc
1.7.12
ca70dc