diff options
Diffstat (limited to 'src/devices/ovs')
| -rw-r--r-- | src/devices/ovs/nm-ovs-factory.c | 37 | ||||
| -rw-r--r-- | src/devices/ovs/nm-ovsdb.c | 21 |
2 files changed, 42 insertions, 16 deletions
diff --git a/src/devices/ovs/nm-ovs-factory.c b/src/devices/ovs/nm-ovs-factory.c index d1d79a1c..d7bd0a09 100644 --- a/src/devices/ovs/nm-ovs-factory.c +++ b/src/devices/ovs/nm-ovs-factory.c @@ -142,15 +142,40 @@ ovsdb_interface_failed (NMOvsdb *ovsdb, { NMDevice *device = NULL; NMSettingsConnection *connection = NULL; - - _LOGI (name, connection_uuid, "ovs interface \"%s\" (%s) failed: %s", name, connection_uuid, error); + NMConnection *c; + const char *type; + NMSettingOvsInterface *s_ovs_int; + gboolean is_patch = FALSE; + gboolean ignore; device = nm_manager_get_device (NM_MANAGER_GET, name, NM_DEVICE_TYPE_OVS_INTERFACE); - if (!device) - return; + if (device && connection_uuid) { + connection = nm_settings_get_connection_by_uuid (nm_device_get_settings (device), + connection_uuid); + } - if (connection_uuid) - connection = nm_settings_get_connection_by_uuid (nm_device_get_settings (device), connection_uuid); + /* The patch interface which gets created first is expected to + * fail because the second patch doesn't exist yet. Ignore all + * failures of patch interfaces. */ + if ( connection + && (c = nm_settings_connection_get_connection (connection)) + && (type = nm_connection_get_connection_type (c)) + && nm_streq0 (type, NM_SETTING_OVS_INTERFACE_SETTING_NAME) + && (s_ovs_int = nm_connection_get_setting_ovs_interface (c)) + && nm_streq0 (nm_setting_ovs_interface_get_interface_type (s_ovs_int), "patch")) + is_patch = TRUE; + + ignore = !device || is_patch; + + _NMLOG (ignore ? LOGL_DEBUG : LOGL_INFO, + name, connection_uuid, + "ovs interface \"%s\" (%s) failed%s: %s", + name, connection_uuid, + ignore ? " (ignored)" : "", + error); + + if (ignore) + return; if (connection) { nm_settings_connection_autoconnect_blocked_reason_set (connection, diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c index b6550b25..e1865f9d 100644 --- a/src/devices/ovs/nm-ovsdb.c +++ b/src/devices/ovs/nm-ovsdb.c @@ -131,10 +131,9 @@ typedef struct { #define OVSDB_MAX_FAILURES 3 static void -_call_trace (const char *comment, OvsdbMethodCall *call, json_t *msg) +_LOGT_call_do (const char *comment, OvsdbMethodCall *call, json_t *msg) { -#if NM_MORE_LOGGING - char *str = NULL; + gs_free char *str = NULL; if (msg) str = json_dumps (msg, 0); @@ -169,12 +168,14 @@ _call_trace (const char *comment, OvsdbMethodCall *call, json_t *msg) call->mtu); break; } - - if (msg) - g_free (str); -#endif } +#define _LOGT_call(comment, call, message) \ + G_STMT_START { \ + if (_LOGT_ENABLED ()) \ + _LOGT_call_do ((comment), (call), (message)); \ + } G_STMT_END + /** * ovsdb_call_method: * @@ -226,7 +227,7 @@ ovsdb_call_method (NMOvsdb *self, OvsdbCommand command, break; } - _call_trace ("enqueue", call, NULL); + _LOGT_call ("enqueue", call, NULL); ovsdb_next_command (self); } @@ -875,7 +876,7 @@ ovsdb_next_command (NMOvsdb *self) } g_return_if_fail (msg); - _call_trace ("send", call, msg); + _LOGT_call ("send", call, msg); cmd = json_dumps (msg, 0); g_string_append (priv->output, cmd); @@ -1247,7 +1248,7 @@ ovsdb_got_msg (NMOvsdb *self, json_t *msg) } /* Cool, we found a corresponding call. Finish it. */ - _call_trace ("response", call, msg); + _LOGT_call ("response", call, msg); if (!json_is_null (error)) { /* The response contains an error. */ |