team: perform cleanup immediately when connecting to teamd fails

When NM fails to connect to teamd during an activation, it sets the
device state to FAILED. Eventually the device will become DISCONNECTED
and will call the ->deactivate() method that will perform the cleanup
of timers, teamd process and teamdctl instance.

However, in this way, when the device is DISCONNECTED timers are still
armed and can be triggered in the wrong state. Instead, perform the
cleanup immediately on failure.

https://bugzilla.redhat.com/show_bug.cgi?id=1856723
(cherry picked from commit 26e97fcd0d)
(cherry picked from commit 680c0b8812)
This commit is contained in:
Beniamino Galvani 2020-07-14 22:52:56 +02:00 committed by Thomas Haller
parent 8e4936f0d8
commit 7d4f3298aa
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -371,6 +371,7 @@ teamd_ready (NMDeviceTeam *self)
success = teamd_read_config (self);
if (!success) {
teamd_cleanup (self, TRUE);
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED);
return;
}