device: wait controller's reactivation
When device activation noticed its controller is deactivation due to new
activation, current code simply fail the device stage 1 activation with
NM_DEVICE_STATE_REASON_NONE
hoping connection.autoconnect-ports
could bring this port up again.
When the controller is configured with
connection.autoconnect-ports: false
, this action will cause port
device never been activated again.
This problem is original found when rolling back a checkpoint with OVS
port configured connection.autoconnect-ports: false
leaving the OVS
system interface remain deactivated after rollback finished.
To fix the problem:
-
Instead of waiting NMActiveConnection to reach ACTIVATING state, we wait NMDevice reach PREPARE state via
nm_active_connection_set_controller_dev()
. -
It is possible controller NMActiveConnection has no NMDevice attached, so
nm_active_connection_set_controller_ac()
will hook on signal of state change of controller NMActiveConnection, and invokenm_active_connection_set_controller_dev()
once got controller device. -
In device stage1, before attaching self to controller, the controller might be deactivated or got new activation, check again whether controller device reach PREPARE state, if not, invoke
nm_active_connection_set_controller_dev()
ornm_active_connection_set_controller_ac()
and wait on signal ofNM_ACTIVE_CONNECTION_INT_CONTROLLER_READY