From nobody Mon Feb 9 09:33:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1608274867; cv=none; d=zohomail.com; s=zohoarc; b=Ar1Ou3uNXw57i7LTL9bvHz01H69Q5tDWYpRr3nQFX/B8yuyhbN1zTRQg9Oz3K0bPVFjZ1enGCQGQsTYSixN27/SnN9ELr1S7/9JmeS5+zgWRRAMfGqbiPANBP62ZFxpmzQjfiOzWJf2dhqcxubzBbN9gITH9oqpmMVp6GVtCu0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608274867; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ScL+0y0C4dn3N0Bz8Zt4g2twJZDQy1HmN15mKwpIQ2M=; b=KjOPnEsibhn9UTY0FpJrNcFsZ0faAkX9o3qppEfD2Jz294808y9nAHwAI7UC8vueY8wj9Pg4z/tXQ01oHLygUfCRKkK/t5p7WhMkKaTKBFXfSKrm7Yp9kWXQT/7YofKlnLczJ1+rJfMjRt7VK9SlivTobsXXcHBoINng0SIKf50= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1608274867417747.9834093914744; Thu, 17 Dec 2020 23:01:07 -0800 (PST) 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-165--1-tY8DdMEWEAPwFef-pcQ-1; Fri, 18 Dec 2020 02:01:02 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E599B8136; Fri, 18 Dec 2020 07:00:56 +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 4632A10013C0; Fri, 18 Dec 2020 07:00:56 +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 CFC601809CA0; Fri, 18 Dec 2020 07:00:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BI6wx8C028503 for ; Fri, 18 Dec 2020 01:58:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id B1869F00FD; Fri, 18 Dec 2020 06:58:59 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC95AF00EE for ; Fri, 18 Dec 2020 06:58:57 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58334811E76 for ; Fri, 18 Dec 2020 06:58:57 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-OglBSj0LPViOFOFKFKRIBg-1; Fri, 18 Dec 2020 01:58:54 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kq9id-00DT1e-K8 for libvir-list@redhat.com; Fri, 18 Dec 2020 09:58:27 +0300 X-MC-Unique: -1-tY8DdMEWEAPwFef-pcQ-1 X-MC-Unique: OglBSj0LPViOFOFKFKRIBg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v3 3/4] qemu: adopt to VIR_DRV_SUPPORTS_FEATURE return -1 Date: Fri, 18 Dec 2020 09:56:47 +0300 Message-Id: <1608274608-818018-4-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1608274608-818018-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1608274608-818018-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Otherwise in some places we can mistakenly report 'unsupported' error inste= ad of root cause. So let's handle root cause explicitly from the macro. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_migration.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 90b0ec9..fca21be 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4706,12 +4706,13 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr d= river, { int ret =3D -1; g_autoptr(virConnect) dconn =3D NULL; - bool p2p; + int p2p; virErrorPtr orig_err =3D NULL; bool offline =3D !!(flags & VIR_MIGRATE_OFFLINE); - bool dstOffline =3D false; + int dstOffline; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - bool useParams; + int useParams; + int rc; =20 VIR_DEBUG("driver=3D%p, sconn=3D%p, vm=3D%p, xmlin=3D%s, dconnuri=3D%s= , uri=3D%s, " "graphicsuri=3D%s, listenAddress=3D%s, nmigrate_disks=3D%zu,= " @@ -4771,17 +4772,27 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr d= river, qemuDomainObjEnterRemote(vm); p2p =3D VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn, VIR_DRV_FEATURE_MIGRATION_P2P); - /* v3proto reflects whether the caller used Perform3, but with - * p2p migrate, regardless of whether Perform2 or Perform3 - * were used, we decide protocol based on what target supports - */ - *v3proto =3D VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn, - VIR_DRV_FEATURE_MIGRATION_V3); + if (p2p < 0) + goto cleanup; + /* v3proto reflects whether the caller used Perform3, but with + * p2p migrate, regardless of whether Perform2 or Perform3 + * were used, we decide protocol based on what target supports + */ + rc =3D VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn, + VIR_DRV_FEATURE_MIGRATION_V3); + if (rc < 0) + goto cleanup; + *v3proto =3D !!rc; useParams =3D VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn, VIR_DRV_FEATURE_MIGRATION_PARAMS); - if (offline) + if (useParams < 0) + goto cleanup; + if (offline) { dstOffline =3D VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn, VIR_DRV_FEATURE_MIGRATION_OF= FLINE); + if (dstOffline < 0) + goto cleanup; + } if (qemuDomainObjExitRemote(vm, !offline) < 0) goto cleanup; =20 @@ -4819,7 +4830,7 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr dri= ver, persist_xml, dname, uri, g= raphicsuri, listenAddress, nmigrate_di= sks, migrate_disks, nbdPort, nbdURI, migParams= , resource, - useParams, flags); + !!useParams, flags); } else { ret =3D qemuMigrationSrcPerformPeer2Peer2(driver, sconn, dconn, vm, dconnuri, flags, dname, re= source, --=20 1.8.3.1