summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2023-05-04 15:11:49 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2023-05-16 13:18:36 +0200
commit93430627c245a0b33b873edca329fa716ccfb7d6 (patch)
tree7ae0fcc6724500e15d6b35da499ce3e0b12cec4d
parent7a6257d4464b6abbd92111b3eb485857e4799c67 (diff)
team: don't try to connect to teamd in update_connection()bg/team-avoid-dbus-error
In constructed(), NMDevice starts watching the D-Bus name owner or monitoring the unix socket, and so it is always aware if teamd is running. When it is, NMDevice connects to it and initializes priv->tdc. It is not useful to try to connect to teamd in update_connection() because warnings will be generated by NM and by libteam if teamd is not running. As explained above the connection is always initialized when teamd is available, and so we can just check priv->tdc. Fixes: ab586236e36b ('core: implement update_connection() for Team') https://bugzilla.redhat.com/show_bug.cgi?id=2182029 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1631
-rw-r--r--src/core/devices/team/nm-device-team.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/core/devices/team/nm-device-team.c b/src/core/devices/team/nm-device-team.c
index 60b15049a0..4d748362fa 100644
--- a/src/core/devices/team/nm-device-team.c
+++ b/src/core/devices/team/nm-device-team.c
@@ -226,24 +226,10 @@ update_connection(NMDevice *device, NMConnection *connection)
NMDeviceTeam *self = NM_DEVICE_TEAM(device);
NMSettingTeam *s_team = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_TEAM);
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE(self);
- struct teamdctl *tdc = priv->tdc;
- GError *error = NULL;
/* Read the configuration only if not already set */
- if (!priv->config) {
- if (ensure_teamd_connection(device, &error)) {
- teamd_read_config(self);
- } else {
- _LOGD(LOGD_TEAM, "could not connect to teamd: %s", error->message);
- g_clear_error(&error);
- }
- }
-
- /* Restore previous tdc state */
- if (priv->tdc && !tdc) {
- teamdctl_disconnect(priv->tdc);
- teamdctl_free(priv->tdc);
- priv->tdc = NULL;
+ if (!priv->config && priv->tdc) {
+ teamd_read_config(self);
}
g_object_set(G_OBJECT(s_team), NM_SETTING_TEAM_CONFIG, _get_config(self), NULL);