summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Giudici <fgiudici@redhat.com>2017-10-30 12:27:58 +0100
committerFrancesco Giudici <fgiudici@redhat.com>2017-11-09 17:56:15 +0100
commit1c99d379eb7ef1947beb4176a9611e404d1b220f (patch)
tree028a801abad4bcbbc9eaa984199a37c065a5006e
parente1220c933f84a457c16f4b21ccdacd335d2755c4 (diff)
downloadNetworkManager-1c99d379eb7ef1947beb4176a9611e404d1b220f.tar.gz
libnm-core: add explicit team properties to NMSettingTeamPort
-rw-r--r--clients/common/settings-docs.c.in5
-rw-r--r--libnm-core/nm-setting-team-port.c198
-rw-r--r--libnm-core/nm-setting-team-port.h15
-rw-r--r--libnm/libnm.ver5
4 files changed, 223 insertions, 0 deletions
diff --git a/clients/common/settings-docs.c.in b/clients/common/settings-docs.c.in
index c83ed9c8d5..3d6f012bf7 100644
--- a/clients/common/settings-docs.c.in
+++ b/clients/common/settings-docs.c.in
@@ -332,7 +332,12 @@
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL N_("Corresponds to the teamd runner.tx_balancer.interval.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_TX_HASH N_("Corresponds to the teamd runner.tx_hash.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_CONFIG N_("The JSON configuration for the team port. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.")
+#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_LACP_KEY N_("Corresponds to the teamd ports.PORTIFNAME.lacp_key.")
+#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_LACP_PRIO N_("Corresponds to the teamd ports.PORTIFNAME.lacp_prio.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
+#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_PRIO N_("Corresponds to the teamd ports.PORTIFNAME.prio.")
+#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_QUEUE_ID N_("Corresponds to the teamd ports.PORTIFNAME.queue_id. When set to -1 means the parameter is skipped from the json config.")
+#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_STICKY N_("Corresponds to the teamd ports.PORTIFNAME.sticky.")
#define DESCRIBE_DOC_NM_SETTING_TUN_GROUP N_("The group ID which will own the device. If set to NULL everyone will be able to use the device.")
#define DESCRIBE_DOC_NM_SETTING_TUN_MODE N_("The operating mode of the virtual device. Allowed values are NM_SETTING_TUN_MODE_TUN (1) to create a layer 3 device and NM_SETTING_TUN_MODE_TAP (2) to create an Ethernet-like layer 2 one.")
#define DESCRIBE_DOC_NM_SETTING_TUN_MULTI_QUEUE N_("If the property is set to TRUE, the interface will support multiple file descriptors (queues) to parallelize packet sending or receiving. Otherwise, the interface will only support a single queue.")
diff --git a/libnm-core/nm-setting-team-port.c b/libnm-core/nm-setting-team-port.c
index c030966579..6c3967e563 100644
--- a/libnm-core/nm-setting-team-port.c
+++ b/libnm-core/nm-setting-team-port.c
@@ -47,11 +47,21 @@ NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_TEAM_PORT)
typedef struct {
char *config;
+ int queue_id;
+ int prio;
+ gboolean sticky;
+ int lacp_prio;
+ int lacp_key;
} NMSettingTeamPortPrivate;
enum {
PROP_0,
PROP_CONFIG,
+ PROP_QUEUE_ID,
+ PROP_PRIO,
+ PROP_STICKY,
+ PROP_LACP_PRIO,
+ PROP_LACP_KEY,
LAST_PROP
};
@@ -82,6 +92,86 @@ nm_setting_team_port_get_config (NMSettingTeamPort *setting)
return NM_SETTING_TEAM_PORT_GET_PRIVATE (setting)->config;
}
+/**
+ * nm_setting_team_port_get_queue_id:
+ * @setting: the #NMSettingTeamPort
+ *
+ * Returns: the #NMSettingTeamPort:queue_id property of the setting
+ *
+ * Since 1.12
+ **/
+gint
+nm_setting_team_port_get_queue_id (NMSettingTeamPort *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_TEAM_PORT (setting), -1);
+
+ return NM_SETTING_TEAM_PORT_GET_PRIVATE (setting)->queue_id;
+}
+
+/**
+ * nm_setting_team_port_get_prio:
+ * @setting: the #NMSettingTeamPort
+ *
+ * Returns: the #NMSettingTeamPort:prio property of the setting
+ *
+ * Since 1.12
+ **/
+gint
+nm_setting_team_port_get_prio (NMSettingTeamPort *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_TEAM_PORT (setting), 0);
+
+ return NM_SETTING_TEAM_PORT_GET_PRIVATE (setting)->prio;
+}
+
+/**
+ * nm_setting_team_port_get_sticky:
+ * @setting: the #NMSettingTeamPort
+ *
+ * Returns: the #NMSettingTeamPort:sticky property of the setting
+ *
+ * Since 1.12
+ **/
+gboolean
+nm_setting_team_port_get_sticky (NMSettingTeamPort *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_TEAM_PORT (setting), FALSE);
+
+ return NM_SETTING_TEAM_PORT_GET_PRIVATE (setting)->sticky;
+}
+
+/**
+ * nm_setting_team_port_get_lacp_prio:
+ * @setting: the #NMSettingTeamPort
+ *
+ * Returns: the #NMSettingTeamPort:lacp-prio property of the setting
+ *
+ * Since 1.12
+ **/
+gint
+nm_setting_team_port_get_lacp_prio (NMSettingTeamPort *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_TEAM_PORT (setting), 0);
+
+ return NM_SETTING_TEAM_PORT_GET_PRIVATE (setting)->lacp_prio;
+}
+
+/**
+ * nm_setting_team_port_get_lacp_key:
+ * @setting: the #NMSettingTeamPort
+ *
+ * Returns: the #NMSettingTeamPort:lacp-key property of the setting
+ *
+ * Since 1.12
+ **/
+gint
+nm_setting_team_port_get_lacp_key (NMSettingTeamPort *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_TEAM_PORT (setting), 0);
+
+ return NM_SETTING_TEAM_PORT_GET_PRIVATE (setting)->lacp_key;
+}
+
static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
@@ -171,6 +261,10 @@ compare_property (NMSetting *setting,
static void
nm_setting_team_port_init (NMSettingTeamPort *setting)
{
+ NMSettingTeamPortPrivate *priv = NM_SETTING_TEAM_PORT_GET_PRIVATE (setting);
+
+ priv->queue_id = -1;
+ priv->lacp_prio = 255;
}
static void
@@ -184,6 +278,21 @@ set_property (GObject *object, guint prop_id,
g_free (priv->config);
priv->config = g_value_dup_string (value);
break;
+ case PROP_QUEUE_ID:
+ priv->queue_id = g_value_get_int (value);
+ break;
+ case PROP_PRIO:
+ priv->prio = g_value_get_int (value);
+ break;
+ case PROP_STICKY:
+ priv->sticky = g_value_get_boolean (value);
+ break;
+ case PROP_LACP_PRIO:
+ priv->lacp_prio = g_value_get_int (value);
+ break;
+ case PROP_LACP_KEY:
+ priv->lacp_key = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -195,11 +304,27 @@ get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
NMSettingTeamPort *setting = NM_SETTING_TEAM_PORT (object);
+ NMSettingTeamPortPrivate *priv = NM_SETTING_TEAM_PORT_GET_PRIVATE (setting);
switch (prop_id) {
case PROP_CONFIG:
g_value_set_string (value, nm_setting_team_port_get_config (setting));
break;
+ case PROP_QUEUE_ID:
+ g_value_set_int (value, priv->queue_id);
+ break;
+ case PROP_PRIO:
+ g_value_set_int (value, priv->prio);
+ break;
+ case PROP_STICKY:
+ g_value_set_boolean (value, priv->sticky);
+ break;
+ case PROP_LACP_PRIO:
+ g_value_set_int (value, priv->lacp_prio);
+ break;
+ case PROP_LACP_KEY:
+ g_value_set_int (value, priv->lacp_key);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -253,4 +378,77 @@ nm_setting_team_port_class_init (NMSettingTeamPortClass *setting_class)
G_PARAM_READWRITE |
NM_SETTING_PARAM_INFERRABLE |
G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingTeamPort:queue-id:
+ *
+ * Corresponds to the teamd ports.PORTIFNAME.queue_id.
+ * When set to -1 means the parameter is skipped from the json config.
+ *
+ * Since: 1.12
+ **/
+ g_object_class_install_property
+ (object_class, PROP_QUEUE_ID,
+ g_param_spec_int (NM_SETTING_TEAM_PORT_QUEUE_ID, "", "",
+ G_MININT32, G_MAXINT32, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingTeamPort:prio:
+ *
+ * Corresponds to the teamd ports.PORTIFNAME.prio.
+ *
+ * Since: 1.12
+ **/
+ g_object_class_install_property
+ (object_class, PROP_PRIO,
+ g_param_spec_int (NM_SETTING_TEAM_PORT_PRIO, "", "",
+ G_MININT32, G_MAXINT32, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingTeamPort:sticky:
+ *
+ * Corresponds to the teamd ports.PORTIFNAME.sticky.
+ *
+ * Since: 1.12
+ **/
+ g_object_class_install_property
+ (object_class, PROP_STICKY,
+ g_param_spec_boolean (NM_SETTING_TEAM_PORT_STICKY, "", "",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingTeamPort:lacp-prio:
+ *
+ * Corresponds to the teamd ports.PORTIFNAME.lacp_prio.
+ *
+ * Since: 1.12
+ **/
+ g_object_class_install_property
+ (object_class, PROP_LACP_PRIO,
+ g_param_spec_int (NM_SETTING_TEAM_PORT_LACP_PRIO, "", "",
+ G_MININT32, G_MAXINT32, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingTeamPort:lacp-key:
+ *
+ * Corresponds to the teamd ports.PORTIFNAME.lacp_key.
+ *
+ * Since: 1.12
+ **/
+ g_object_class_install_property
+ (object_class, PROP_LACP_KEY,
+ g_param_spec_int (NM_SETTING_TEAM_PORT_LACP_KEY, "", "",
+ G_MININT32, G_MAXINT32, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+
}
diff --git a/libnm-core/nm-setting-team-port.h b/libnm-core/nm-setting-team-port.h
index 4fcc51083a..fbb772d1a1 100644
--- a/libnm-core/nm-setting-team-port.h
+++ b/libnm-core/nm-setting-team-port.h
@@ -39,6 +39,11 @@ G_BEGIN_DECLS
#define NM_SETTING_TEAM_PORT_SETTING_NAME "team-port"
#define NM_SETTING_TEAM_PORT_CONFIG "config"
+#define NM_SETTING_TEAM_PORT_QUEUE_ID "queue-id"
+#define NM_SETTING_TEAM_PORT_PRIO "prio"
+#define NM_SETTING_TEAM_PORT_STICKY "sticky"
+#define NM_SETTING_TEAM_PORT_LACP_PRIO "lacp-prio"
+#define NM_SETTING_TEAM_PORT_LACP_KEY "lacp-key"
/**
* NMSettingTeamPort:
@@ -61,6 +66,16 @@ GType nm_setting_team_port_get_type (void);
NMSetting * nm_setting_team_port_new (void);
const char * nm_setting_team_port_get_config (NMSettingTeamPort *setting);
+NM_AVAILABLE_IN_1_12
+gint nm_setting_team_port_get_queue_id (NMSettingTeamPort *setting);
+NM_AVAILABLE_IN_1_12
+gint nm_setting_team_port_get_prio (NMSettingTeamPort *setting);
+NM_AVAILABLE_IN_1_12
+gboolean nm_setting_team_port_get_sticky (NMSettingTeamPort *setting);
+NM_AVAILABLE_IN_1_12
+gint nm_setting_team_port_get_lacp_prio (NMSettingTeamPort *setting);
+NM_AVAILABLE_IN_1_12
+gint nm_setting_team_port_get_lacp_key (NMSettingTeamPort *setting);
G_END_DECLS
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 3724c655ae..5e9feaffc8 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1251,6 +1251,11 @@ global:
nm_setting_team_get_runner_sys_prio;
nm_setting_team_get_runner_min_ports;
nm_setting_team_get_runner_agg_select_policy;
+ nm_setting_team_port_get_queue_id;
+ nm_setting_team_port_get_prio;
+ nm_setting_team_port_get_sticky;
+ nm_setting_team_port_get_lacp_prio;
+ nm_setting_team_port_get_lacp_key;
nm_setting_team_remove_runner_tx_hash;
nm_setting_team_remove_runner_tx_hash_by_value;
} libnm_1_10_0;