From nobody Sun Feb 8 16:24:15 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 1552999648731183.53343982642696; Tue, 19 Mar 2019 05:47:28 -0700 (PDT) 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 1408E83F44; Tue, 19 Mar 2019 12:47:27 +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 DEF2E5D777; Tue, 19 Mar 2019 12:47:26 +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 948F33FA45; Tue, 19 Mar 2019 12:47:26 +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 x2JClPsq028792 for ; Tue, 19 Mar 2019 08:47:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 354E25D78E; Tue, 19 Mar 2019 12:47:25 +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 AA8EA5D777; Tue, 19 Mar 2019 12:47:17 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 19 Mar 2019 12:46:31 +0000 Message-Id: <20190319124700.16722-8-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 07/36] network: use virNetDevTapReattachBridge API 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 19 Mar 2019 12:47:27 +0000 (UTC) Switch over to use the new API for re-attaching the bridge device Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Cole Robinson --- src/network/bridge_driver.c | 47 ++++++++----------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 40122612c8..7df0c0f67a 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4792,7 +4792,6 @@ networkNotifyActualDevice(virNetworkPtr net, virNetworkDefPtr netdef; virNetworkForwardIfDefPtr dev =3D NULL; size_t i; - char *master =3D NULL; =20 obj =3D virNetworkObjFindByName(driver->networks, net->name); if (!obj) { @@ -4839,42 +4838,17 @@ networkNotifyActualDevice(virNetworkPtr net, =20 /* see if we're connected to the correct bridge */ if (netdef->bridge) { - bool useOVS =3D false; - - if (virNetDevGetMaster(iface->ifname, &master) < 0) + /* + * NB: we can't notify the guest of any MTU change anyway, + * so there is no point in trying to learn the actualMTU + * (final arg to virNetDevTapReattachBridge()) + */ + if (virNetDevTapReattachBridge(iface->ifname, netdef->bridge, + &iface->mac, dom->uuid, + virDomainNetGetActualVirtPortProfil= e(iface), + virDomainNetGetActualVlan(iface), + iface->mtu, NULL) < 0) { goto error; - - /* IFLA_MASTER for a tap on an OVS switch is always "ovs-system" */ - if (STREQ_NULLABLE(master, "ovs-system")) { - useOVS =3D true; - VIR_FREE(master); - if (virNetDevOpenvswitchInterfaceGetMaster(iface->ifname, &mas= ter) < 0) - goto error; - } - - if (STRNEQ_NULLABLE(netdef->bridge, master)) { - /* disconnect from current (incorrect) bridge */ - if (master) { - VIR_INFO("Removing %s from %s", iface->ifname, master); - if (useOVS) - ignore_value(virNetDevOpenvswitchRemovePort(master, if= ace->ifname)); - else - ignore_value(virNetDevBridgeRemovePort(master, iface->= ifname)); - } - - /* attach/reattach to correct bridge. - * NB: we can't notify the guest of any MTU change anyway, - * so there is no point in trying to learn the actualMTU - * (final arg to virNetDevTapAttachBridge()) - */ - VIR_INFO("Attaching %s to %s", iface->ifname, netdef->bridge); - if (virNetDevTapAttachBridge(iface->ifname, netdef->bridge, - &iface->mac, dom->uuid, - virDomainNetGetActualVirtPortProf= ile(iface), - virDomainNetGetActualVlan(iface), - iface->mtu, NULL) < 0) { - goto error; - } } } =20 @@ -5009,7 +4983,6 @@ networkNotifyActualDevice(virNetworkPtr net, =20 cleanup: virNetworkObjEndAPI(&obj); - VIR_FREE(master); return; =20 error: --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list