From nobody Sun Feb 8 21:20:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654087941; cv=none; d=zohomail.com; s=zohoarc; b=YlqS2MQvajOECjJsIpl53qLe79Xc3FtBIMRPNzUckF5cTPLiDOD8EGbJEDtg1XJbOfQYuNXcURGUE9UF8/YzHaL6DFU2idFTvJ5Lal6PVueTB8yjPhjs+Ded6xOte4+a0I9IUgsl2V43Qli4jATtYGHjcsRVM10sP3x0V/dpkxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654087941; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eOQNI7CqgkrLj3NVpk2oHvTwP5xedwobhCrEUsRPdlA=; b=X70ajw0cSHIij99kp+v9+ifqhmhtsvltDdk/0G2L9BieEw3RvZjjxiYk5LLaRKQvV+qmXOEbrmgZtU7oGr+QDFI9IvegDq3ieX72FPq3xxRoevKzglCAEtd8xybRf1rTwy5LEwcjySlrc+EaQPhsh0AeSrxi8KXaRgx8GAQYgJk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1654087941287890.3665894539803; Wed, 1 Jun 2022 05:52:21 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-503-LliSqDwVOeSXkpy5J70TzQ-1; Wed, 01 Jun 2022 08:50:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85B53180138E; Wed, 1 Jun 2022 12:50:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E6E92026985; Wed, 1 Jun 2022 12:50:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 047F51947B97; Wed, 1 Jun 2022 12:50:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 008A81947B90 for ; Wed, 1 Jun 2022 12:50:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D01702166B2C; Wed, 1 Jun 2022 12:50:27 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF6CD2166B26; Wed, 1 Jun 2022 12:50:27 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 708E0245B59; Wed, 1 Jun 2022 14:50:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654087939; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eOQNI7CqgkrLj3NVpk2oHvTwP5xedwobhCrEUsRPdlA=; b=KfPZZZmv5t/5PoP4YdiU4iJjVD2Sa869kyAibqvBLKOddcwOrozMCMei9nWHyPwbYJic9d Jzz07IDrHXXNULzTL6sNra/4K6HKyagBwSOAiIxXIEv3vY2KV7ZkyTyG/gHofYbkc5LUu7 JsRmRR8yjdhyc1zSKrpWxI31d7TMSFw= X-MC-Unique: LliSqDwVOeSXkpy5J70TzQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 13/81] qemu: Abort failed post-copy when we haven't called Finish yet Date: Wed, 1 Jun 2022 14:49:13 +0200 Message-Id: <561d30951c81b16743eec1827895b4106c4d0c6a.1654087150.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Krempa , Pavel Hrdina Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654087942236100001 Content-Type: text/plain; charset="utf-8" When migration fails after it already switched to post-copy phase on the source, but early enough that we haven't called Finish on the destination yet, we know the vCPUs were not started on the destination and the source host still has a complete state of the domain. Thus we can just ignore the fact post-copy phase started and normally abort the migration and resume vCPUs on the source. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa Reviewed-by: Pavel Hrdina --- Notes: Version 2: - put debug message on a single line src/qemu/qemu_migration.c | 8 ++++++++ src/qemu/qemu_process.c | 20 ++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 0daf50d836..06af16c0e7 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4412,6 +4412,14 @@ qemuMigrationSrcRun(virQEMUDriver *driver, virErrorPreserveLast(&orig_err); =20 if (virDomainObjIsActive(vm)) { + int reason; + virDomainState state =3D virDomainObjGetState(vm, &reason); + + if (state =3D=3D VIR_DOMAIN_PAUSED && reason =3D=3D VIR_DOMAIN_PAU= SED_POSTCOPY) { + VIR_DEBUG("Aborting failed post-copy migration as the destinat= ion is not running yet"); + virDomainObjSetState(vm, state, VIR_DOMAIN_PAUSED_MIGRATION); + } + if (cancel && priv->job.current->status !=3D VIR_DOMAIN_JOB_STATUS_HYPERVISO= R_COMPLETED && qemuDomainObjEnterMonitorAsync(driver, vm, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b1725ce4cf..f5a45c898d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3483,20 +3483,16 @@ qemuProcessRecoverMigrationOut(virQEMUDriver *drive= r, case QEMU_MIGRATION_PHASE_PERFORM2: case QEMU_MIGRATION_PHASE_PERFORM3: /* migration is still in progress, let's cancel it and resume the - * domain; however we can only do that before migration enters - * post-copy mode + * domain; we can do so even in post-copy phase as the domain was = not + * resumed on the destination host yet */ - if (postcopy) { - qemuMigrationSrcPostcopyFailed(vm); - } else { - VIR_DEBUG("Cancelling unfinished migration of domain %s", - vm->def->name); - if (qemuMigrationSrcCancel(driver, vm) < 0) { - VIR_WARN("Could not cancel ongoing migration of domain %s", - vm->def->name); - } - resume =3D true; + VIR_DEBUG("Cancelling unfinished migration of domain %s", + vm->def->name); + if (qemuMigrationSrcCancel(driver, vm) < 0) { + VIR_WARN("Could not cancel ongoing migration of domain %s", + vm->def->name); } + resume =3D true; break; =20 case QEMU_MIGRATION_PHASE_PERFORM3_DONE: --=20 2.35.1