From nobody Fri May 3 10:23:08 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 1515707394708243.62835219595104; Thu, 11 Jan 2018 13:49:54 -0800 (PST) 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 2AEF74D226; Thu, 11 Jan 2018 21:49:21 +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 890FC7FCEE; Thu, 11 Jan 2018 21:49:14 +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 3B7A7410B3; Thu, 11 Jan 2018 21:49:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0BLn1D7011160 for ; Thu, 11 Jan 2018 16:49:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id C1E8C17124; Thu, 11 Jan 2018 21:49:01 +0000 (UTC) Received: from mamuti.net (ovpn-204-160.brq.redhat.com [10.40.204.160]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 937125E1D3 for ; Thu, 11 Jan 2018 21:48:58 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id B34E110A3F7; Thu, 11 Jan 2018 22:48:56 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 11 Jan 2018 22:48:55 +0100 Message-Id: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Fix type of a completed job 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.25]); Thu, 11 Jan 2018 21:49:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Libvirt 3.7.0 and earlier libvirt reported a migration job as completed immediately after QEMU finished sending migration data at which point migration was not really complete yet. Commit v3.7.0-29-g3f2d6d829e fixed this, but caused a regression in reporting statistics for completed jobs which started reporting the job as still running. This happened because the completed job statistics including the job status are copied from the running job before we finally mark it as completed. Let's make sure QEMU_DOMAIN_JOB_STATUS_COMPLETED is always set in the completed job info even when the job has not finished yet. https://bugzilla.redhat.com/show_bug.cgi?id=3D1523036 Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- src/qemu/qemu_migration.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index c1ceb164d1..a56bc596ff 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1646,8 +1646,10 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driv= er, qemuDomainJobInfoUpdateTime(jobInfo); qemuDomainJobInfoUpdateDowntime(jobInfo); VIR_FREE(priv->job.completed); - if (VIR_ALLOC(priv->job.completed) =3D=3D 0) + if (VIR_ALLOC(priv->job.completed) =3D=3D 0) { *priv->job.completed =3D *jobInfo; + priv->job.completed->status =3D QEMU_DOMAIN_JOB_STATUS_COMPLETED; + } =20 if (asyncJob !=3D QEMU_ASYNC_JOB_MIGRATION_OUT && jobInfo->status =3D=3D QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED) @@ -5479,8 +5481,9 @@ qemuMigrationFinish(virQEMUDriverPtr driver, } =20 if (dom) { - priv->job.completed =3D jobInfo; - jobInfo =3D NULL; + VIR_STEAL_PTR(priv->job.completed, jobInfo); + priv->job.completed->status =3D QEMU_DOMAIN_JOB_STATUS_COMPLETED; + if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutl= en, QEMU_MIGRATION_COOKIE_STATS) < 0) VIR_WARN("Unable to encode migration cookie"); --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list