team: only proceed with stage2 when team device is STATE_PREPARE

The team device might already be in a different state because
activation failed. In this case, we don't want to proceed with
stage2.
This commit is contained in:
Thomas Haller 2014-12-12 17:11:31 +01:00
parent 1172178ce6
commit 86b6fd01cb

View file

@ -330,16 +330,21 @@ teamd_dbus_appeared (GDBusConnection *connection,
NMDeviceTeam *self = NM_DEVICE_TEAM (user_data);
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
NMDevice *device = NM_DEVICE (self);
gboolean success;
g_return_if_fail (priv->teamd_dbus_watch);
_LOGI (LOGD_TEAM, "teamd appeared on D-Bus");
teamd_timeout_remove (device);
if (!ensure_teamd_connection (device)) {
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED);
success = ensure_teamd_connection (device);
if (nm_device_get_state (device) == NM_DEVICE_STATE_PREPARE) {
if (success)
nm_device_activate_schedule_stage2_device_config (device);
else if (!nm_device_uses_assumed_connection (device))
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED);
return;
}
nm_device_activate_schedule_stage2_device_config (device);
}
static void