mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 06:10:14 +01:00
ovs: add ofport_request option to ovs interface
Add option to set ofport_request when configuring ovs interface. When connection with ofport_request configured is activated ovsdb will first try to activated on the port set by ofport_request.
This commit is contained in:
parent
39e8707f0d
commit
5fde7814dc
7 changed files with 65 additions and 5 deletions
|
|
@ -767,11 +767,14 @@ _insert_interface(json_t *params,
|
|||
NMSettingOvsPatch *s_ovs_patch;
|
||||
json_t *options = json_array();
|
||||
json_t *row;
|
||||
guint32 mtu = 0;
|
||||
guint32 mtu = 0;
|
||||
guint32 ofport_request = 0;
|
||||
|
||||
s_ovs_iface = nm_connection_get_setting_ovs_interface(interface);
|
||||
if (s_ovs_iface)
|
||||
type = nm_setting_ovs_interface_get_interface_type(s_ovs_iface);
|
||||
if (s_ovs_iface) {
|
||||
type = nm_setting_ovs_interface_get_interface_type(s_ovs_iface);
|
||||
ofport_request = nm_setting_ovs_interface_get_ofport_request(s_ovs_iface);
|
||||
}
|
||||
|
||||
if (nm_streq0(type, "internal")) {
|
||||
NMSettingWired *s_wired;
|
||||
|
|
@ -828,6 +831,9 @@ _insert_interface(json_t *params,
|
|||
if (mtu != 0)
|
||||
json_object_set_new(row, "mtu_request", json_integer(mtu));
|
||||
|
||||
if (ofport_request != 0)
|
||||
json_object_set_new(row, "ofport_request", json_integer(ofport_request));
|
||||
|
||||
json_array_append_new(params,
|
||||
json_pack("{s:s, s:s, s:o, s:s}",
|
||||
"op",
|
||||
|
|
|
|||
|
|
@ -1844,3 +1844,8 @@ global:
|
|||
nm_setting_ip4_link_local_get_type;
|
||||
nm_setting_ip6_config_get_mtu;
|
||||
} libnm_1_38_0;
|
||||
|
||||
libnm_1_42_0 {
|
||||
global:
|
||||
nm_setting_ovs_interface_get_ofport_request;
|
||||
} libnm_1_40_0;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_TYPE, );
|
||||
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_TYPE, PROP_OFPORT_REQUEST, );
|
||||
|
||||
/**
|
||||
* NMSettingOvsInterface:
|
||||
|
|
@ -31,7 +31,8 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_TYPE, );
|
|||
struct _NMSettingOvsInterface {
|
||||
NMSetting parent;
|
||||
|
||||
char *type;
|
||||
char *type;
|
||||
guint32 ofport_request;
|
||||
};
|
||||
|
||||
struct _NMSettingOvsInterfaceClass {
|
||||
|
|
@ -58,6 +59,22 @@ nm_setting_ovs_interface_get_interface_type(NMSettingOvsInterface *self)
|
|||
return self->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ovs_interface_get_ofport_request:
|
||||
* @self: the #NMSettingOvsInterface
|
||||
*
|
||||
* Returns: id of the preassigned ovs port
|
||||
*
|
||||
* Since: 1.42
|
||||
**/
|
||||
guint32
|
||||
nm_setting_ovs_interface_get_ofport_request(NMSettingOvsInterface *self)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_OVS_INTERFACE(self), 0);
|
||||
|
||||
return self->ofport_request;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
|
|
@ -378,6 +395,27 @@ nm_setting_ovs_interface_class_init(NMSettingOvsInterfaceClass *klass)
|
|||
NM_SETTING_PARAM_INFERRABLE,
|
||||
NMSettingOvsInterface,
|
||||
type);
|
||||
/**
|
||||
* NMSettingOvsInterface:ofport-request:
|
||||
*
|
||||
* Open vSwitch openflow port number.
|
||||
* Defaults to zero which means that port number will not be specified
|
||||
* and it will be chosen randomly by ovs. OpenFlow ports are the network interfaces
|
||||
* for passing packets between OpenFlow processing and the rest of the network.
|
||||
* OpenFlow switches connect logically to each other via their OpenFlow ports.
|
||||
*
|
||||
* Since: 1.42
|
||||
**/
|
||||
_nm_setting_property_define_direct_uint32(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_OVS_INTERFACE_OFPORT_REQUEST,
|
||||
PROP_OFPORT_REQUEST,
|
||||
0,
|
||||
65279,
|
||||
0,
|
||||
NM_SETTING_PARAM_INFERRABLE,
|
||||
NMSettingOvsInterface,
|
||||
ofport_request);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_OVS_INTERFACE_TYPE "type"
|
||||
|
||||
#define NM_SETTING_OVS_INTERFACE_OFPORT_REQUEST "ofport-request"
|
||||
|
||||
typedef struct _NMSettingOvsInterfaceClass NMSettingOvsInterfaceClass;
|
||||
|
||||
NM_AVAILABLE_IN_1_10
|
||||
|
|
@ -42,6 +44,9 @@ NMSetting *nm_setting_ovs_interface_new(void);
|
|||
NM_AVAILABLE_IN_1_10
|
||||
const char *nm_setting_ovs_interface_get_interface_type(NMSettingOvsInterface *self);
|
||||
|
||||
NM_AVAILABLE_IN_1_42
|
||||
guint32 nm_setting_ovs_interface_get_ofport_request(NMSettingOvsInterface *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __NM_SETTING_OVS_INTERFACE_H__ */
|
||||
|
|
|
|||
|
|
@ -6820,6 +6820,9 @@ static const NMMetaPropertyInfo *const property_infos_OVS_INTERFACE[] = {
|
|||
.values_static = NM_MAKE_STRV ("internal", "system", "patch", "dpdk"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_INTERFACE_OFPORT_REQUEST,
|
||||
.property_type = &_pt_gobject_int,
|
||||
),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -252,6 +252,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_DPDK_N_RXQ N_("Open vSwitch DPDK number of rx queues. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures one queue.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_OFPORT_REQUEST N_("Open vSwitch openflow port number. Defaults to zero which means that port number will not be specified and it will be chosen randomly by ovs. OpenFlow ports are the network interfaces for passing packets between OpenFlow processing and the rest of the network. OpenFlow switches connect logically to each other via their OpenFlow ports.")
|
||||
#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 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.")
|
||||
|
|
|
|||
|
|
@ -834,6 +834,8 @@
|
|||
<setting name="ovs-interface" >
|
||||
<property name="type"
|
||||
description="The interface type. Either "internal", "system", "patch", "dpdk", or empty." />
|
||||
<property name="ofport-request"
|
||||
description="Open vSwitch openflow port number. Defaults to zero which means that port number will not be specified and it will be chosen randomly by ovs. OpenFlow ports are the network interfaces for passing packets between OpenFlow processing and the rest of the network. OpenFlow switches connect logically to each other via their OpenFlow ports." />
|
||||
</setting>
|
||||
<setting name="ovs-patch" >
|
||||
<property name="peer"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue