From 10760b100c71d637cad76eef4bed59c1d63679c2 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Mon, 5 Feb 2018 15:24:36 +0100 Subject: [PATCH] libnm-core: team: add support to runner "random" https://bugzilla.redhat.com/show_bug.cgi?id=1538699 (cherry picked from commit 31d9a9de14dc7e529763e3210337bb6dd628a8a3) --- clients/common/nm-meta-setting-desc.c | 1 + libnm-core/nm-setting-team.c | 1 + libnm-core/nm-setting-team.h | 1 + libnm-core/tests/test-setting.c | 14 ++++++++++++++ 4 files changed, 17 insertions(+) diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 46b06fd40..d829fa7d4 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -6594,6 +6594,7 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = { .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( .values_static = VALUES_STATIC (NM_SETTING_TEAM_RUNNER_BROADCAST, NM_SETTING_TEAM_RUNNER_ROUNDROBIN, + NM_SETTING_TEAM_RUNNER_RANDOM, NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP, NM_SETTING_TEAM_RUNNER_LOADBALANCE, NM_SETTING_TEAM_RUNNER_LACP), diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c index 60bdf5f6b..1db2428d9 100644 --- a/libnm-core/nm-setting-team.c +++ b/libnm-core/nm-setting-team.c @@ -1171,6 +1171,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) if ( priv->runner && g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_BROADCAST) && g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_ROUNDROBIN) + && g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_RANDOM) && g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP) && g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_LOADBALANCE) && g_ascii_strcasecmp (priv->runner, NM_SETTING_TEAM_RUNNER_LACP)) { diff --git a/libnm-core/nm-setting-team.h b/libnm-core/nm-setting-team.h index d423901f6..8e5178a45 100644 --- a/libnm-core/nm-setting-team.h +++ b/libnm-core/nm-setting-team.h @@ -131,6 +131,7 @@ NMTeamLinkWatcherArpPingFlags nm_team_link_watcher_get_flags (NMTeamLinkWatcher #define NM_SETTING_TEAM_RUNNER_BROADCAST "broadcast" #define NM_SETTING_TEAM_RUNNER_ROUNDROBIN "roundrobin" +#define NM_SETTING_TEAM_RUNNER_RANDOM "random" #define NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP "activebackup" #define NM_SETTING_TEAM_RUNNER_LOADBALANCE "loadbalance" #define NM_SETTING_TEAM_RUNNER_LACP "lacp" diff --git a/libnm-core/tests/test-setting.c b/libnm-core/tests/test-setting.c index efdcee258..a7282f91b 100644 --- a/libnm-core/tests/test-setting.c +++ b/libnm-core/tests/test-setting.c @@ -967,6 +967,18 @@ test_runner_broadcast_sync_from_config (void) NULL); } +static void +test_runner_random_sync_from_config (void) +{ + _test_team_config_sync ("{\"runner\": {\"name\": \"random\"}}", + 0, 0, 0, 0, + NM_SETTING_TEAM_RUNNER_RANDOM, + NULL, + NULL, NULL, -1, + FALSE, FALSE, -1, -1, NULL, + NULL); +} + static void test_runner_activebackup_sync_from_config (void) { @@ -1603,6 +1615,8 @@ main (int argc, char **argv) test_runner_roundrobin_sync_from_config); g_test_add_func ("/libnm/settings/team/sync_runner_from_config_broadcast", test_runner_broadcast_sync_from_config); + g_test_add_func ("/libnm/settings/team/sync_runner_from_config_random", + test_runner_random_sync_from_config); g_test_add_func ("/libnm/settings/team/sync_runner_from_config_activebackup", test_runner_activebackup_sync_from_config); g_test_add_func ("/libnm/settings/team/sync_runner_from_config_loadbalance", -- 2.14.3