From nobody Mon Feb 9 13:00:30 2026 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552999683336323.1880062640204; Tue, 19 Mar 2019 05:48:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D5F98123E; Tue, 19 Mar 2019 12:48:01 +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 435D72CFBD; Tue, 19 Mar 2019 12:48:01 +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 F08423FA4A; Tue, 19 Mar 2019 12:48:00 +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 x2JClxd0028938 for ; Tue, 19 Mar 2019 08:47:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 02D225D75C; Tue, 19 Mar 2019 12:47:59 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4ACA5D717; Tue, 19 Mar 2019 12:47:50 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 19 Mar 2019 12:46:34 +0000 Message-Id: <20190319124700.16722-11-berrange@redhat.com> In-Reply-To: <20190319124700.16722-1-berrange@redhat.com> References: <20190319124700.16722-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 10/36] network: move fixup for domain actual net def out of network driver 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: , Content-Type: text/plain; charset="utf-8" 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 19 Mar 2019 12:48:02 +0000 (UTC) The hypervisor drivers are soon going to communicate with the network driver via public APIs only. As such the network driver will not ever see the domain actual network def. Thus the backwards compatibility fixup logic must be moved out of the network driver. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laine Stump --- src/conf/domain_conf.c | 25 +++++++++++++++++++++++++ src/network/bridge_driver.c | 20 -------------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 99b75e26f3..35d965d2a3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30210,6 +30210,7 @@ virDomainNetNotifyActualDevice(virConnectPtr conn, virDomainDefPtr dom, virDomainNetDefPtr iface) { + virDomainNetType actualType =3D virDomainNetGetActualType(iface); virNetworkPtr net =3D NULL; =20 if (!netNotify) @@ -30218,6 +30219,30 @@ virDomainNetNotifyActualDevice(virConnectPtr conn, if (!(net =3D virNetworkLookupByName(conn, iface->data.network.name))) return; =20 + /* if we're restarting libvirtd after an upgrade from a version + * that didn't save bridge name in actualNetDef for + * actualType=3D=3Dnetwork, we need to copy it in so that it will be + * available in all cases + */ + if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK && + !iface->data.network.actual->data.bridge.brname) { + char *bridge =3D virNetworkGetBridgeName(net); + if (!bridge) + goto cleanup; + VIR_FREE(iface->data.network.actual->data.bridge.brname); + iface->data.network.actual->data.bridge.brname =3D bridge; + } + + /* Older libvirtd uses actualType=3D=3Dnetwork, but we now + * just use actualType=3D=3Dbridge, as nothing needs to + * distinguish the two cases, and this simplifies virt + * drive code */ + if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK) { + iface->data.network.actual->type =3D VIR_DOMAIN_NET_TYPE_BRIDGE; + actualType =3D VIR_DOMAIN_NET_TYPE_BRIDGE; + } + + if (netNotify(net, dom, iface) < 0) goto cleanup; =20 diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 5f3371b150..a1ae90a34c 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4816,26 +4816,6 @@ networkNotifyActualDevice(virNetworkPtr net, goto error; } =20 - /* if we're restarting libvirtd after an upgrade from a version - * that didn't save bridge name in actualNetDef for - * actualType=3D=3Dnetwork, we need to copy it in so that it will be - * available in all cases - */ - if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK && - !iface->data.network.actual->data.bridge.brname && - (VIR_STRDUP(iface->data.network.actual->data.bridge.brname, - netdef->bridge) < 0)) - goto error; - - /* Older libvirtd uses actualType=3D=3Dnetwork, but we now - * just use actualType=3D=3Dbridge, as nothing needs to - * distinguish the two cases, and this simplifies virt - * drive code */ - if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK) { - iface->data.network.actual->type =3D VIR_DOMAIN_NET_TYPE_BRIDGE; - actualType =3D VIR_DOMAIN_NET_TYPE_BRIDGE; - } - if (!iface->data.network.actual || (actualType !=3D VIR_DOMAIN_NET_TYPE_DIRECT && actualType !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV)) { --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list