ovs-port: always remove the OVSDB entry on slave release

When the link is externally removed, the OVSDB entry will be left
behind. That's not cool -- we need to remove it.

https://bugzilla.redhat.com/show_bug.cgi?id=1935026
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1084
This commit is contained in:
Lubomir Rintel
2022-02-03 11:28:53 +01:00
parent 405afad0a6
commit ecc73eb239

View File

@@ -146,18 +146,23 @@ release_slave(NMDevice *device, NMDevice *slave, gboolean configure)
{
NMDeviceOvsPort *self = NM_DEVICE_OVS_PORT(device);
_LOGI(LOGD_DEVICE, "releasing ovs interface %s", nm_device_get_ip_iface(slave));
/* Even if the an interface's device has gone away (e.g. externally
* removed and thus we're called with configure=FALSE), we still need
* to make sure its OVSDB entry is gone.
*/
nm_ovsdb_del_interface(nm_ovsdb_get(),
nm_device_get_iface(slave),
del_iface_cb,
g_object_ref(slave));
if (configure) {
_LOGI(LOGD_DEVICE, "releasing ovs interface %s", nm_device_get_ip_iface(slave));
nm_ovsdb_del_interface(nm_ovsdb_get(),
nm_device_get_iface(slave),
del_iface_cb,
g_object_ref(slave));
/* Open VSwitch is going to delete this one. We must ignore what happens
* next with the interface. */
if (NM_IS_DEVICE_OVS_INTERFACE(slave))
nm_device_update_from_platform_link(slave, NULL);
} else
_LOGI(LOGD_DEVICE, "ovs interface %s was released", nm_device_get_ip_iface(slave));
}
}
/*****************************************************************************/