device/team: always try to connect to teamd in update_connection()
update_connection() may be called during startup when the bus watch hasn't notified yet the presence (or absence) of the teamd service on the bus. Try to obtain a connection to the service in order to retrieve the current configuration.
This commit is contained in:
@@ -51,6 +51,7 @@ typedef struct {
|
|||||||
guint teamd_process_watch;
|
guint teamd_process_watch;
|
||||||
guint teamd_timeout;
|
guint teamd_timeout;
|
||||||
guint teamd_dbus_watch;
|
guint teamd_dbus_watch;
|
||||||
|
gboolean teamd_dbus_name_owned;
|
||||||
} NMDeviceTeamPrivate;
|
} NMDeviceTeamPrivate;
|
||||||
|
|
||||||
static gboolean teamd_start (NMDevice *device, NMSettingTeam *s_team);
|
static gboolean teamd_start (NMDevice *device, NMSettingTeam *s_team);
|
||||||
@@ -160,12 +161,11 @@ update_connection (NMDevice *device, NMConnection *connection)
|
|||||||
}
|
}
|
||||||
g_object_set (G_OBJECT (s_team), NM_SETTING_TEAM_CONFIG, NULL, NULL);
|
g_object_set (G_OBJECT (s_team), NM_SETTING_TEAM_CONFIG, NULL, NULL);
|
||||||
|
|
||||||
if (priv->tdc) {
|
if (ensure_teamd_connection (device)) {
|
||||||
const char *config = NULL;
|
const char *config = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = teamdctl_config_get_raw_direct (NM_DEVICE_TEAM_GET_PRIVATE (device)->tdc,
|
err = teamdctl_config_get_raw_direct (priv->tdc, (char **)&config);
|
||||||
(char **)&config);
|
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
g_object_set (G_OBJECT (s_team), NM_SETTING_TEAM_CONFIG, config, NULL);
|
g_object_set (G_OBJECT (s_team), NM_SETTING_TEAM_CONFIG, config, NULL);
|
||||||
else
|
else
|
||||||
@@ -296,6 +296,7 @@ teamd_dbus_appeared (GDBusConnection *connection,
|
|||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
g_return_if_fail (priv->teamd_dbus_watch);
|
g_return_if_fail (priv->teamd_dbus_watch);
|
||||||
|
priv->teamd_dbus_name_owned = TRUE;
|
||||||
|
|
||||||
_LOGI (LOGD_TEAM, "teamd appeared on D-Bus");
|
_LOGI (LOGD_TEAM, "teamd appeared on D-Bus");
|
||||||
nm_device_queue_recheck_assume (device);
|
nm_device_queue_recheck_assume (device);
|
||||||
@@ -349,7 +350,7 @@ teamd_dbus_vanished (GDBusConnection *dbus_connection,
|
|||||||
|
|
||||||
g_return_if_fail (priv->teamd_dbus_watch);
|
g_return_if_fail (priv->teamd_dbus_watch);
|
||||||
|
|
||||||
if (!priv->tdc) {
|
if (!priv->teamd_dbus_name_owned) {
|
||||||
/* g_bus_watch_name will always raise an initial signal, to indicate whether the
|
/* g_bus_watch_name will always raise an initial signal, to indicate whether the
|
||||||
* name exists/not exists initially. Do not take this as a failure if it hadn't
|
* name exists/not exists initially. Do not take this as a failure if it hadn't
|
||||||
* previously appeared.
|
* previously appeared.
|
||||||
@@ -358,6 +359,8 @@ teamd_dbus_vanished (GDBusConnection *dbus_connection,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv->teamd_dbus_name_owned = FALSE;
|
||||||
|
|
||||||
_LOGI (LOGD_TEAM, "teamd vanished from D-Bus");
|
_LOGI (LOGD_TEAM, "teamd vanished from D-Bus");
|
||||||
teamd_cleanup (device, TRUE);
|
teamd_cleanup (device, TRUE);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user