summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-02-22 16:18:40 +0100
committerLubomir Rintel <lkundrak@v3.sk>2022-02-22 16:47:16 +0100
commit51544afcb670fda33aa56d133337b73c7dbc5686 (patch)
tree9819e2a6c8cd98d2053932776857afdccae1254a
parent47ff99515f0ecbc791851f3c1a1c61fb7efc234c (diff)
downloadNetworkManager-lr/ovs-restart.tar.gz
ovs-port: avoid removing the OVSDB entry if we're shutting downlr/ovs-restart
Since commit ecc73eb239e6 ('ovs-port: always remove the OVSDB entry on slave release'), ovs port were removing the ovsdb entry upon being un-enslaved, no matter what the reason for un-enslavement was. The idea was to remove the stale ovsdb entry upon forcible device removal. This cleanup is specific to OpenVSwitch, since for other device types, the device master is the property of the slave and thus goes away along with the device. Turns out we're now removing the ovsdb entry even when the device actually doesn't go away, but we're pretending it does because the daemon is shutting down. To add insult to injury, we generally end up removing one entry, because the other ovsdb calls end up in a queue and don't get serviced before the daemon shuts down. The result is a mess. (This patch doesn't solve that -- if someone terminates the daemon with in-flight ovsdb calls they're still out of luck). Let's do the cleanup now only if the device was actually physically removed. https://bugzilla.redhat.com/show_bug.cgi?id=2055665 Fixes-test: @NM_reboot_openvswitch_vlan_configuration Fixes: ecc73eb239e6 ('ovs-port: always remove the OVSDB entry on slave release')
-rw-r--r--src/core/devices/ovs/nm-device-ovs-port.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/devices/ovs/nm-device-ovs-port.c b/src/core/devices/ovs/nm-device-ovs-port.c
index 4419cfe96f..500dbc0fdd 100644
--- a/src/core/devices/ovs/nm-device-ovs-port.c
+++ b/src/core/devices/ovs/nm-device-ovs-port.c
@@ -145,6 +145,7 @@ static void
release_slave(NMDevice *device, NMDevice *slave, gboolean configure)
{
NMDeviceOvsPort *self = NM_DEVICE_OVS_PORT(device);
+ bool slave_removed = nm_device_sys_iface_state_get(slave) == NM_DEVICE_SYS_IFACE_STATE_REMOVED;
_LOGI(LOGD_DEVICE, "releasing ovs interface %s", nm_device_get_ip_iface(slave));
@@ -152,10 +153,12 @@ release_slave(NMDevice *device, NMDevice *slave, gboolean configure)
* 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 || slave_removed) {
+ nm_ovsdb_del_interface(nm_ovsdb_get(),
+ nm_device_get_iface(slave),
+ del_iface_cb,
+ g_object_ref(slave));
+ }
if (configure) {
/* Open VSwitch is going to delete this one. We must ignore what happens