From nobody Mon Feb 9 09:16:26 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=1671115082; cv=none; d=zohomail.com; s=zohoarc; b=BHjez5/QlY/fkRSDcIqQvTG+pEg+7iEkZPCTMKSJrOOKLsHeKJ91nl69TpWjxAAqCAARcn/Syeb1Gwm2duDYVW/qOzr93d1eIB4oaxmakcaqoB/XDVJf2btNljIQE1Vp9wXbOW7VIf0TwXjLonGj2I8ILz6T1QH8NfPdtc5iQYQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671115082; 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=ttQJZRu2FwLXOCsYudxBj4CluZzu4PM0ZohE6ZiMbnQ=; b=ZxIonB1VNQHZJn0H+06Dusga+gTfAKQCbolsQfi0HjbEzDGHJj7bPwMY2Y/VzYD2m5LMI87dhItPBd0ZpajtW6BIfma5+1hdG/Wt5/dPXZANr8tcQYD7ocPpq8A82G3mUmQ/qmyk1UgZTzL979IRJZmWuaIxdFsB/HGXPO1abI4= 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 1671115082182550.8296988367982; Thu, 15 Dec 2022 06:38:02 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-30-HFm3aylDO-Wp1l16nDu_nQ-1; Thu, 15 Dec 2022 09:37:56 -0500 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 ECF66280373C; Thu, 15 Dec 2022 14:37:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE41040C2006; Thu, 15 Dec 2022 14:37:52 +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 9B9261947042; Thu, 15 Dec 2022 14:37:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 66FA21946A77 for ; Thu, 15 Dec 2022 14:37:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4D73340C2004; Thu, 15 Dec 2022 14:37:50 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 103B940C2064 for ; Thu, 15 Dec 2022 14:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671115081; 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=ttQJZRu2FwLXOCsYudxBj4CluZzu4PM0ZohE6ZiMbnQ=; b=GDf0PijjKD+svnC4i9QyMgLA5okZmVxGpudF8YEgKhk5UHUYMqXCwmp/AI0wPB8EyCP2QK WeClV7xRxHYMhIe4wI9gjX00PStIhAq5yM636KyVIb0jbe3vLjGgAp9O1tfLLoXZCF0WRZ O97hl8MPJNzucOqI3FE5MfFcHkdri9E= X-MC-Unique: HFm3aylDO-Wp1l16nDu_nQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] conf: Add job parameter to virDomainObjIsFailedPostcopy Date: Thu, 15 Dec 2022 15:37:42 +0100 Message-Id: <50167b897dd21233773ebf4c17410ae3f3b0a2a7.1671114079.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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 3.1 on 10.11.54.1 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: 1671115083496100001 Content-Type: text/plain; charset="utf-8" Unused for now, but this will change soon. Signed-off-by: Jiri Denemark --- src/conf/domain_conf.c | 8 +++++--- src/conf/domain_conf.h | 6 ++++-- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_migration.c | 22 +++++++++++----------- src/qemu/qemu_process.c | 8 ++++---- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d1def730a4..9e2eea79e7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27873,7 +27873,8 @@ virDomainObjGetState(virDomainObj *dom, int *reason) =20 =20 bool -virDomainObjIsFailedPostcopy(virDomainObj *dom) +virDomainObjIsFailedPostcopy(virDomainObj *dom, + virDomainJobObj *job G_GNUC_UNUSED) { return ((dom->state.state =3D=3D VIR_DOMAIN_PAUSED && dom->state.reason =3D=3D VIR_DOMAIN_PAUSED_POSTCOPY_FAILED) || @@ -27883,9 +27884,10 @@ virDomainObjIsFailedPostcopy(virDomainObj *dom) =20 =20 bool -virDomainObjIsPostcopy(virDomainObj *dom) +virDomainObjIsPostcopy(virDomainObj *dom, + virDomainJobObj *job) { - if (virDomainObjIsFailedPostcopy(dom)) + if (virDomainObjIsFailedPostcopy(dom, job)) return true; =20 return (dom->state.state =3D=3D VIR_DOMAIN_PAUSED && diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 3abf018574..becc147dab 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3930,10 +3930,12 @@ virDomainObjGetState(virDomainObj *obj, int *reason) ATTRIBUTE_NONNULL(1); =20 bool -virDomainObjIsFailedPostcopy(virDomainObj *obj) +virDomainObjIsFailedPostcopy(virDomainObj *obj, + virDomainJobObj *job) ATTRIBUTE_NONNULL(1); bool -virDomainObjIsPostcopy(virDomainObj *dom) +virDomainObjIsPostcopy(virDomainObj *dom, + virDomainJobObj *job) ATTRIBUTE_NONNULL(1); =20 virSecurityLabelDef * diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dea3d65b57..2257a17cde 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12614,7 +12614,7 @@ qemuDomainAbortJobFlags(virDomainPtr dom, =20 if (flags & VIR_DOMAIN_ABORT_JOB_POSTCOPY && (vm->job->asyncJob !=3D VIR_ASYNC_JOB_MIGRATION_OUT || - !virDomainObjIsPostcopy(vm))) { + !virDomainObjIsPostcopy(vm, vm->job))) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("current job is not outgoing migration in post-co= py mode")); goto endjob; @@ -12639,7 +12639,7 @@ qemuDomainAbortJobFlags(virDomainPtr dom, break; =20 case VIR_ASYNC_JOB_MIGRATION_OUT: - if (virDomainObjIsPostcopy(vm)) + if (virDomainObjIsPostcopy(vm, vm->job)) ret =3D qemuDomainAbortJobPostcopy(vm, flags); else ret =3D qemuDomainAbortJobMigration(vm); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index fd8583ca34..27a74795d6 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2294,7 +2294,7 @@ qemuMigrationAnyConnectionClosed(virDomainObj *vm, break; =20 case QEMU_MIGRATION_PHASE_PERFORM3_DONE: - if (virDomainObjIsPostcopy(vm)) { + if (virDomainObjIsPostcopy(vm, vm->job)) { VIR_DEBUG("Migration protocol interrupted in post-copy mode"); postcopy =3D true; } else { @@ -2683,7 +2683,7 @@ qemuMigrationAnyCanResume(virDomainObj *vm, return false; } =20 - if (!virDomainObjIsPostcopy(vm)) { + if (!virDomainObjIsPostcopy(vm, vm->job)) { virReportError(VIR_ERR_OPERATION_INVALID, _("migration of domain %s is not in post-copy phase= "), vm->def->name); @@ -2691,7 +2691,7 @@ qemuMigrationAnyCanResume(virDomainObj *vm, } =20 if (vm->job->phase < QEMU_MIGRATION_PHASE_POSTCOPY_FAILED && - !virDomainObjIsFailedPostcopy(vm)) { + !virDomainObjIsFailedPostcopy(vm, vm->job)) { virReportError(VIR_ERR_OPERATION_INVALID, _("post-copy migration of domain %s has not failed"= ), vm->def->name); @@ -3911,7 +3911,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver, virCheckFlags(QEMU_MIGRATION_FLAGS, -1); =20 if (retcode !=3D 0 && - virDomainObjIsPostcopy(vm) && + virDomainObjIsPostcopy(vm, vm->job) && currentData->stats.mig.status =3D=3D QEMU_MONITOR_MIGRATION_STATUS= _COMPLETED) { VIR_DEBUG("Finish phase failed, but QEMU reports post-copy migrati= on is completed; forcing success"); retcode =3D 0; @@ -3919,7 +3919,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver, =20 if (flags & VIR_MIGRATE_POSTCOPY_RESUME) { phase =3D QEMU_MIGRATION_PHASE_CONFIRM_RESUME; - } else if (virDomainObjIsFailedPostcopy(vm)) { + } else if (virDomainObjIsFailedPostcopy(vm, vm->job)) { /* 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. @@ -3979,7 +3979,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver, if (virDomainObjGetState(vm, &reason) =3D=3D VIR_DOMAIN_PAUSED && reason =3D=3D VIR_DOMAIN_PAUSED_POSTCOPY) { qemuMigrationSrcPostcopyFailed(vm); - } else if (!virDomainObjIsFailedPostcopy(vm)) { + } else if (!virDomainObjIsFailedPostcopy(vm, vm->job)) { qemuMigrationSrcRestoreDomainState(driver, vm); =20 qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_OUT, @@ -4020,7 +4020,7 @@ qemuMigrationSrcConfirm(virQEMUDriver *driver, * job will stay active even though migration API finishes with an * error. */ - if (virDomainObjIsFailedPostcopy(vm)) + if (virDomainObjIsFailedPostcopy(vm, vm->job)) phase =3D vm->job->phase; else if (cancelled) phase =3D QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED; @@ -4039,7 +4039,7 @@ qemuMigrationSrcConfirm(virQEMUDriver *driver, cookiein, cookieinlen, flags, cancelled); =20 - if (virDomainObjIsFailedPostcopy(vm)) { + if (virDomainObjIsFailedPostcopy(vm, vm->job)) { ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_POS= TCOPY_FAILED)); qemuMigrationJobContinue(vm, qemuProcessCleanupMigrationJob); } else { @@ -6093,7 +6093,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver, if (ret < 0) virErrorPreserveLast(&orig_err); =20 - if (virDomainObjIsFailedPostcopy(vm)) { + if (virDomainObjIsFailedPostcopy(vm, vm->job)) { ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_POS= TCOPY_FAILED)); qemuMigrationJobContinue(vm, qemuProcessCleanupMigrationJob); } else { @@ -6184,7 +6184,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver, ret =3D 0; =20 cleanup: - if (ret < 0 && !virDomainObjIsFailedPostcopy(vm)) { + if (ret < 0 && !virDomainObjIsFailedPostcopy(vm, vm->job)) { qemuMigrationSrcRestoreDomainState(driver, vm); qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, vm->job->apiFlags); @@ -6725,7 +6725,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver, } } =20 - if (virDomainObjIsFailedPostcopy(vm)) { + if (virDomainObjIsFailedPostcopy(vm, vm->job)) { ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_POS= TCOPY_FAILED)); qemuProcessAutoDestroyRemove(driver, vm); *finishJob =3D false; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2e989256ff..6091c9f1a9 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1473,7 +1473,7 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_G= NUC_UNUSED, break; =20 case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER: - if (virDomainObjIsFailedPostcopy(vm)) { + if (virDomainObjIsFailedPostcopy(vm, vm->job)) { int eventType =3D -1; int eventDetail =3D -1; =20 @@ -1503,7 +1503,7 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_G= NUC_UNUSED, * watching it in any thread. Let's make sure the migration is pro= perly * finished in case we get a "completed" event. */ - if (virDomainObjIsPostcopy(vm) && + if (virDomainObjIsPostcopy(vm, vm->job) && vm->job->phase =3D=3D QEMU_MIGRATION_PHASE_POSTCOPY_FAILED && vm->job->asyncOwner =3D=3D 0) { qemuProcessEventSubmit(vm, QEMU_PROCESS_EVENT_UNATTENDED_MIGRA= TION, @@ -3476,7 +3476,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriver *driver, /* migration finished, we started resuming the domain but didn't * confirm success or failure yet; killing it seems safest unless * we already started guest CPUs or we were in post-copy mode */ - if (virDomainObjIsPostcopy(vm)) + if (virDomainObjIsPostcopy(vm, job)) return 1; =20 if (state !=3D VIR_DOMAIN_RUNNING) { @@ -3511,7 +3511,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriver *driver, int reason, unsigned int *stopFlags) { - bool postcopy =3D virDomainObjIsPostcopy(vm); + bool postcopy =3D virDomainObjIsPostcopy(vm, job); bool resume =3D false; =20 VIR_DEBUG("Active outgoing migration in phase %s", --=20 2.39.0