mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
util: don't return early from virNetDevTapReattachBridge() if "force" is true
It can be useful to force an interface to be detached/reattached from its bridge even if it's the same bridge - possibly something like the virtualport profileID has changed, and a detach/attach cycle will get it connected with the new profileID. The one and only current use of virNetDevTapReattachBridge() sets force to false, to preserve current behavior. An upcoming patch will use it with force set to true. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a37bd2a15b
commit
e3f8bccea6
@ -30625,7 +30625,7 @@ virDomainNetNotifyActualDevice(virConnectPtr conn,
|
||||
virDomainNetGetActualVirtPortProfile(iface),
|
||||
virDomainNetGetActualVlan(iface),
|
||||
virDomainNetGetActualPortOptionsIsolated(iface),
|
||||
iface->mtu, NULL));
|
||||
iface->mtu, NULL, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,6 +510,9 @@ virNetDevTapAttachBridge(const char *tapname,
|
||||
* @virtVlan: vlan tag info
|
||||
* @mtu: requested MTU for port (or 0 for "default")
|
||||
* @actualMTU: MTU actually set for port (after accounting for bridge's MTU)
|
||||
* @force: set true to force detach/reattach even if the bridge name is unchanged
|
||||
* (this can be useful if, for example, the profileid of the
|
||||
* <virtualport> changes)
|
||||
*
|
||||
* Ensures that the tap device (@tapname) is connected to the bridge
|
||||
* (@brname), potentially removing it from any existing bridge that
|
||||
@ -526,7 +529,8 @@ virNetDevTapReattachBridge(const char *tapname,
|
||||
const virNetDevVlan *virtVlan,
|
||||
virTristateBool isolatedPort,
|
||||
unsigned int mtu,
|
||||
unsigned int *actualMTU)
|
||||
unsigned int *actualMTU,
|
||||
bool force)
|
||||
{
|
||||
bool useOVS = false;
|
||||
g_autofree char *master = NULL;
|
||||
@ -542,7 +546,7 @@ virNetDevTapReattachBridge(const char *tapname,
|
||||
}
|
||||
|
||||
/* Nothing more todo if we're on the right bridge already */
|
||||
if (STREQ_NULLABLE(brname, master))
|
||||
if (STREQ_NULLABLE(brname, master) && !force)
|
||||
return 0;
|
||||
|
||||
/* disconnect from current (incorrect) bridge, if any */
|
||||
|
@ -82,7 +82,8 @@ virNetDevTapReattachBridge(const char *tapname,
|
||||
const virNetDevVlan *virtVlan,
|
||||
virTristateBool isolatedPort,
|
||||
unsigned int mtu,
|
||||
unsigned int *actualMTU)
|
||||
unsigned int *actualMTU,
|
||||
bool force)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user