]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Revert "network: use 'bridge' as actual type instead of 'network'"
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 30 Apr 2019 12:26:30 +0000 (13:26 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 30 Apr 2019 13:42:34 +0000 (14:42 +0100)
This caused the live XML to report the 'bridge' type instead of the
'network' type, which is a behavioural regression.

It also breaks 'virsh domif-setlink', 'virsh update-device' and
'virsh domiftune'

This reverts commit 518026e15959ab0e19b659a9f2ff502a54946498.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/domain_conf.c
src/network/bridge_driver.c
src/qemu/qemu_driver.c
tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml
tests/qemustatusxml2xmldata/migration-in-params-in.xml
tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml
tests/qemustatusxml2xmldata/migration-out-params-in.xml
tests/qemustatusxml2xmldata/modern-in.xml

index 63314246354771ace83e0446d1664de46502fa27..b4fb6cf981e30e226b147d2280ae932e3cca12d3 100644 (file)
@@ -5128,19 +5128,6 @@ virDomainNetDefPostParse(virDomainNetDefPtr net)
         return -1;
     }
 
-    /* Older libvirtd uses actualType==network, but we now
-     * just use actualType==bridge, as nothing needs to
-     * distinguish the two cases, and this simplifies virt
-     * drive code */
-    if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
-        net->data.network.actual != NULL  &&
-        net->data.network.actual->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
-        char mac[VIR_MAC_STRING_BUFLEN];
-        virMacAddrFormat(&net->mac, mac);
-        VIR_DEBUG("Updating NIC %s actual type to bridge", mac);
-        net->data.network.actual->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
-    }
-
     return 0;
 }
 
@@ -11281,21 +11268,11 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
     }
 
     bandwidth_node = virXPathNode("./bandwidth", ctxt);
-    if (bandwidth_node) {
-        /* type == NETWORK is legacy config, converted to BRIDGE
-         * in post-parse function, but this code runs before
-         * post-parse logic, so we must account for configs still
-         * using legacy type == NETWORK
-         */
-        bool allowFloor =
-            (actual->type == VIR_DOMAIN_NET_TYPE_NETWORK) ||
-            (actual->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
-             actual->data.bridge.brname != NULL);
-        if (virNetDevBandwidthParse(&actual->bandwidth,
-                                    bandwidth_node,
-                                    allowFloor) < 0)
-            goto error;
-    }
+    if (bandwidth_node &&
+        virNetDevBandwidthParse(&actual->bandwidth,
+                                bandwidth_node,
+                                actual->type == VIR_DOMAIN_NET_TYPE_NETWORK) < 0)
+        goto error;
 
     vlanNode = virXPathNode("./vlan", ctxt);
     if (vlanNode && virNetDevVlanParse(vlanNode, ctxt, &actual->vlan) < 0)
index 77206b45844e92f5326c8070cdb338b6bd3208a8..26f7f8041867f17a408ada8639a15490937e5dbc 100644 (file)
@@ -4489,7 +4489,11 @@ networkAllocateActualDevice(virNetworkPtr net,
     case VIR_NETWORK_FORWARD_NAT:
     case VIR_NETWORK_FORWARD_ROUTE:
     case VIR_NETWORK_FORWARD_OPEN:
-        iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
+        /* for these forward types, the actual net type really *is*
+         * NETWORK; we just keep the info from the portgroup in
+         * iface->data.network.actual
+         */
+        iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_NETWORK;
 
         /* we also store the bridge device and macTableManager settings
          * in iface->data.network.actual->data.bridge for later use
@@ -5433,8 +5437,9 @@ networkBandwidthGenericChecks(virDomainNetDefPtr iface,
     virNetDevBandwidthPtr ifaceBand;
     unsigned long long old_floor, new_floor;
 
-    if (virDomainNetGetActualType(iface) != VIR_DOMAIN_NET_TYPE_BRIDGE ||
-        iface->data.network.actual->data.bridge.brname == NULL) {
+    if (virDomainNetGetActualType(iface) != VIR_DOMAIN_NET_TYPE_NETWORK &&
+        (virDomainNetGetActualType(iface) != VIR_DOMAIN_NET_TYPE_BRIDGE ||
+         iface->data.network.actual->data.bridge.brname == NULL)) {
         /* This is not an interface that's plugged into a network.
          * We don't care. Thus from our POV bandwidth change is allowed. */
         return false;
index c072bed1ce1a14617d1ca735a96ffd26bf383d25..b2ac737d1f1ea943f56eb805207b75e9e7d1a19f 100644 (file)
@@ -4567,7 +4567,7 @@ processNicRxFilterChangedEvent(virQEMUDriverPtr driver,
         syncNicRxFilterDeviceOptions(def->ifname, guestFilter, hostFilter);
     }
 
-    if (virDomainNetGetActualType(def) == VIR_DOMAIN_NET_TYPE_BRIDGE) {
+    if (virDomainNetGetActualType(def) == VIR_DOMAIN_NET_TYPE_NETWORK) {
         const char *brname = virDomainNetGetActualBridgeName(def);
 
         /* For libivrt network connections, set the following TUN/TAP network
index 2ff4e5249c8ec88cee337886e785a9f6cc9de029..7a26e93aa4ab89f5c385382a23cfb13bc184bf57 100644 (file)
       <interface type='network'>
         <mac address='52:54:00:36:bd:3b'/>
         <source network='default'/>
-        <actual type='bridge'>
+        <actual type='network'>
           <source bridge='virbr0'/>
         </actual>
         <target dev='vnet0'/>
index 2d72050782b45af0fdafc9ff7553d3e0bd3a13be..03f18b4f3d5ce5caae777b97b8fe4098ffbd3653 100644 (file)
       <interface type='network'>
         <mac address='52:54:00:59:59:91'/>
         <source network='default'/>
-        <actual type='bridge'>
+        <actual type='network'>
           <source bridge='virbr0'/>
         </actual>
         <target dev='vnet0'/>
index b7b03c380a1dc311f49c85e03f81b014a564dea7..315d8e4c1ab2b934636a12ace68553b77921a7e5 100644 (file)
       <interface type='network'>
         <mac address='52:54:00:36:bd:3b'/>
         <source network='default'/>
-        <actual type='bridge'>
+        <actual type='network'>
           <source bridge='virbr0'/>
         </actual>
         <target dev='vnet0'/>
index ec79ef730415af96c52094d49715407dfba7f32c..869f37d488ea0512ff2654186527bb5aa62bea9f 100644 (file)
       <interface type='network'>
         <mac address='52:54:00:36:bd:3b'/>
         <source network='default'/>
-        <actual type='bridge'>
+        <actual type='network'>
           <source bridge='virbr0'/>
         </actual>
         <target dev='vnet0'/>
index cdcde09fe88fedf5af9058e017c4c5b084c3dc63..ae2064830af4396b64662d03634ea710279aad86 100644 (file)
       <interface type='network'>
         <mac address='52:54:00:59:59:91'/>
         <source network='default'/>
-        <actual type='bridge'>
+        <actual type='network'>
           <source bridge='virbr0'/>
         </actual>
         <target dev='vnet0'/>
index f0afbff3c492a9867a0deb6c8f4b1a8f2002eed1..08f7f40761d8b1926be2dfcf1c969bce22e7893e 100644 (file)
       <interface type='network'>
         <mac address='52:54:00:36:bd:3b'/>
         <source network='default'/>
-        <actual type='bridge'>
+        <actual type='network'>
           <source bridge='virbr0'/>
         </actual>
         <target dev='vnet0'/>