[libvirt] [PATCH] conf: reattach interface taps to correct bridge on restart

Laine Stump laine at redhat.com
Fri Sep 20 14:06:35 UTC 2019


When the bridge re-attach handling was moved out of the network driver
and into the hypervisor driver (commit b806a60e) as a part of the
refactor to split the network driver into a separate daemon, the check
was accidentally changed to only check for type='bridge'. The check for
type in this case needs to check for type='network' as well.

(at the time we thought that type='network' and type='bridge' could be
conflated for interface actual type, but this turned out to be too
problematic to do).

Signed-off-by: Laine Stump <laine at redhat.com>
---

(NB: I thought I remembered seeing a bugzilla report go by about this
regression, but couldn't find it in any of the places I frequent
(upstream, Fedora, or RHEL) If someone can locate it and wants to let
me know the BZ#, I can add it to the commit message and update the
report).

(This fixes the reconnect of taps to their bridges, but the count
maintained in the network object still isn't being updated in these
cases. I've tried removing the !virUUIDIsValid() check in this same
chunk, along with preserving the original port uuid if it's already
valid in virDomainNetDefActualToNetworkPort(), and that results in
fixing the usage count for type='network' when it's a libvirt-managed
bridge or a macvtap passthrough pool, but leads to errors in other
cases.)


 src/conf/domain_conf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 848c831330..24223bceb2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30971,13 +30971,16 @@ virDomainNetNotifyActualDevice(virConnectPtr conn,
                                virDomainDefPtr dom,
                                virDomainNetDefPtr iface)
 {
+    virDomainNetType actualType = virDomainNetGetActualType(iface);
+
     if (!virUUIDIsValid(iface->data.network.portid)) {
         if (virDomainNetCreatePort(conn, dom, iface,
                                    VIR_NETWORK_PORT_CREATE_RECLAIM) < 0)
             return;
     }
 
-    if (virDomainNetGetActualType(iface) == VIR_DOMAIN_NET_TYPE_BRIDGE) {
+    if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
+        actualType == 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
-- 
2.21.0




More information about the libvir-list mailing list