diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-06-30 10:10:48 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-07-07 17:31:23 +0200 |
commit | 5d4fc4c9ace2d5226ecf5205ea5384424c5a9835 (patch) | |
tree | a271be751083576e0e6661ecf5460c23b131e9eb | |
parent | 06ded430e8403c3995ebdc01403f7cc9da988682 (diff) | |
download | NetworkManager-5d4fc4c9ace2d5226ecf5205ea5384424c5a9835.tar.gz |
team: fail the connection if the teamd configuration can't be read
If the read of teamd configuration failed (possibly due to a timeout),
fail the connection immediately where possible instead of letting it
continue and risk to block again at the next read.
https://bugzilla.redhat.com/show_bug.cgi?id=1257237
-rw-r--r-- | src/devices/team/nm-device-team.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 76e957bcdb..6d2560493f 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -152,7 +152,7 @@ ensure_teamd_connection (NMDevice *device) return !!priv->tdc; } -static void +static gboolean teamd_read_config (NMDevice *device) { NMDeviceTeam *self = NM_DEVICE_TEAM (device); @@ -163,7 +163,7 @@ teamd_read_config (NMDevice *device) if (priv->tdc) { err = teamdctl_config_get_raw_direct (priv->tdc, &config); if (err) - _LOGI (LOGD_TEAM, "failed to read teamd config (err=%d)", err); + return FALSE; } if (!nm_streq0 (config, priv->config)) { @@ -171,6 +171,8 @@ teamd_read_config (NMDevice *device) priv->config = g_strdup (config); _notify (self, PROP_CONFIG); } + + return TRUE; } static void @@ -204,9 +206,9 @@ update_connection (NMDevice *device, NMConnection *connection) static gboolean master_update_slave_connection (NMDevice *self, - NMDevice *slave, - NMConnection *connection, - GError **error) + NMDevice *slave, + NMConnection *connection, + GError **error) { NMSettingTeamPort *s_port; char *port_config = NULL; @@ -310,7 +312,10 @@ teamd_timeout_cb (gpointer user_data) /* Read again the configuration after the timeout since it might * have changed. */ - teamd_read_config (device); + if (!teamd_read_config (device)) { + _LOGW (LOGD_TEAM, "failed to read teamd configuration"); + nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED); + } } return G_SOURCE_REMOVE; @@ -370,10 +375,11 @@ teamd_dbus_appeared (GDBusConnection *connection, */ success = ensure_teamd_connection (device); if (nm_device_get_state (device) == NM_DEVICE_STATE_PREPARE) { - if (success) { - teamd_read_config (device); + if (success) + success = teamd_read_config (device); + if (success) nm_device_activate_schedule_stage2_device_config (device); - } else if (!nm_device_uses_assumed_connection (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); } } |