core: create devices first and realize them later

Unrealized devices aren't backed by kernel resources and so won't know
all of their attributes.  That means three things:

1) they must update their attributes when they become realized
2) they must clear those attributes when unrealized
3) they must be looser in checking compatible connections until
they are realized

This requires that the setup() function be split into two parts, start & finish,
because finish must be run after add_device()

Also, we can simplify whether to pay attention to 'recheck-assume', which
is now dependent on priv->is_nm_owned, because the only case where NM should
*not* listen for the 'recheck-assume' signal is when the device is a
software device created by NM itself.  That logic was previously spread
across the callers of add_device() but is now consolidated into
nm-manager.c::device_realized() and nm-device.c::nm_device_create_and_realize().
This commit is contained in:
Dan Williams
2014-09-24 16:58:07 -05:00
committed by Thomas Haller
parent b7eb622c24
commit 4dbaac4ba2
13 changed files with 358 additions and 281 deletions

View File

@@ -598,17 +598,17 @@ master_state_cb (NMActiveConnection *master,
gpointer user_data)
{
NMActiveConnection *self = NM_ACTIVE_CONNECTION (user_data);
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
NMActiveConnectionState master_state = nm_active_connection_get_state (master);
NMDevice *master_device = nm_active_connection_get_device (master);
check_master_ready (self);
_LOGD ("master ActiveConnection [%p] state now '%s' (%d)",
master, state_to_string (master_state), master_state);
if ( master_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING
&& !priv->master_ready) {
/* Master failed without ever creating its device */
if ( master_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATING
&& (!master_device || !nm_device_is_real (master_device))) {
/* Master failed without ever creating or realizing its device */
if (NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed)
NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed (self);
}