Blame SOURCES/0022-team-add-random-runner-rh1538699.patch

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