summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-12-09 10:46:16 +0100
committerThomas Haller <thaller@redhat.com>2020-12-09 12:22:54 +0100
commita106750f655f32d3754a79eac0392ed867685e61 (patch)
treecbde3202fcb1915c372c3110e18aee4384c7492b
parentb0f63dd6a93241c89bd6348775f900eaa99334a7 (diff)
downloadNetworkManager-th/ovs-external-ids-for-system-interface.tar.gz
libnm: allow OVS external-ids also for system interfaceth/ovs-external-ids-for-system-interface
Note that reapply currently does not work for OVS system interface. That is, because the code does not make it easy to implement that.
-rw-r--r--libnm-core/nm-setting-ovs-external-ids.c39
-rw-r--r--src/devices/nm-device.c5
2 files changed, 31 insertions, 13 deletions
diff --git a/libnm-core/nm-setting-ovs-external-ids.c b/libnm-core/nm-setting-ovs-external-ids.c
index 9371c281b5..7dc8f78ad2 100644
--- a/libnm-core/nm-setting-ovs-external-ids.c
+++ b/libnm-core/nm-setting-ovs-external-ids.c
@@ -345,7 +345,9 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
}
if (connection) {
- const char *type;
+ NMSettingConnection *s_con;
+ const char * type;
+ const char * slave_type;
type = nm_connection_get_connection_type(connection);
if (!type) {
@@ -355,18 +357,31 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
if (s_base)
type = nm_setting_get_name(s_base);
}
- if (!NM_IN_STRSET(type,
- NM_SETTING_OVS_BRIDGE_SETTING_NAME,
- NM_SETTING_OVS_PORT_SETTING_NAME,
- NM_SETTING_OVS_INTERFACE_SETTING_NAME)) {
- g_set_error_literal(error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("OVS external IDs can only be added to a profile of type OVS "
- "bridge/port/interface"));
- return FALSE;
- }
+ if (NM_IN_STRSET(type,
+ NM_SETTING_OVS_BRIDGE_SETTING_NAME,
+ NM_SETTING_OVS_PORT_SETTING_NAME,
+ NM_SETTING_OVS_INTERFACE_SETTING_NAME))
+ goto connection_type_is_good;
+
+ if ((s_con = nm_connection_get_setting_connection(connection))
+ && _nm_connection_detect_slave_type_full(s_con,
+ connection,
+ &slave_type,
+ NULL,
+ NULL,
+ NULL,
+ NULL)
+ && nm_streq0(slave_type, NM_SETTING_OVS_PORT_SETTING_NAME))
+ goto connection_type_is_good;
+
+ g_set_error_literal(error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("OVS external IDs can only be added to a profile of type OVS "
+ "bridge/port/interface or to OVS system interface"));
+ return FALSE;
}
+connection_type_is_good:
return TRUE;
}
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index ec01d3af6b..38be8c8002 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -12442,8 +12442,11 @@ can_reapply_change(NMDevice * self,
}
if (nm_streq(setting_name, NM_SETTING_OVS_EXTERNAL_IDS_SETTING_NAME)
- && NM_DEVICE_GET_CLASS(self)->can_reapply_change_ovs_external_ids)
+ && NM_DEVICE_GET_CLASS(self)->can_reapply_change_ovs_external_ids) {
+ /* TODO: this means, you cannot reapply changes to the external-ids for
+ * OVS system interfaces. */
return TRUE;
+ }
out_fail:
g_set_error(error,