summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-06-30 10:10:48 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-06-30 10:10:48 +0200
commitb8082628b73349cf72148461b3dec3e4713e84bf (patch)
tree60959dfbc4904f3a19ebe9065cc8e2439a8f7a33
parentbf1c73b3163a9972a28aa7a1e7f8b8c2c534a5a7 (diff)
downloadNetworkManager-bg/teamd-rh1257237.tar.gz
team: fail the connection if the teamd configuration can't be readbg/teamd-rh1257237
If the read of teamd configuration failed (possibly due to a timeout), fail the connection immediately where possible instead of letting it continue and risking 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.c24
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);
}
}