render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

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

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