[libvirt Patch v2 1/4] conf: make virDomainNetNotifyActualDevice() callable for all interface types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The bridge reattach functionality in this function should be called
for interface types other than just type='network', so make it
callable for any type - it just becomes a NOP for types where no
action is needed.

In the case of <interface type='network'> we need to create a port in
the network driver, and for both type='network and type='bridge' we
need to reattach the bridge device (note that
virDomainNetGetActualBridgeName() gets the bridge name from the
appropriate (and different!) location for either type of interface).

All other interfaces currently require no action.

modifying callers of this function to actually call it for all
interface types is in the next patch. For now the behavior should be
identical pre and post-patch.

(NB: the conn argument can now legitimately be NULL, so we need to
change the ATTRIBUTE_NONNULL() directive for the function's
declaration - I noticed when making this change that argument 3 (the
NetDefPtr) could never be NULL, so I added ATTRIBUTE_NONNULL(3) while
removing ATTRIBUTE_NONNULL(1) (conn)).

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 7 ++++---
 src/conf/domain_conf.h | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 472ce79e67..40ca20be33 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30933,8 +30933,9 @@ virDomainNetNotifyActualDevice(virConnectPtr conn,
 {
     virDomainNetType actualType = virDomainNetGetActualType(iface);
 
-    if (virDomainNetCreatePort(conn, dom, iface,
-                               VIR_NETWORK_PORT_CREATE_RECLAIM) < 0) {
+    if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK && conn
+        && virDomainNetCreatePort(conn, dom, iface,
+                                  VIR_NETWORK_PORT_CREATE_RECLAIM) < 0) {
         return;
     }
 
@@ -30946,7 +30947,7 @@ virDomainNetNotifyActualDevice(virConnectPtr conn,
          * (final arg to virNetDevTapReattachBridge())
          */
         ignore_value(virNetDevTapReattachBridge(iface->ifname,
-                                                iface->data.network.actual->data.bridge.brname,
+                                                virDomainNetGetActualBridgeName(iface),
                                                 &iface->mac, dom->uuid,
                                                 virDomainNetGetActualVirtPortProfile(iface),
                                                 virDomainNetGetActualVlan(iface),
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 59bf8a12b3..ec43bbe186 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3875,7 +3875,7 @@ void
 virDomainNetNotifyActualDevice(virConnectPtr conn,
                                virDomainDefPtr dom,
                                virDomainNetDefPtr iface)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
 
 int
 virDomainNetReleaseActualDevice(virConnectPtr conn,
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux