From nobody Sun Feb 8 11:21:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1652196255; cv=none; d=zohomail.com; s=zohoarc; b=h0L/s8p0tsNQtARmVuD6nrG02fYpqathknhSdIRS9lbAiZT1eUuYaSdzXmTVVFd0LFofXed2ekGYtbkoNbDVfHja3karALb3t+v33zicrXGBeJKjb5uHV0dcZUt16sxaLw4p5ivRxAErJvUlNeqnWnp0uHTDWFEwKVWi+VpMV44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652196255; h=Content-Type:Content-Transfer-Encoding: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=Loaf11k1cKYajVU9BRaI4qEjUVcbyvlmVrKo9xGgEaY=; b=daEvAYaXo6TWPVjhJg3okcKW/i6bLBPc/cYqgMU4ixp+cNjh1irwF+so4e/fLFe1nImgxzZF+Z7zMQ1m9FXtKnXMyknSrwO4m0oORAPnhFx6P0hYNtNVn2pzi8GaTBKQUBaFzNfe5q2luULVaaBIetzbITP05df6ZEiVAMjBa94= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1652196254999122.94522318734266; Tue, 10 May 2022 08:24:14 -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-277-s7hKOpmgP3GphpIqW6s6nA-1; Tue, 10 May 2022 11:22:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3364E862F95; Tue, 10 May 2022 15:22:06 +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 DE0D240D017A; Tue, 10 May 2022 15:22:05 +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 0ADDA194E10F; Tue, 10 May 2022 15:21:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5EEC81947070 for ; Tue, 10 May 2022 15:21:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4AEB514E1D8A; Tue, 10 May 2022 15:21:50 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B53614E1D88 for ; Tue, 10 May 2022 15:21:50 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id BE1FF244627; Tue, 10 May 2022 17:21:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652196254; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=Loaf11k1cKYajVU9BRaI4qEjUVcbyvlmVrKo9xGgEaY=; b=jVoPA+hGZvMe5Qodv+znKmhuaWZmucLQkPp7UgYYwNBhsqZycgCyfw/rRShUlMhL79jzKP EliY8bwbwpg/c2BehQay4HSRCVLBVTW5VxjblSSP3DoyHm0NnQMTbOhUyoMxAJQQCvUKhT h0JLx+JLBiRJCEbXWLQuht4jMXGfQls= X-MC-Unique: s7hKOpmgP3GphpIqW6s6nA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 59/80] qemu: Implement VIR_MIGRATE_POSTCOPY_RESUME for Confirm phase Date: Tue, 10 May 2022 17:21:20 +0200 Message-Id: <263f6ed4c21defe94f9e8380a6cf08cf4b00b95d.1652196064.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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: 1652196257129100009 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_migration.c | 49 +++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 29be797d78..8ed1c2c2b6 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3812,15 +3812,19 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver, =20 virCheckFlags(QEMU_MIGRATION_FLAGS, -1); =20 - /* Keep the original migration phase in case post-copy failed as the j= ob - * will stay active even though migration API finishes with an error. - */ - if (virDomainObjIsFailedPostcopy(vm)) + if (flags & VIR_MIGRATE_POSTCOPY_RESUME) { + phase =3D QEMU_MIGRATION_PHASE_CONFIRM_RESUME; + } else if (virDomainObjIsFailedPostcopy(vm)) { + /* Keep the original migration phase in case post-copy failed as t= he + * job will stay active even though migration API finishes with an + * error. + */ phase =3D priv->job.phase; - else if (retcode =3D=3D 0) + } else if (retcode =3D=3D 0) { phase =3D QEMU_MIGRATION_PHASE_CONFIRM3; - else + } else { phase =3D QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED; + } =20 if (qemuMigrationJobStartPhase(vm, phase) < 0) return -1; @@ -3895,24 +3899,35 @@ qemuMigrationSrcConfirm(virQEMUDriver *driver, qemuDomainObjPrivate *priv =3D vm->privateData; int ret =3D -1; =20 - if (!qemuMigrationJobIsActive(vm, VIR_ASYNC_JOB_MIGRATION_OUT)) - goto cleanup; + VIR_DEBUG("vm=3D%p, flags=3D0x%x, cancelled=3D%d", vm, flags, cancelle= d); =20 - /* Keep the original migration phase in case post-copy failed as the j= ob - * will stay active even though migration API finishes with an error. - */ - if (virDomainObjIsFailedPostcopy(vm)) - phase =3D priv->job.phase; - else if (cancelled) - phase =3D QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED; - else - phase =3D QEMU_MIGRATION_PHASE_CONFIRM3; + if (flags & VIR_MIGRATE_POSTCOPY_RESUME) { + if (!qemuMigrationAnyCanResume(vm, VIR_ASYNC_JOB_MIGRATION_OUT, fl= ags, + QEMU_MIGRATION_PHASE_PERFORM_RESUME= )) + goto cleanup; + phase =3D QEMU_MIGRATION_PHASE_CONFIRM_RESUME; + } else { + if (!qemuMigrationJobIsActive(vm, VIR_ASYNC_JOB_MIGRATION_OUT)) + goto cleanup; + + /* Keep the original migration phase in case post-copy failed as t= he + * job will stay active even though migration API finishes with an + * error. + */ + if (virDomainObjIsFailedPostcopy(vm)) + phase =3D priv->job.phase; + else if (cancelled) + phase =3D QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED; + else + phase =3D QEMU_MIGRATION_PHASE_CONFIRM3; + } =20 if (qemuMigrationJobStartPhase(vm, phase) < 0) goto cleanup; =20 virCloseCallbacksUnset(driver->closeCallbacks, vm, qemuMigrationSrcCleanup); + qemuDomainCleanupRemove(vm, qemuProcessCleanupMigrationJob); =20 ret =3D qemuMigrationSrcConfirmPhase(driver, vm, cookiein, cookieinlen, --=20 2.35.1