From nobody Sat Apr 27 12:09:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508421401956697.2705249837778; Thu, 19 Oct 2017 06:56:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D839B33A17E; Thu, 19 Oct 2017 13:56:40 +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 A5EFDC125C; Thu, 19 Oct 2017 13:56:40 +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 4557A180BAD2; Thu, 19 Oct 2017 13:56:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9JDudKi030113 for ; Thu, 19 Oct 2017 09:56:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id F279FC1260; Thu, 19 Oct 2017 13:56:38 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2CB1C1262 for ; Thu, 19 Oct 2017 13:56:34 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 5EF02101295; Thu, 19 Oct 2017 15:56:33 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D839B33A17E 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=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 19 Oct 2017 15:56:26 +0200 Message-Id: <1789d5b62ff83301a7a21fa1e9c786b819947dd5.1508421251.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/7] qemu: Use switch in qemuMigrationCompleted 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 19 Oct 2017 13:56:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When adding a new job state it's useful to let the compiler complain about places where we need to think about what to do with the new state. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 72edbb667..c3f9c38b2 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1531,18 +1531,31 @@ qemuMigrationCompleted(virQEMUDriverPtr driver, return 0; =20 error: - /* state can not be active or completed at this point */ - if (jobInfo->status =3D=3D QEMU_DOMAIN_JOB_STATUS_MIGRATING || - jobInfo->status =3D=3D QEMU_DOMAIN_JOB_STATUS_POSTCOPY) { + switch (jobInfo->status) { + case QEMU_DOMAIN_JOB_STATUS_MIGRATING: + case QEMU_DOMAIN_JOB_STATUS_POSTCOPY: /* The migration was aborted by us rather than QEMU itself. */ jobInfo->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; return -2; - } else if (jobInfo->status =3D=3D QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETE= D) { + + case QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED: + /* Something failed after QEMU already finished the migration. */ jobInfo->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; return -1; - } else { + + case QEMU_DOMAIN_JOB_STATUS_FAILED: + case QEMU_DOMAIN_JOB_STATUS_CANCELED: + /* QEMU aborted the migration. */ return -1; + + case QEMU_DOMAIN_JOB_STATUS_ACTIVE: + case QEMU_DOMAIN_JOB_STATUS_COMPLETED: + case QEMU_DOMAIN_JOB_STATUS_NONE: + /* Impossible. */ + break; } + + return -1; } =20 =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 12:09:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508421401829127.80553969699531; Thu, 19 Oct 2017 06:56:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C160F3E2D1; Thu, 19 Oct 2017 13:56:40 +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 9C99FDF006; Thu, 19 Oct 2017 13:56:40 +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 492E1180BACF; Thu, 19 Oct 2017 13:56:40 +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 v9JDuctb030100 for ; Thu, 19 Oct 2017 09:56:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 195E9D38E2; Thu, 19 Oct 2017 13:56:38 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC5F6D38E6 for ; Thu, 19 Oct 2017 13:56:34 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 622481020BB; Thu, 19 Oct 2017 15:56:33 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C160F3E2D1 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 19 Oct 2017 15:56:27 +0200 Message-Id: <14dc3c77447a3bd4852432eb2f0ee2e47f70764e.1508421251.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/7] qemu: Refactor qemuMigrationRun a bit 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 19 Oct 2017 13:56:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some code which was supposed to be executed only when migration succeeded was buried inside the cleanup code. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 63 +++++++++++++++++++++++++++----------------= ---- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index c3f9c38b2..f0d4f9d98 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3867,8 +3867,36 @@ qemuMigrationRun(virQEMUDriverPtr driver, qemuMigrationSetOffline(driver, vm) < 0) { goto cancelPostCopy; } - if (priv->job.completed) + + if (mig && mig->nbd && + qemuMigrationCancelDriveMirror(driver, vm, true, + QEMU_ASYNC_JOB_MIGRATION_OUT, + dconn) < 0) + goto cancelPostCopy; + + if (iothread) { + qemuMigrationIOThreadPtr io; + + VIR_STEAL_PTR(io, iothread); + if (qemuMigrationStopTunnel(io, false) < 0) + goto cancelPostCopy; + } + + if (priv->job.completed) { priv->job.completed->stopped =3D priv->job.current->stopped; + qemuDomainJobInfoUpdateTime(priv->job.completed); + qemuDomainJobInfoUpdateDowntime(priv->job.completed); + ignore_value(virTimeMillisNow(&priv->job.completed->sent)); + } + + cookieFlags |=3D QEMU_MIGRATION_COOKIE_NETWORK | + QEMU_MIGRATION_COOKIE_STATS; + + if (qemuMigrationCookieAddPersistent(mig, &persistDef) < 0 || + qemuMigrationBakeCookie(mig, driver, vm, cookieout, + cookieoutlen, cookieFlags) < 0) { + VIR_WARN("Unable to encode migration cookie"); + } =20 ret =3D 0; =20 @@ -3877,43 +3905,24 @@ qemuMigrationRun(virQEMUDriverPtr driver, orig_err =3D virSaveLastError(); =20 /* cancel any outstanding NBD jobs */ - if (mig && mig->nbd) { - if (qemuMigrationCancelDriveMirror(driver, vm, ret =3D=3D 0, - QEMU_ASYNC_JOB_MIGRATION_OUT, - dconn) < 0) - ret =3D -1; - } + if (ret < 0 && mig && mig->nbd) + qemuMigrationCancelDriveMirror(driver, vm, false, + QEMU_ASYNC_JOB_MIGRATION_OUT, + dconn); =20 VIR_FREE(tlsAlias); VIR_FREE(secAlias); virObjectUnref(cfg); =20 - if (spec->fwdType !=3D MIGRATION_FWD_DIRECT) { - if (iothread && qemuMigrationStopTunnel(iothread, ret < 0) < 0) - ret =3D -1; - } - VIR_FORCE_CLOSE(fd); + if (ret < 0 && iothread) + qemuMigrationStopTunnel(iothread, true); =20 - if (priv->job.completed) { - qemuDomainJobInfoUpdateTime(priv->job.completed); - qemuDomainJobInfoUpdateDowntime(priv->job.completed); - ignore_value(virTimeMillisNow(&priv->job.completed->sent)); - } + VIR_FORCE_CLOSE(fd); =20 if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_ACTIVE || priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_MIGRATING) priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; =20 - cookieFlags |=3D QEMU_MIGRATION_COOKIE_NETWORK | - QEMU_MIGRATION_COOKIE_STATS; - - if (ret =3D=3D 0 && - (qemuMigrationCookieAddPersistent(mig, &persistDef) < 0 || - qemuMigrationBakeCookie(mig, driver, vm, cookieout, - cookieoutlen, cookieFlags) < 0)) { - VIR_WARN("Unable to encode migration cookie"); - } - virDomainDefFree(persistDef); qemuMigrationCookieFree(mig); =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 12:09:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508421417173244.7956440011218; Thu, 19 Oct 2017 06:56:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0301F7E44F; Thu, 19 Oct 2017 13:56:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB356DF98E; Thu, 19 Oct 2017 13:56:55 +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 687CA3FAEE; Thu, 19 Oct 2017 13:56:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9JDugI6030152 for ; Thu, 19 Oct 2017 09:56:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 222FCD1C76; Thu, 19 Oct 2017 13:56:42 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB65AD1C85 for ; Thu, 19 Oct 2017 13:56:34 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 646381020BC; Thu, 19 Oct 2017 15:56:33 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0301F7E44F Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 19 Oct 2017 15:56:28 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/7] qemu: Split cleanup and error code in qemuMigrationRun 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 19 Oct 2017 13:56:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Let cleanup only do things common to both failure and success paths and move error handling code inside the new "error" section. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 79 ++++++++++++++++++++++++-------------------= ---- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index f0d4f9d98..6956901be 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3657,20 +3657,20 @@ qemuMigrationRun(virQEMUDriverPtr driver, if (persist_xml) { if (!(persistDef =3D qemuMigrationPrepareDef(driver, persist_x= ml, NULL, NULL))) - goto cleanup; + goto error; } else { virDomainDefPtr def =3D vm->newDef ? vm->newDef : vm->def; if (!(persistDef =3D qemuDomainDefCopy(driver, def, VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_MIGRATABLE= ))) - goto cleanup; + goto error; } } =20 mig =3D qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, cookieFlags | QEMU_MIGRATION_COOKIE_GRAPH= ICS); if (!mig) - goto cleanup; + goto error; =20 if (qemuDomainMigrateGraphicsRelocate(driver, vm, mig, graphicsuri) < = 0) VIR_WARN("unable to provide data for graphics client relocation"); @@ -3683,7 +3683,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, if (qemuMigrationAddTLSObjects(driver, vm, cfg, false, QEMU_ASYNC_JOB_MIGRATION_OUT, &tlsAlias, &secAlias, migParams) < = 0) - goto cleanup; + goto error; =20 /* We need to add tls-hostname whenever QEMU itself does not * connect directly to the destination. */ @@ -3691,17 +3691,17 @@ qemuMigrationRun(virQEMUDriverPtr driver, spec->destType =3D=3D MIGRATION_DEST_FD) { if (VIR_STRDUP(migParams->migrateTLSHostname, spec->dest.host.name) < 0) - goto cleanup; + goto error; } else { /* Be sure there's nothing from a previous migration */ if (VIR_STRDUP(migParams->migrateTLSHostname, "") < 0) - goto cleanup; + goto error; } } else { if (qemuMigrationSetEmptyTLSParams(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, migParams) < 0) - goto cleanup; + goto error; } =20 if (migrate_flags & (QEMU_MONITOR_MIGRATE_NON_SHARED_DISK | @@ -3715,7 +3715,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, nmigrate_disks, migrate_disks, dconn) < 0) { - goto cleanup; + goto error; } } else { /* Destination doesn't support NBD server. @@ -3729,37 +3729,37 @@ qemuMigrationRun(virQEMUDriverPtr driver, if (!(flags & VIR_MIGRATE_LIVE) && virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { if (qemuMigrationSetOffline(driver, vm) < 0) - goto cleanup; + goto error; } =20 if (qemuMigrationSetCompression(driver, vm, QEMU_ASYNC_JOB_MIGRATION_O= UT, compression, migParams) < 0) - goto cleanup; + goto error; =20 if (qemuMigrationSetOption(driver, vm, QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE, flags & VIR_MIGRATE_AUTO_CONVERGE, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) - goto cleanup; + goto error; =20 if (qemuMigrationSetOption(driver, vm, QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL, flags & VIR_MIGRATE_RDMA_PIN_ALL, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) - goto cleanup; + goto error; =20 if (qemuMigrationSetPostCopy(driver, vm, flags & VIR_MIGRATE_POSTCOPY, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) - goto cleanup; + goto error; =20 if (qemuMigrationSetParams(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, migParams) < 0) - goto cleanup; + goto error; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) - goto cleanup; + goto error; =20 if (priv->job.abortJob) { /* explicitly do this *after* we entered the monitor, @@ -3770,7 +3770,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"), qemuDomainAsyncJobTypeToString(priv->job.asyncJob), _("canceled by client")); - goto cleanup; + goto error; } =20 if (qemuMonitorSetMigrationSpeed(priv->mon, migrate_speed) < 0) @@ -3817,7 +3817,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, if (qemuDomainObjExitMonitor(driver, vm) < 0) ret =3D -1; if (ret < 0) - goto cleanup; + goto error; ret =3D -1; =20 /* From this point onwards we *must* call cancel to abort the @@ -3846,7 +3846,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, if (rc =3D=3D -2) goto cancel; else if (rc =3D=3D -1) - goto cleanup; + goto error; =20 if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_POSTCOPY) inPostCopy =3D true; @@ -3901,28 +3901,10 @@ qemuMigrationRun(virQEMUDriverPtr driver, ret =3D 0; =20 cleanup: - if (ret < 0 && !orig_err) - orig_err =3D virSaveLastError(); - - /* cancel any outstanding NBD jobs */ - if (ret < 0 && mig && mig->nbd) - qemuMigrationCancelDriveMirror(driver, vm, false, - QEMU_ASYNC_JOB_MIGRATION_OUT, - dconn); - VIR_FREE(tlsAlias); VIR_FREE(secAlias); virObjectUnref(cfg); - - if (ret < 0 && iothread) - qemuMigrationStopTunnel(iothread, true); - VIR_FORCE_CLOSE(fd); - - if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_ACTIVE || - priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_MIGRATING) - priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; - virDomainDefFree(persistDef); qemuMigrationCookieFree(mig); =20 @@ -3936,9 +3918,28 @@ qemuMigrationRun(virQEMUDriverPtr driver, =20 return ret; =20 + error: + if (!orig_err) + orig_err =3D virSaveLastError(); + + /* cancel any outstanding NBD jobs */ + if (mig && mig->nbd) + qemuMigrationCancelDriveMirror(driver, vm, false, + QEMU_ASYNC_JOB_MIGRATION_OUT, + dconn); + + if (iothread) + qemuMigrationStopTunnel(iothread, true); + + if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_ACTIVE || + priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_MIGRATING) + priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; + + goto cleanup; + exit_monitor: ignore_value(qemuDomainObjExitMonitor(driver, vm)); - goto cleanup; + goto error; =20 cancel: orig_err =3D virSaveLastError(); @@ -3950,14 +3951,14 @@ qemuMigrationRun(virQEMUDriverPtr driver, ignore_value(qemuDomainObjExitMonitor(driver, vm)); } } - goto cleanup; + goto error; =20 cancelPostCopy: priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; if (inPostCopy) goto cancel; else - goto cleanup; + goto error; } =20 /* Perform migration using QEMU's native migrate support, --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 12:09:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508421401966673.9266844530559; Thu, 19 Oct 2017 06:56:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81C5C820FE; Thu, 19 Oct 2017 13:56:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 553FED1C76; Thu, 19 Oct 2017 13:56:40 +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 1AD2C3FC71; Thu, 19 Oct 2017 13:56:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9JDucT4030105 for ; Thu, 19 Oct 2017 09:56:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8AB3CB906E; Thu, 19 Oct 2017 13:56:38 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 323C3B9068 for ; Thu, 19 Oct 2017 13:56:34 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 66C501020BD; Thu, 19 Oct 2017 15:56:33 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 81C5C820FE Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 19 Oct 2017 15:56:29 +0200 Message-Id: <2b1fb4e81f216a88cc968c15ef0781dc1871d827.1508421251.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/7] qemu: Unite error handling in qemuMigrationRun 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 19 Oct 2017 13:56:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Merge cancel and cancelPostCopy sections with the generic error section, where we can easily decide whether canceling the ongoing migration is required. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 61 ++++++++++++++++++++++---------------------= ---- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 6956901be..cbf255704 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3616,7 +3616,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, unsigned int cookieFlags =3D 0; bool abort_on_error =3D !!(flags & VIR_MIGRATE_ABORT_ON_ERROR); bool events =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVE= NT); - bool inPostCopy =3D false; + bool cancel =3D false; unsigned int waitFlags; virDomainDefPtr persistDef =3D NULL; char *timestamp; @@ -3822,10 +3822,11 @@ qemuMigrationRun(virQEMUDriverPtr driver, =20 /* From this point onwards we *must* call cancel to abort the * migration on source if anything goes wrong */ + cancel =3D true; =20 if (spec->fwdType !=3D MIGRATION_FWD_DIRECT) { if (!(iothread =3D qemuMigrationStartTunnel(spec->fwd.stream, fd))) - goto cancel; + goto error; /* If we've created a tunnel, then the 'fd' will be closed in the * qemuMigrationIOFunc as data->sock. */ @@ -3843,13 +3844,18 @@ qemuMigrationRun(virQEMUDriverPtr driver, rc =3D qemuMigrationWaitForCompletion(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, dconn, waitFlags); - if (rc =3D=3D -2) - goto cancel; - else if (rc =3D=3D -1) + if (rc =3D=3D -2) { goto error; + } else if (rc =3D=3D -1) { + /* QEMU reported failed migration, nothing to cancel anymore */ + cancel =3D false; + goto error; + } =20 - if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_POSTCOPY) - inPostCopy =3D true; + if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_QEMU_COMPL= ETED) { + /* QEMU finished migration, nothing to cancel anymore */ + cancel =3D false; + } =20 /* When migration completed, QEMU will have paused the CPUs for us. * Wait for the STOP event to be processed or explicitly stop CPUs @@ -3861,25 +3867,25 @@ qemuMigrationRun(virQEMUDriverPtr driver, rc =3D virDomainObjWait(vm); priv->signalStop =3D false; if (rc < 0) - goto cancelPostCopy; + goto error; } } else if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING && qemuMigrationSetOffline(driver, vm) < 0) { - goto cancelPostCopy; + goto error; } =20 if (mig && mig->nbd && qemuMigrationCancelDriveMirror(driver, vm, true, QEMU_ASYNC_JOB_MIGRATION_OUT, dconn) < 0) - goto cancelPostCopy; + goto error; =20 if (iothread) { qemuMigrationIOThreadPtr io; =20 VIR_STEAL_PTR(io, iothread); if (qemuMigrationStopTunnel(io, false) < 0) - goto cancelPostCopy; + goto error; } =20 if (priv->job.completed) { @@ -3919,8 +3925,15 @@ qemuMigrationRun(virQEMUDriverPtr driver, return ret; =20 error: - if (!orig_err) - orig_err =3D virSaveLastError(); + orig_err =3D virSaveLastError(); + + if (cancel && + virDomainObjIsActive(vm) && + qemuDomainObjEnterMonitorAsync(driver, vm, + QEMU_ASYNC_JOB_MIGRATION_OUT) =3D= =3D 0) { + qemuMonitorMigrateCancel(priv->mon); + ignore_value(qemuDomainObjExitMonitor(driver, vm)); + } =20 /* cancel any outstanding NBD jobs */ if (mig && mig->nbd) @@ -3932,7 +3945,8 @@ qemuMigrationRun(virQEMUDriverPtr driver, qemuMigrationStopTunnel(iothread, true); =20 if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_ACTIVE || - priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_MIGRATING) + priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_MIGRATING = || + priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_POSTCOPY) priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; =20 goto cleanup; @@ -3940,25 +3954,6 @@ qemuMigrationRun(virQEMUDriverPtr driver, exit_monitor: ignore_value(qemuDomainObjExitMonitor(driver, vm)); goto error; - - cancel: - orig_err =3D virSaveLastError(); - - if (virDomainObjIsActive(vm)) { - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) = =3D=3D 0) { - qemuMonitorMigrateCancel(priv->mon); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); - } - } - goto error; - - cancelPostCopy: - priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; - if (inPostCopy) - goto cancel; - else - goto error; } =20 /* Perform migration using QEMU's native migrate support, --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 12:09:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508421464948897.5515180429253; Thu, 19 Oct 2017 06:57:44 -0700 (PDT) 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 E01C27EAAA; Thu, 19 Oct 2017 13:57:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAF6BB9063; Thu, 19 Oct 2017 13:57:43 +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 89AE83D3F4; Thu, 19 Oct 2017 13:57:43 +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 v9JDuft8030145 for ; Thu, 19 Oct 2017 09:56:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6F327D3903; Thu, 19 Oct 2017 13:56:41 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F692D390C for ; Thu, 19 Oct 2017 13:56:39 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 68E641020BE; Thu, 19 Oct 2017 15:56:33 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E01C27EAAA Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 19 Oct 2017 15:56:30 +0200 Message-Id: <5d2796ad2c03e0dbcee357a145c05a828299b0d9.1508421251.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/7] qemu: Don't misuse "ret" in qemuMigrationRun 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@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.28]); Thu, 19 Oct 2017 13:57:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The "ret" variable is used for storing the return value of a function and should not be used as a temporary variable. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index cbf255704..2d8a634f9 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3788,16 +3788,17 @@ qemuMigrationRun(virQEMUDriverPtr driver, VIR_FREE(timestamp); } =20 + rc =3D -1; switch (spec->destType) { case MIGRATION_DEST_HOST: if (STREQ(spec->dest.host.protocol, "rdma") && virProcessSetMaxMemLock(vm->pid, vm->def->mem.hard_limit << 10= ) < 0) { goto exit_monitor; } - ret =3D qemuMonitorMigrateToHost(priv->mon, migrate_flags, - spec->dest.host.protocol, - spec->dest.host.name, - spec->dest.host.port); + rc =3D qemuMonitorMigrateToHost(priv->mon, migrate_flags, + spec->dest.host.protocol, + spec->dest.host.name, + spec->dest.host.port); break; =20 case MIGRATION_DEST_CONNECT_HOST: @@ -3809,16 +3810,14 @@ qemuMigrationRun(virQEMUDriverPtr driver, fd =3D spec->dest.fd.local; spec->dest.fd.local =3D -1; } - ret =3D qemuMonitorMigrateToFd(priv->mon, migrate_flags, - spec->dest.fd.qemu); + rc =3D qemuMonitorMigrateToFd(priv->mon, migrate_flags, + spec->dest.fd.qemu); VIR_FORCE_CLOSE(spec->dest.fd.qemu); break; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret =3D -1; - if (ret < 0) + + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) goto error; - ret =3D -1; =20 /* From this point onwards we *must* call cancel to abort the * migration on source if anything goes wrong */ --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 12:09:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 150842141361036.87287671236163; Thu, 19 Oct 2017 06:56:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EBD9653C; Thu, 19 Oct 2017 13:56:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D2B5D2761; Thu, 19 Oct 2017 13:56:52 +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 E95C63FC75; Thu, 19 Oct 2017 13:56:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9JDuexY030125 for ; Thu, 19 Oct 2017 09:56:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 30BEEB908A; Thu, 19 Oct 2017 13:56:40 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02424B908B for ; Thu, 19 Oct 2017 13:56:39 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 6B5671020BF; Thu, 19 Oct 2017 15:56:33 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4EBD9653C 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=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 19 Oct 2017 15:56:31 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/7] qemu: Consistently use exit_monitor in qemuMigrationRun 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 19 Oct 2017 13:56:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Almost every failure in qemuMigrationRun while we are talking to QEMU monitor results in a jump to exit_monitor label. The only exception is removed by this patch. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 2d8a634f9..8a529f9ad 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3765,12 +3765,11 @@ qemuMigrationRun(virQEMUDriverPtr driver, /* explicitly do this *after* we entered the monitor, * as this is a critical section so we are guaranteed * priv->job.abortJob will not change */ - ignore_value(qemuDomainObjExitMonitor(driver, vm)); priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_CANCELED; virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"), qemuDomainAsyncJobTypeToString(priv->job.asyncJob), _("canceled by client")); - goto error; + goto exit_monitor; } =20 if (qemuMonitorSetMigrationSpeed(priv->mon, migrate_speed) < 0) --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 12:09:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508421443130182.68410827435468; Thu, 19 Oct 2017 06:57:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 116B340254; Thu, 19 Oct 2017 13:57:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE7B9B57F1; Thu, 19 Oct 2017 13:57:21 +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 AB6293D3D6; Thu, 19 Oct 2017 13:57:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9JDueFd030130 for ; Thu, 19 Oct 2017 09:56:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 54E52DF006; Thu, 19 Oct 2017 13:56:40 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2641CDF99B for ; Thu, 19 Oct 2017 13:56:40 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 6D9961020C0; Thu, 19 Oct 2017 15:56:33 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 116B340254 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 19 Oct 2017 15:56:32 +0200 Message-Id: <6e29ec43561b61a5f75f1a0621476bfaf6bf0038.1508421251.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/7] qemu: Set correct job status when qemuMigrationRun fails 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 19 Oct 2017 13:57:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Instead of enumerating all states which need to be turned into QEMU_DOMAIN_JOB_STATUS_FAILED (and failing to add all of them), it's better to mention just the one which needs to be left alone. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8a529f9ad..f785c308c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3942,9 +3942,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, if (iothread) qemuMigrationStopTunnel(iothread, true); =20 - if (priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_ACTIVE || - priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_MIGRATING = || - priv->job.current->status =3D=3D QEMU_DOMAIN_JOB_STATUS_POSTCOPY) + if (priv->job.current->status !=3D QEMU_DOMAIN_JOB_STATUS_CANCELED) priv->job.current->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; =20 goto cleanup; --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list