diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2021-01-25 15:02:35 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2021-01-27 10:13:45 +0100 |
commit | fb4532942d36dfdbc6310b7034bc41c70fc19801 (patch) | |
tree | bf0d0d16a5ae68fcebd716795f6ad7aec28f35bd | |
parent | c7754677c4c6a572457a68ed75f205fd98e43824 (diff) | |
download | NetworkManager-bg/ovs-cleanup-pt2.tar.gz |
core: unblock OVS interfaces when the ovsdb is readybg/ovs-cleanup-pt2
OVS system interfaces can start to connect even before the ovsdb is
ready. However, the connection attempt is doomed to fail and the
NMSettingsConnection gets blocked with reason FAILED.
Unblock them once the ovsdb is ready.
Ideally, NMPolicy should subscribe to the NMOvsdb::ready signal,
however NMOvsdb is in a plugin, so it's easier if NMOvsdb directly
calls a function of the core.
-rw-r--r-- | src/devices/ovs/nm-ovsdb.c | 2 | ||||
-rw-r--r-- | src/nm-manager.c | 8 | ||||
-rw-r--r-- | src/nm-manager.h | 2 | ||||
-rw-r--r-- | src/nm-policy.c | 24 | ||||
-rw-r--r-- | src/nm-policy.h | 2 |
5 files changed, 38 insertions, 0 deletions
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c index c89c5452ee..de54a2e6c9 100644 --- a/src/devices/ovs/nm-ovsdb.c +++ b/src/devices/ovs/nm-ovsdb.c @@ -15,6 +15,7 @@ #include "nm-core-utils.h" #include "nm-core-internal.h" #include "devices/nm-device.h" +#include "nm-manager.h" #include "nm-setting-ovs-external-ids.h" /*****************************************************************************/ @@ -2268,6 +2269,7 @@ _check_ready(NMOvsdb *self) if (priv->num_pending_deletions == 0) { priv->ready = TRUE; g_signal_emit(self, signals[READY], 0); + nm_manager_unblock_failed_ovs_interfaces(nm_manager_get()); } } diff --git a/src/nm-manager.c b/src/nm-manager.c index a085f88d74..550ac5e6ce 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -7582,6 +7582,14 @@ periodic_update_active_connection_timestamps(gpointer user_data) return G_SOURCE_CONTINUE; } +void +nm_manager_unblock_failed_ovs_interfaces(NMManager *self) +{ + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self); + + nm_policy_unblock_failed_ovs_interfaces(priv->policy); +} + /*****************************************************************************/ void diff --git a/src/nm-manager.h b/src/nm-manager.h index 0585857ea1..e3f71b8055 100644 --- a/src/nm-manager.h +++ b/src/nm-manager.h @@ -209,4 +209,6 @@ void nm_manager_device_auth_request(NMManager * self, NMManagerDeviceAuthRequestFunc callback, gpointer user_data); +void nm_manager_unblock_failed_ovs_interfaces(NMManager *self); + #endif /* __NETWORKMANAGER_MANAGER_H__ */ diff --git a/src/nm-policy.c b/src/nm-policy.c index e74531e92c..98ff704102 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1541,6 +1541,30 @@ hostname_changed(NMHostnameManager *hostname_manager, GParamSpec *pspec, gpointe update_system_hostname(self, "hostname changed"); } +void +nm_policy_unblock_failed_ovs_interfaces(NMPolicy *self) +{ + NMPolicyPrivate * priv = NM_POLICY_GET_PRIVATE(self); + NMSettingsConnection *const *connections = NULL; + guint i; + + _LOGT(LOGD_DEVICE, "unblocking failed OVS interfaces"); + + connections = nm_settings_get_connections(priv->settings, NULL); + for (i = 0; connections[i]; i++) { + NMSettingsConnection *sett_conn = connections[i]; + NMConnection * connection = nm_settings_connection_get_connection(sett_conn); + + if (nm_connection_get_setting_ovs_interface(connection)) { + nm_settings_connection_autoconnect_retries_reset(sett_conn); + nm_settings_connection_autoconnect_blocked_reason_set( + sett_conn, + NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED, + FALSE); + } + } +} + static gboolean reset_autoconnect_all( NMPolicy *self, diff --git a/src/nm-policy.h b/src/nm-policy.h index 26178931ea..fa216db3a8 100644 --- a/src/nm-policy.h +++ b/src/nm-policy.h @@ -32,6 +32,8 @@ NMActiveConnection *nm_policy_get_default_ip6_ac(NMPolicy *policy); NMActiveConnection *nm_policy_get_activating_ip4_ac(NMPolicy *policy); NMActiveConnection *nm_policy_get_activating_ip6_ac(NMPolicy *policy); +void nm_policy_unblock_failed_ovs_interfaces(NMPolicy *self); + /** * NMPolicyHostnameMode * @NM_POLICY_HOSTNAME_MODE_NONE: never update the transient hostname. |