From nobody Sun Feb 8 14:10:13 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 ARC-Seal: i=1; a=rsa-sha256; t=1555521612; cv=none; d=zoho.com; s=zohoarc; b=kgTV6E9sYIiMy4Zc6i3+GAzKsOnsSiNVjqVhI7b0nQsgTi/eDEHd2UruoqL7pm8ckrBKkYUQqxnUUsKhGZaCjfbRL3wixU2XV+mCxodhsFz/rnonDhTUWbsM+2HcCww+jlmvGpV/W3uOvFSoMaddB73LxbqW47h54O34SzcER5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555521612; 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:ARC-Authentication-Results; bh=PPiAyRlVawHUj3GMS/YhOZR78xhJKKr7OEAjuU6ednY=; b=hCfFG+IEgelZWT+xmL5ROQJLyS3N5gN3kxUtZZeHeLjKqdlkc2lwg8mZYf1vdA8YO7PROrq47p9v+kweHTre0/3wGXJ2+HYCYhy4rq1xTMr+3ivcw4g8kJUJDtQPIz5hzMCj2eeXevN+R/tgi72sqwgRJKL4yWqFfz5s8N10ces= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155552161270231.149328053931526; Wed, 17 Apr 2019 10:20:12 -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 05F1B307EAA1; Wed, 17 Apr 2019 17:20:11 +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 C32D65D704; Wed, 17 Apr 2019 17:20:10 +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 76BEE181B9EC; Wed, 17 Apr 2019 17:20:10 +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 x3HHJmbw030550 for ; Wed, 17 Apr 2019 13:19:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8E4855D707; Wed, 17 Apr 2019 17:19:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-35.ams2.redhat.com [10.36.112.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 170385D704; Wed, 17 Apr 2019 17:19:46 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 17 Apr 2019 18:19:06 +0100 Message-Id: <20190417171929.9399-7-berrange@redhat.com> In-Reply-To: <20190417171929.9399-1-berrange@redhat.com> References: <20190417171929.9399-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 Cc: Laine Stump Subject: [libvirt] [PATCH v4 06/29] network: move re-attach of bridge device 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 17 Apr 2019 17:20:11 +0000 (UTC) During initial NIC setup the hypervisor drivers are responsible for attaching the TAP device to the bridge device. Any fixup after libvirtd restarts should thus also be their responsibility. Reviewed-by: Laine Stump Signed-off-by: Daniel P. Berrang=C3=A9 --- src/conf/domain_conf.c | 20 +++++++++++++++++++- src/conf/domain_conf.h | 2 +- src/network/bridge_driver.c | 27 ++++++--------------------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1dde45a6fd..b94b70aabc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -54,6 +54,7 @@ #include "virsecret.h" #include "virstring.h" #include "virnetdev.h" +#include "virnetdevtap.h" #include "virnetdevmacvlan.h" #include "virhostdev.h" #include "virmdev.h" @@ -30444,8 +30445,25 @@ virDomainNetNotifyActualDevice(virConnectPtr conn, if (!(net =3D virNetworkLookupByName(conn, iface->data.network.name))) return; =20 - netNotify(net, dom, iface); + if (netNotify(net, dom, iface) < 0) + goto cleanup; + + if (virDomainNetGetActualType(iface) =3D=3D VIR_DOMAIN_NET_TYPE_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 virNetDevTapReattachBridge()) + */ + if (virNetDevTapReattachBridge(iface->ifname, + iface->data.network.actual->data.br= idge.brname, + &iface->mac, dom->uuid, + virDomainNetGetActualVirtPortProfil= e(iface), + virDomainNetGetActualVlan(iface), + iface->mtu, NULL) < 0) + goto cleanup; + } =20 + cleanup: virObjectUnref(net); } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5910ed0beb..fb053a7ca3 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3552,7 +3552,7 @@ typedef int virDomainDefPtr dom, virDomainNetDefPtr iface); =20 -typedef void +typedef int (*virDomainNetNotifyActualDeviceImpl)(virNetworkPtr net, virDomainDefPtr dom, virDomainNetDefPtr iface); diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 4055939ade..8b36376761 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4793,12 +4793,11 @@ networkAllocateActualDevice(virNetworkPtr net, * Called to notify the network driver when libvirtd is restarted and * finds an already running domain. If appropriate it will force an * allocation of the actual->direct.linkdev to get everything back in - * order, or re-attach the interface's tap device to the network's - * bridge. + * order. * - * No return value (but does log any failures) + * Returns 0 on success, -1 on failure. */ -static void +static int networkNotifyActualDevice(virNetworkPtr net, virDomainDefPtr dom, virDomainNetDefPtr iface) @@ -4809,6 +4808,7 @@ networkNotifyActualDevice(virNetworkPtr net, virNetworkDefPtr netdef; virNetworkForwardIfDefPtr dev =3D NULL; size_t i; + int ret =3D -1; =20 obj =3D virNetworkObjFindByName(driver->networks, net->name); if (!obj) { @@ -4833,22 +4833,6 @@ networkNotifyActualDevice(virNetworkPtr net, goto error; } =20 - /* see if we're connected to the correct bridge */ - if (netdef->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 virNetDevTapReattachBridge()) - */ - if (virNetDevTapReattachBridge(iface->ifname, netdef->bridge, - &iface->mac, dom->uuid, - virDomainNetGetActualVirtPortProfil= e(iface), - virDomainNetGetActualVlan(iface), - iface->mtu, NULL) < 0) { - goto error; - } - } - if (!iface->data.network.actual || (actualType !=3D VIR_DOMAIN_NET_TYPE_DIRECT && actualType !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV)) { @@ -4977,10 +4961,11 @@ networkNotifyActualDevice(virNetworkPtr net, goto error; } networkLogAllocation(netdef, actualType, dev, iface, true); + ret =3D 0; =20 cleanup: virNetworkObjEndAPI(&obj); - return; + return ret; =20 error: goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list