conf: make virDomainNetNotifyActualDevice() callable for all interface types

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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>Reviewed-by: Michal Privoznik <mprivozn@redhat.com>#Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Laine Stump 2020-10-20 12:35:09 -04:00
parent a4be2e35db
commit dad50cf855
2 changed files with 5 additions and 4 deletions

View File

@ -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),

View File

@ -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,