From nobody Mon Feb 9 02:28:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502778091764170.80035860930548; Mon, 14 Aug 2017 23:21:31 -0700 (PDT) Received: from localhost ([::1]:41676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhVEI-0008O1-Jq for importer@patchew.org; Tue, 15 Aug 2017 02:21:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhVAc-0005w5-7w for qemu-devel@nongnu.org; Tue, 15 Aug 2017 02:17:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhVAY-0001B9-VK for qemu-devel@nongnu.org; Tue, 15 Aug 2017 02:17:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49118) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dhVAY-0001At-MA for qemu-devel@nongnu.org; Tue, 15 Aug 2017 02:17:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1E84A036F for ; Tue, 15 Aug 2017 06:17:37 +0000 (UTC) Received: from pxdev.xzpeter.org.com (dhcp-15-224.nay.redhat.com [10.66.15.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA6395D6A4; Tue, 15 Aug 2017 06:17:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B1E84A036F Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=peterx@redhat.com From: Peter Xu To: qemu-devel@nongnu.org Date: Tue, 15 Aug 2017 14:17:07 +0800 Message-Id: <1502777827-18874-7-git-send-email-peterx@redhat.com> In-Reply-To: <1502777827-18874-1-git-send-email-peterx@redhat.com> References: <1502777827-18874-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 15 Aug 2017 06:17:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 6/6] migration: allow migrate_incoming for paused VM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , "Dr . David Alan Gilbert" , peterx@redhat.com, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" migrate_incoming command is previously only used when we were providing "-incoming defer" in the command line, to defer the incoming migration channel creation. However there is similar requirement when we are paused during postcopy migration. The old incoming channel might have been destroyed already. We may need another new channel for the recovery to happen. This patch leveraged the same interface, but allows the user to specify incoming migration channel even for paused postcopy. Signed-off-by: Peter Xu --- migration/migration.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index daf356b..696cc7c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1288,17 +1288,39 @@ void migrate_del_blocker(Error *reason) migration_blockers =3D g_slist_remove(migration_blockers, reason); } =20 +static bool migrate_incoming_detach_listen(MigrationIncomingState *mis) +{ + if (mis->listen_task_tag) { + /* Never fail */ + g_source_remove(mis->listen_task_tag); + mis->listen_task_tag =3D 0; + return true; + } + return false; +} + void qmp_migrate_incoming(const char *uri, Error **errp) { Error *local_err =3D NULL; - static bool once =3D true; + MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 - if (!deferred_incoming) { - error_setg(errp, "For use with '-incoming defer'"); + if (!deferred_incoming && + mis->state !=3D MIGRATION_STATUS_POSTCOPY_PAUSED) { + error_setg(errp, "For use with '-incoming defer'" + " or PAUSED postcopy migration only."); return; } - if (!once) { - error_setg(errp, "The incoming migration has already been started"= ); + + /* + * Destroy existing listening task if exist. Logically this should + * not really happen at all (for either deferred migration or + * postcopy migration, we should both detached the listening + * task). So raise an error but still we safely detach it. + */ + if (migrate_incoming_detach_listen(mis)) { + error_report("%s: detected existing listen channel, " + "while it should not exist", __func__); + /* Continue */ } =20 qemu_start_incoming_migration(uri, &local_err); @@ -1307,8 +1329,6 @@ void qmp_migrate_incoming(const char *uri, Error **er= rp) error_propagate(errp, local_err); return; } - - once =3D false; } =20 bool migration_is_blocked(Error **errp) --=20 2.7.4