From nobody Sun Feb 8 11:21:50 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=1654087985; cv=none; d=zohomail.com; s=zohoarc; b=JcKf5cdl3kJgIVikbrVyx79LBSMfISMgk3BD38KaaMoflEjisPN55qAl97OI/PVT9Wivo/cPNs5mJM83jdojkrMDRc4gz2wEJEXla4xihJOMYBMGDkvjQ5lHOHgVyscclaJLd0WnbzNEJ+OGpVAWLvaZ/jDCxzK4qcsX+fvERNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654087985; 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=p/bGq0GHpi+bmXIvvTlhGiFzvn7rzIfLlxc/mucoQzU=; b=eholReb19adrmge1OFtAvOqJVYpXFKHMI6MGU5NYNIU8pXS676wB2uQpHXrcD1DcpIJePtpMM6PsIR1iz7ZaOyJTkFR06mHUk7/enL+9wMK5tBYFAXQC5RKTFi5Cifr/vogDFIcB0FWQU4xm8Z0O7W8v8JsE+uufxUQMLTdP+d4= 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 1654087985187942.5385672004842; Wed, 1 Jun 2022 05:53:05 -0700 (PDT) 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-470-c0RdHV3OO2uPjwb_wSyK9A-1; Wed, 01 Jun 2022 08:51:40 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 456B03C222FA; Wed, 1 Jun 2022 12:50:45 +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 2ACC6C27E8F; Wed, 1 Jun 2022 12:50:45 +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 DC8951947B8E; Wed, 1 Jun 2022 12:50:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 32B461947B91 for ; Wed, 1 Jun 2022 12:50:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 195AC1415103; Wed, 1 Jun 2022 12:50:30 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EAF5C1410F36; Wed, 1 Jun 2022 12:50:29 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 9A496245B78; 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=1654087984; 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=p/bGq0GHpi+bmXIvvTlhGiFzvn7rzIfLlxc/mucoQzU=; b=gvli/phgcSGSmU6g3zvMBJHMKHP0Qx5v0VJIOAYzBgZ4DN4bdCBaLes/8R6tf7oi3E2on/ m3yYtw/YrVutKdPuqe7Tg18Dw0sFd5KcB1/UQ6lLpNzE4kzus/Hxwh0nzjoB42lkzbXjJI 7PAyrt9kwFqIb3sDELXe4GpAoM6uZWc= X-MC-Unique: c0RdHV3OO2uPjwb_wSyK9A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 44/81] qemu: Separate protocol checks from qemuMigrationJobSetPhase Date: Wed, 1 Jun 2022 14:49:44 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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.85 on 10.11.54.8 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: 1654087986382100003 Content-Type: text/plain; charset="utf-8" Into a new qemuMigrationCheckPhase helper, which can be reused in other places. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa Reviewed-by: Pavel Hrdina --- Notes: Version 2: - no change src/qemu/qemu_migration.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 710aae3eb7..edd3ac2a87 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -139,9 +139,9 @@ qemuMigrationJobStart(virQEMUDriver *driver, } =20 =20 -static void ATTRIBUTE_NONNULL(1) -qemuMigrationJobSetPhase(virDomainObj *vm, - qemuMigrationJobPhase phase) +static int +qemuMigrationCheckPhase(virDomainObj *vm, + qemuMigrationJobPhase phase) { qemuDomainObjPrivate *priv =3D vm->privateData; =20 @@ -150,9 +150,20 @@ qemuMigrationJobSetPhase(virDomainObj *vm, VIR_ERROR(_("migration protocol going backwards %s =3D> %s"), qemuMigrationJobPhaseTypeToString(priv->job.phase), qemuMigrationJobPhaseTypeToString(phase)); - return; + return -1; } =20 + return 0; +} + + +static void ATTRIBUTE_NONNULL(1) +qemuMigrationJobSetPhase(virDomainObj *vm, + qemuMigrationJobPhase phase) +{ + if (qemuMigrationCheckPhase(vm, phase) < 0) + return; + qemuDomainObjSetJobPhase(vm, phase); } =20 --=20 2.35.1