From nobody Fri Dec 19 17:38:37 2025 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=1619013987; cv=none; d=zohomail.com; s=zohoarc; b=baI3TeNNX7BpbIm025JChtxoHiYnk2F6x981uBE5OA1yVnjkwU5IJBrI4P6L8A1nhOENOGlYteoAkazZ9uNoJkFOrsUiIdyZq31/79Vgx3kuQF8+n6XxGcygQjo+lXSlKH195yZM5HIFs9y6fC8NDYhlknud/6TEAOjebTaV8X8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619013987; 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=K+T2BeQuLb2qV7blCMNM+xatTfWCwLyw8SdjtKYa8fE=; b=lDajRsuReWPl23gIA1JQYPzVmmQdfVKDcuYWYtfq8Vt5wHM9B1r0Qu/5r6JWuAlwxL9Tdj7fWll+ZQ2LnzLyuaoxv3UdJ0CWc8Nzv7ui9VsW7hoUlnHss7aaLE8OAVH5h6SG39yfBSp5AAWWzZu0XgKq26WWVuDbjOtCm5TEXU4= 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) header.from= 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 1619013986836179.70417036146728; Wed, 21 Apr 2021 07:06:26 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-516-x7G30gr2OaK78QnXj3Ukxw-1; Wed, 21 Apr 2021 10:06:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92AC883DE78; Wed, 21 Apr 2021 14:05:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24AD317F77; Wed, 21 Apr 2021 14:05:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C75A81806D1A; Wed, 21 Apr 2021 14:05:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LE4rAO024021 for ; Wed, 21 Apr 2021 10:04:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96E6E6091B; Wed, 21 Apr 2021 14:04:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5BCC6085A for ; Wed, 21 Apr 2021 14:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619013984; 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=K+T2BeQuLb2qV7blCMNM+xatTfWCwLyw8SdjtKYa8fE=; b=eTMrDiFh5SRILIxody9Z5iUe/ZPEvq1DeKbRAyTA6La9v5jELrnroROGRjJ9JQlDeR92yv rQCYgPCAjBbNxeWy/6W5C4VAKGjURDIyRFNi7EOnEpXdpJFpipsZlGg7/YZ8/MviCpXT6d +q/Efit4bOmTsfhgZ+F1q5LMAoCpkDE= X-MC-Unique: x7G30gr2OaK78QnXj3Ukxw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/10] qemuMigrationSrcNBDCopyCancel*: Rename 'check' to 'abortMigration' Date: Wed, 21 Apr 2021 16:04:37 +0200 Message-Id: <0c411dcbb23e9e2cd2f120720ceb649cc3376ec6.1619013793.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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) Content-Type: text/plain; charset="utf-8" Rename the parameter so that it's more clear what state we are in and fix all callees. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b9143166cb..c09f6de153 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -615,9 +615,10 @@ qemuMigrationSrcNBDStorageCopyReady(virDomainObj *vm, /* - * If @check is true, the function will report an error and return a diffe= rent - * code in case a block job fails. This way we can properly abort migratio= n in - * case some block jobs failed once all memory has already been transferre= d. + * If @abortMigration is false, the function will report an error and retu= rn a + * different code in case a block job fails. This way we can properly abort + * migration in case some block jobs failed once all memory has already be= en + * transferred. * * Returns 1 if all mirrors are gone, * 0 if some mirrors are still active, @@ -627,7 +628,7 @@ qemuMigrationSrcNBDStorageCopyReady(virDomainObj *vm, static int qemuMigrationSrcNBDCopyCancelled(virDomainObj *vm, qemuDomainAsyncJob asyncJob, - bool check) + bool abortMigration) { size_t i; size_t active =3D 0; @@ -649,7 +650,7 @@ qemuMigrationSrcNBDCopyCancelled(virDomainObj *vm, qemuBlockJobUpdate(vm, job, asyncJob); switch (job->state) { case VIR_DOMAIN_BLOCK_JOB_FAILED: - if (check) { + if (!abortMigration) { qemuMigrationNBDReportMirrorError(job, disk->dst); failed =3D true; } @@ -710,7 +711,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, virDomainObj *vm, virDomainDiskDef *disk, qemuBlockJobData *job, - bool failNoJob, + bool abortMigration, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv =3D vm->privateData; @@ -720,7 +721,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, switch (job->state) { case VIR_DOMAIN_BLOCK_JOB_FAILED: case VIR_DOMAIN_BLOCK_JOB_CANCELED: - if (failNoJob) { + if (!abortMigration) { qemuMigrationNBDReportMirrorError(job, disk->dst); return -1; } @@ -745,7 +746,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, * qemuMigrationSrcNBDCopyCancel: * @driver: qemu driver * @vm: domain - * @check: if true report an error when some of the mirrors fails + * @abortMigration: The migration is being cancelled. * * Cancel all drive-mirrors started by qemuMigrationSrcNBDStorageCopy. * Any pending block job events for the affected disks will be processed a= nd @@ -757,7 +758,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, static int qemuMigrationSrcNBDCopyCancel(virQEMUDriver *driver, virDomainObj *vm, - bool check, + bool abortMigration, qemuDomainAsyncJob asyncJob, virConnectPtr dconn) { @@ -784,7 +785,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriver *driver, } rv =3D qemuMigrationSrcNBDCopyCancelOne(driver, vm, disk, job, - check, asyncJob); + abortMigration, asyncJob); if (rv !=3D 0) { if (rv < 0) { if (!err) @@ -798,8 +799,8 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriver *driver, virObjectUnref(job); } - while ((rv =3D qemuMigrationSrcNBDCopyCancelled(vm, asyncJob, check)) = !=3D 1) { - if (check && !failed && + while ((rv =3D qemuMigrationSrcNBDCopyCancelled(vm, asyncJob, abortMig= ration)) !=3D 1) { + if (!abortMigration && !failed && dconn && virConnectIsAlive(dconn) <=3D 0) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Lost connection to destination host")); @@ -4272,7 +4273,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, } if (mig->nbd && - qemuMigrationSrcNBDCopyCancel(driver, vm, true, + qemuMigrationSrcNBDCopyCancel(driver, vm, false, QEMU_ASYNC_JOB_MIGRATION_OUT, dconn) < 0) goto error; @@ -4350,7 +4351,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, /* cancel any outstanding NBD jobs */ if (mig && mig->nbd) - qemuMigrationSrcNBDCopyCancel(driver, vm, false, + qemuMigrationSrcNBDCopyCancel(driver, vm, true, QEMU_ASYNC_JOB_MIGRATION_OUT, dconn); @@ -6054,7 +6055,7 @@ qemuMigrationSrcCancel(virQEMUDriver *driver, } if (storage && - qemuMigrationSrcNBDCopyCancel(driver, vm, false, + qemuMigrationSrcNBDCopyCancel(driver, vm, true, QEMU_ASYNC_JOB_NONE, NULL) < 0) return -1; --=20 2.30.2