libnm-core: team: add support to runner "random"

https://bugzilla.redhat.com/show_bug.cgi?id=1538699
This commit is contained in:
Francesco Giudici 2018-02-05 15:24:36 +01:00
parent 782578122c
commit 31d9a9de14
4 changed files with 17 additions and 0 deletions

View file

@ -6596,6 +6596,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),

View file

@ -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)) {

View file

@ -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"

View file

@ -968,6 +968,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)
{
@ -1605,6 +1617,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",