From patchwork Thu Sep 27 15:25:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 187399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BF2342C00B1 for ; Fri, 28 Sep 2012 01:24:49 +1000 (EST) Received: from localhost ([::1]:49045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THFxF-0008Vk-OX for incoming@patchwork.ozlabs.org; Thu, 27 Sep 2012 11:24:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THFx3-0008VH-U1 for qemu-devel@nongnu.org; Thu, 27 Sep 2012 11:24:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THFww-0004fQ-D8 for qemu-devel@nongnu.org; Thu, 27 Sep 2012 11:24:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46937) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THFww-0004fM-3w for qemu-devel@nongnu.org; Thu, 27 Sep 2012 11:24:26 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8RFOPhN006184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Sep 2012 11:24:25 -0400 Received: from shalem.localdomain.com (vpn1-7-102.ams2.redhat.com [10.36.7.102]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8RFOKTN027612; Thu, 27 Sep 2012 11:24:23 -0400 From: Hans de Goede To: Gerd Hoffmann Date: Thu, 27 Sep 2012 17:25:45 +0200 Message-Id: <1348759545-14645-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1348759545-14645-1-git-send-email-hdegoede@redhat.com> References: <1348759545-14645-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Hans de Goede , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/2] usb-redir: Don't make migration fail in none seamless case X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Instead simple disconnect the device like host redirection does on migration. Signed-off-by: Hans de Goede --- hw/usb/redirect.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 5d16aff..022ba42 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1637,12 +1637,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);