[libvirt] [PATCH v4 07/29] network: move fixup for domain actual net def out of network driver

Daniel P. Berrangé posted 29 patches 6 years, 9 months ago
There is a newer version of this series
[libvirt] [PATCH v4 07/29] network: move fixup for domain actual net def out of network driver
Posted by Daniel P. Berrangé 6 years, 9 months ago
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.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/conf/domain_conf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b94b70aabc..c4c2eb0281 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30437,6 +30437,7 @@ virDomainNetNotifyActualDevice(virConnectPtr conn,
                                virDomainDefPtr dom,
                                virDomainNetDefPtr iface)
 {
+    virDomainNetType actualType = virDomainNetGetActualType(iface);
     virNetworkPtr net = NULL;
 
     if (!netNotify)
@@ -30445,6 +30446,16 @@ virDomainNetNotifyActualDevice(virConnectPtr conn,
     if (!(net = virNetworkLookupByName(conn, iface->data.network.name)))
         return;
 
+    /* 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 (actualType == VIR_DOMAIN_NET_TYPE_NETWORK) {
+        iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
+        actualType = VIR_DOMAIN_NET_TYPE_BRIDGE;
+    }
+
+
     if (netNotify(net, dom, iface) < 0)
         goto cleanup;
 
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list