merge: branch 'lr/ovs-bridge-datapath-type'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/212
This commit is contained in:
@@ -6123,6 +6123,12 @@ static const NMMetaPropertyInfo *const property_infos_OVS_BRIDGE[] = {
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_STP_ENABLE,
|
||||
.property_type = &_pt_gobject_bool,
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_DATAPATH_TYPE,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = NM_MAKE_STRV ("system", "netdev"),
|
||||
),
|
||||
),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@@ -256,6 +256,7 @@
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PROMISCUOUS N_("Whether the interface should be put in promiscuous mode.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_TAP N_("Whether the interface should be a MACVTAP.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MATCH_INTERFACE_NAME N_("A list of interface names to match. Each element is a shell wildcard pattern. When an element is prefixed with exclamation mark (!) the condition is inverted. A candidate interface name is considered matching when both these conditions are satisfied: (a) any of the elements not prefixed with '!' matches or there aren't such elements; (b) none of the elements prefixed with '!' match.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_DATAPATH_TYPE N_("The data path type. One of \"system\", \"netdev\" or empty.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_FAIL_MODE N_("The bridge failure mode. One of \"secure\", \"standalone\" or empty.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE N_("Enable or disable multicast snooping.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_RSTP_ENABLE N_("Enable or disable RSTP.")
|
||||
|
@@ -40,6 +40,7 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE (
|
||||
PROP_MCAST_SNOOPING_ENABLE,
|
||||
PROP_RSTP_ENABLE,
|
||||
PROP_STP_ENABLE,
|
||||
PROP_DATAPATH_TYPE,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -51,6 +52,7 @@ struct _NMSettingOvsBridge {
|
||||
NMSetting parent;
|
||||
|
||||
char *fail_mode;
|
||||
char *datapath_type;
|
||||
gboolean mcast_snooping_enable;
|
||||
gboolean rstp_enable;
|
||||
gboolean stp_enable;
|
||||
@@ -128,6 +130,22 @@ nm_setting_ovs_bridge_get_stp_enable (NMSettingOvsBridge *self)
|
||||
return self->stp_enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ovs_bridge_get_datapath_type:
|
||||
* @self: the #NMSettingOvsBridge
|
||||
*
|
||||
* Returns: the #NMSettingOvsBridge:datapath_type property of the setting
|
||||
*
|
||||
* Since: 1.20
|
||||
**/
|
||||
const char *
|
||||
nm_setting_ovs_bridge_get_datapath_type (NMSettingOvsBridge *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_OVS_BRIDGE (self), NULL);
|
||||
|
||||
return self->datapath_type;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int
|
||||
@@ -172,6 +190,16 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!NM_IN_STRSET (self->datapath_type, "system", "netdev", NULL)) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("'%s' is not valid"),
|
||||
self->datapath_type);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_BRIDGE_SETTING_NAME, NM_SETTING_OVS_BRIDGE_DATAPATH_TYPE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -196,6 +224,9 @@ get_property (GObject *object, guint prop_id,
|
||||
case PROP_STP_ENABLE:
|
||||
g_value_set_boolean (value, self->stp_enable);
|
||||
break;
|
||||
case PROP_DATAPATH_TYPE:
|
||||
g_value_set_string (value, self->datapath_type);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -222,6 +253,10 @@ set_property (GObject *object, guint prop_id,
|
||||
case PROP_STP_ENABLE:
|
||||
self->stp_enable = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_DATAPATH_TYPE:
|
||||
g_free (self->datapath_type);
|
||||
self->datapath_type = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -256,6 +291,7 @@ finalize (GObject *object)
|
||||
NMSettingOvsBridge *self = NM_SETTING_OVS_BRIDGE (object);
|
||||
|
||||
g_free (self->fail_mode);
|
||||
g_free (self->datapath_type);
|
||||
|
||||
G_OBJECT_CLASS (nm_setting_ovs_bridge_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -329,6 +365,20 @@ nm_setting_ovs_bridge_class_init (NMSettingOvsBridgeClass *klass)
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMSettingOvsBridge:datapath-type:
|
||||
*
|
||||
* The data path type. One of "system", "netdev" or empty.
|
||||
*
|
||||
* Since: 1.20
|
||||
**/
|
||||
obj_properties[PROP_DATAPATH_TYPE] =
|
||||
g_param_spec_string (NM_SETTING_OVS_BRIDGE_DATAPATH_TYPE, "", "",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
NM_SETTING_PARAM_INFERRABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
_nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_OVS_BRIDGE);
|
||||
|
@@ -41,6 +41,7 @@ G_BEGIN_DECLS
|
||||
#define NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE "mcast-snooping-enable"
|
||||
#define NM_SETTING_OVS_BRIDGE_RSTP_ENABLE "rstp-enable"
|
||||
#define NM_SETTING_OVS_BRIDGE_STP_ENABLE "stp-enable"
|
||||
#define NM_SETTING_OVS_BRIDGE_DATAPATH_TYPE "datapath-type"
|
||||
|
||||
typedef struct _NMSettingOvsBridgeClass NMSettingOvsBridgeClass;
|
||||
|
||||
@@ -57,6 +58,8 @@ NM_AVAILABLE_IN_1_10
|
||||
gboolean nm_setting_ovs_bridge_get_rstp_enable (NMSettingOvsBridge *self);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
gboolean nm_setting_ovs_bridge_get_stp_enable (NMSettingOvsBridge *self);
|
||||
NM_AVAILABLE_IN_1_20
|
||||
const char *nm_setting_ovs_bridge_get_datapath_type (NMSettingOvsBridge *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -445,6 +445,7 @@ _insert_bridge (json_t *params, NMConnection *bridge, json_t *new_ports)
|
||||
gboolean mcast_snooping_enable = FALSE;
|
||||
gboolean rstp_enable = FALSE;
|
||||
gboolean stp_enable = FALSE;
|
||||
const char *datapath_type = NULL;
|
||||
json_t *row;
|
||||
|
||||
s_ovs_bridge = nm_connection_get_setting_ovs_bridge (bridge);
|
||||
@@ -456,6 +457,7 @@ _insert_bridge (json_t *params, NMConnection *bridge, json_t *new_ports)
|
||||
mcast_snooping_enable = nm_setting_ovs_bridge_get_mcast_snooping_enable (s_ovs_bridge);
|
||||
rstp_enable = nm_setting_ovs_bridge_get_rstp_enable (s_ovs_bridge);
|
||||
stp_enable = nm_setting_ovs_bridge_get_stp_enable (s_ovs_bridge);
|
||||
datapath_type = nm_setting_ovs_bridge_get_datapath_type (s_ovs_bridge);
|
||||
}
|
||||
|
||||
if (fail_mode)
|
||||
@@ -466,6 +468,8 @@ _insert_bridge (json_t *params, NMConnection *bridge, json_t *new_ports)
|
||||
json_object_set_new (row, "rstp_enable", json_boolean (rstp_enable));
|
||||
if (stp_enable)
|
||||
json_object_set_new (row, "stp_enable", json_boolean (stp_enable));
|
||||
if (datapath_type)
|
||||
json_object_set_new (row, "datapath_type", json_string (datapath_type));
|
||||
|
||||
json_object_set_new (row, "name", json_string (nm_connection_get_interface_name (bridge)));
|
||||
json_object_set_new (row, "ports", json_pack ("[s, O]", "set", new_ports));
|
||||
|
Reference in New Issue
Block a user