From nobody Sun Feb 8 18:32:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1654087930; cv=none; d=zohomail.com; s=zohoarc; b=krb18+M80JKYeeFbsL+HEJLQq/fvlLcEBF2aUSKkCzqlVuxP7yFuryiaNIjSeHmrpflUMq9bEahkO/r2t1wifr8dFTMXF8FpILUy7GrTij3ZLfoirT43OprpzPDi+2fZL/JoViKHH+QJasKSpgt2sx+lPWEyazKKyR3RYYM23Es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654087930; h=Content-Type:Content-Transfer-Encoding:Cc: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=VIPNaM+I24bwFk9BqyAiZHuk3w2Mq4kBmFsnf+8K2dM=; b=RIDUrqbR8jH9MypQJYwx4gKR5bObNrDny+6L+bCAr8yh9nMiCe/V/kRErwmfwBvJ0PYVezqJcrZsI0UJJwdh+myy8pOy7bwllwXssNfifp1hzfFN9NTaQemOW2CA14Vzc+qFipwmGarA5oZ5tBJRyomJG0KyYq/CDTAQhZC3S5Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1654087930408217.23429939578432; Wed, 1 Jun 2022 05:52:10 -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-124-ARlsr9rbNe-bV1HQLnT-CQ-1; Wed, 01 Jun 2022 08:51:08 -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 26E508041AA; Wed, 1 Jun 2022 12:50:37 +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 12C1940CFD0A; Wed, 1 Jun 2022 12:50:37 +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 CE3F61947B99; Wed, 1 Jun 2022 12:50:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 305A7193F6F6 for ; Wed, 1 Jun 2022 12:50:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id F10D12166B30; Wed, 1 Jun 2022 12:50:28 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D009E2166B2D; Wed, 1 Jun 2022 12:50:28 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 7DE52245B63; Wed, 1 Jun 2022 14:50:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654087929; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=VIPNaM+I24bwFk9BqyAiZHuk3w2Mq4kBmFsnf+8K2dM=; b=KIROU7zje5elbOKxnf56oc4HGRF4ZlqIT9p8i0p65i+6D8cErsqak3r4BZ8Wd113UWMryM yfCe+dWvC9qo+uT3wuULx7StAAI6WIdxHfxHKgnf928nFHqe6CGNFlyhZu/WmnM8gLjquf 0JKeefcUMseJGWahNh5/3luxW5tgeF0= X-MC-Unique: ARlsr9rbNe-bV1HQLnT-CQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 23/81] qemu: Move success-only code out of endjob in qemuMigrationDstFinish Date: Wed, 1 Jun 2022 14:49:23 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: , Cc: Peter Krempa , Pavel Hrdina 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: 1654087932143100011 Content-Type: text/plain; charset="utf-8" Code executed only when dom !=3D NULL can be moved before "endjob" label, to the only place where dom is set. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa Reviewed-by: Pavel Hrdina --- Notes: Version 2: - fixed indentation src/qemu/qemu_migration.c | 50 ++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8a1210c8c7..f6d3200cba 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -5813,8 +5813,16 @@ qemuMigrationDstFinish(virQEMUDriver *driver, =20 if (flags & VIR_MIGRATE_OFFLINE) { if (retcode =3D=3D 0 && - qemuMigrationDstPersist(driver, vm, mig, false) =3D=3D 0) + qemuMigrationDstPersist(driver, vm, mig, false) =3D=3D 0) { dom =3D virGetDomain(dconn, vm->def->name, vm->def->uuid, -1); + + if (dom && + qemuMigrationCookieFormat(mig, driver, vm, + QEMU_MIGRATION_DESTINATION, + cookieout, cookieoutlen, + QEMU_MIGRATION_COOKIE_STATS) < 0) + VIR_WARN("Unable to encode migration cookie"); + } goto endjob; } =20 @@ -5977,6 +5985,25 @@ qemuMigrationDstFinish(virQEMUDriver *driver, /* Guest is successfully running, so cancel previous auto destroy */ qemuProcessAutoDestroyRemove(driver, vm); =20 + if (jobData) { + priv->job.completed =3D g_steal_pointer(&jobData); + priv->job.completed->status =3D VIR_DOMAIN_JOB_STATUS_COMPLETED; + qemuDomainJobSetStatsType(priv->job.completed, + QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION); + } + + if (qemuMigrationCookieFormat(mig, driver, vm, + QEMU_MIGRATION_DESTINATION, + cookieout, cookieoutlen, + QEMU_MIGRATION_COOKIE_STATS) < 0) + VIR_WARN("Unable to encode migration cookie"); + + /* Remove completed stats for post-copy, everything but timing fields + * is obsolete anyway. + */ + if (inPostCopy) + g_clear_pointer(&priv->job.completed, virDomainJobDataFree); + dom =3D virGetDomain(dconn, vm->def->name, vm->def->uuid, vm->def->id); =20 endjob: @@ -5997,27 +6024,6 @@ qemuMigrationDstFinish(virQEMUDriver *driver, } } =20 - if (dom) { - if (jobData) { - priv->job.completed =3D g_steal_pointer(&jobData); - priv->job.completed->status =3D VIR_DOMAIN_JOB_STATUS_COMPLETE= D; - qemuDomainJobSetStatsType(priv->job.completed, - QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION= ); - } - - if (qemuMigrationCookieFormat(mig, driver, vm, - QEMU_MIGRATION_DESTINATION, - cookieout, cookieoutlen, - QEMU_MIGRATION_COOKIE_STATS) < 0) - VIR_WARN("Unable to encode migration cookie"); - - /* Remove completed stats for post-copy, everything but timing fie= lds - * is obsolete anyway. - */ - if (inPostCopy) - g_clear_pointer(&priv->job.completed, virDomainJobDataFree); - } - if (virDomainObjIsFailedPostcopy(vm)) { qemuProcessAutoDestroyRemove(driver, vm); qemuDomainCleanupAdd(vm, qemuProcessCleanupMigrationJob); --=20 2.35.1