diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2020-06-10 17:48:51 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2020-06-10 17:48:51 +0200 |
commit | 0d1df36e5899303c4f593ed32c27c2547237f0be (patch) | |
tree | 95abb8aec2201fe7d553f41cb47d57f1286d6f00 | |
parent | 040033a006539b4f573f24fbe776e21dbdf65b78 (diff) | |
parent | ffeac35f0409516aa2302189cca3f0b72518466a (diff) | |
download | NetworkManager-0d1df36e5899303c4f593ed32c27c2547237f0be.tar.gz |
ovs: merge branch 'bg/ovs-patch-peer-rh1845216'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/534
https://bugzilla.redhat.com/show_bug.cgi?id=1845216
-rw-r--r-- | clients/common/settings-docs.h.in | 2 | ||||
-rw-r--r-- | libnm-core/nm-setting-ovs-patch.c | 12 | ||||
-rw-r--r-- | src/devices/ovs/nm-ovs-factory.c | 37 |
3 files changed, 35 insertions, 16 deletions
diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in index 2ae2377813..a937f4ba6d 100644 --- a/clients/common/settings-docs.h.in +++ b/clients/common/settings-docs.h.in @@ -290,7 +290,7 @@ #define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_STP_ENABLE N_("Enable or disable STP.") #define DESCRIBE_DOC_NM_SETTING_OVS_DPDK_DEVARGS N_("Open vSwitch DPDK device arguments.") #define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_TYPE N_("The interface type. Either \"internal\", \"system\", \"patch\", \"dpdk\", or empty.") -#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_PEER N_("Specifies the unicast destination IP address of a remote Open vSwitch bridge port to connect to.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_PEER N_("Specifies the name of the interface for the other side of the patch. The patch on the other side must also set this interface as peer.") #define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_DOWNDELAY N_("The time port must be inactive in order to be considered down.") #define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_MODE N_("Bonding mode. One of \"active-backup\", \"balance-slb\", or \"balance-tcp\".") #define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_UPDELAY N_("The time port must be active before it starts forwarding traffic.") diff --git a/libnm-core/nm-setting-ovs-patch.c b/libnm-core/nm-setting-ovs-patch.c index 6a9c9f5681..5135e6ae23 100644 --- a/libnm-core/nm-setting-ovs-patch.c +++ b/libnm-core/nm-setting-ovs-patch.c @@ -81,13 +81,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if ( !nm_utils_ipaddr_is_valid (AF_INET, self->peer) - && !nm_utils_ipaddr_is_valid (AF_INET6, self->peer)) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("'%s' is not a valid IP address"), - self->peer); + if (!nm_utils_ifname_valid (self->peer, NMU_IFACE_OVS, error)) { g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_PATCH_SETTING_NAME, NM_SETTING_OVS_PATCH_PEER); @@ -179,8 +173,8 @@ nm_setting_ovs_patch_class_init (NMSettingOvsPatchClass *klass) /** * NMSettingOvsPatch:peer: * - * Specifies the unicast destination IP address of a remote Open vSwitch - * bridge port to connect to. + * Specifies the name of the interface for the other side of the patch. + * The patch on the other side must also set this interface as peer. * * Since: 1.10 **/ diff --git a/src/devices/ovs/nm-ovs-factory.c b/src/devices/ovs/nm-ovs-factory.c index d1d79a1cf0..d7bd0a0982 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, |