ovsdb: unrealize removed ovs-interfaces on UNAVAILABLE state

When NetworkManager shuts down, it is not done properly. We cannot
ensure that all pending async operations are cancelled and therefore
there are possible device leaks. This means that not all the devices
will be disposed and finalized because a different component is handling
a reference to it.

Since the l3cfg refactor, this is affecting to ovs ports. When shutting
down sometimes there are ovs-interface or ovs-port devices that are not
being cleared correctly. When starting NetworkManager back, these
devices are not going to be created again because they already exist and
the existing compatible connections will be instruct to use the device.
But currently, ovsdb is only unrealizing a device after removal if the
state is UNMANAGED. This is wrong, because it will left an inconsistent
state in NetworkManager and the ovs-port/ovs-interface connection won't
be activated.

The interfaces removed by ovsdb must be unrealized if they are on
UNAVAILABLE state.

https://bugzilla.redhat.com/show_bug.cgi?id=2029937
This commit is contained in:
Fernando Fernandez Mancera 2022-01-27 13:23:35 +01:00
parent 0f5536d60c
commit 3034b99c00

View file

@ -186,9 +186,10 @@ ovsdb_device_removed(NMOvsdb *ovsdb,
}
/* OVS system interfaces still exist even without the ovsdb entry */
if (!is_system_interface && device_state == NM_DEVICE_STATE_UNMANAGED) {
if (!is_system_interface
&& (device_state == NM_DEVICE_STATE_UNMANAGED
|| device_state == NM_DEVICE_STATE_UNAVAILABLE))
nm_device_unrealize(device, TRUE, NULL);
}
}
static void