|
|
a85faa |
From 969a08cff1196185cc630a1898793b80b3d94da6 Mon Sep 17 00:00:00 2001
|
|
|
a85faa |
From: Thomas Haller <thaller@redhat.com>
|
|
|
a85faa |
Date: Tue, 23 Aug 2016 16:19:42 +0200
|
|
|
a85faa |
Subject: [PATCH 1/2] ifcfg-rh: make out_unhandled argument non-optional
|
|
|
a85faa |
|
|
|
a85faa |
Depending on the connection we are about to read,
|
|
|
a85faa |
we would assert that the user provided a @out_unhandled
|
|
|
a85faa |
argument.
|
|
|
a85faa |
|
|
|
a85faa |
That means, the user must always provide a valid @out_unhandled
|
|
|
a85faa |
pointer, because he cannot know beforehand how the reading
|
|
|
a85faa |
of the ifcfg file goes.
|
|
|
a85faa |
|
|
|
a85faa |
(cherry picked from commit 50d7ac4af3f6908a09a857d4127e196b2df37c27)
|
|
|
a85faa |
(cherry picked from commit 6de181247f2f999b8ebec75e21bdd07f1c1f18bb)
|
|
|
a85faa |
---
|
|
|
a85faa |
src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c | 4 +++-
|
|
|
a85faa |
src/settings/plugins/ifcfg-rh/reader.c | 9 ++-------
|
|
|
a85faa |
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 10 ++++++----
|
|
|
a85faa |
3 files changed, 11 insertions(+), 12 deletions(-)
|
|
|
a85faa |
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
|
|
|
a85faa |
index 82f2059..184e95b 100644
|
|
|
a85faa |
--- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
|
|
|
a85faa |
@@ -395,7 +395,9 @@ commit_changes (NMSettingsConnection *connection,
|
|
|
a85faa |
*/
|
|
|
a85faa |
filename = nm_settings_connection_get_filename (connection);
|
|
|
a85faa |
if (filename) {
|
|
|
a85faa |
- reread = connection_from_file (filename, NULL, NULL, NULL);
|
|
|
a85faa |
+ gs_free char *unhandled = NULL;
|
|
|
a85faa |
+
|
|
|
a85faa |
+ reread = connection_from_file (filename, &unhandled, NULL, NULL);
|
|
|
a85faa |
if (reread) {
|
|
|
a85faa |
same = nm_connection_compare (NM_CONNECTION (connection),
|
|
|
a85faa |
reread,
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
|
|
|
a85faa |
index af5d291..e3d8ee1 100644
|
|
|
a85faa |
--- a/src/settings/plugins/ifcfg-rh/reader.c
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/reader.c
|
|
|
a85faa |
@@ -4848,7 +4848,7 @@ create_unhandled_connection (const char *filename, shvarFile *ifcfg,
|
|
|
a85faa |
NMSetting *s_con;
|
|
|
a85faa |
char *value;
|
|
|
a85faa |
|
|
|
a85faa |
- g_assert (out_spec != NULL);
|
|
|
a85faa |
+ nm_assert (out_spec && !*out_spec);
|
|
|
a85faa |
|
|
|
a85faa |
connection = nm_simple_connection_new ();
|
|
|
a85faa |
|
|
|
a85faa |
@@ -4963,8 +4963,7 @@ connection_from_file_full (const char *filename,
|
|
|
a85faa |
const char *ifcfg_name = NULL;
|
|
|
a85faa |
|
|
|
a85faa |
g_return_val_if_fail (filename != NULL, NULL);
|
|
|
a85faa |
- if (out_unhandled)
|
|
|
a85faa |
- g_return_val_if_fail (*out_unhandled == NULL, NULL);
|
|
|
a85faa |
+ g_return_val_if_fail (out_unhandled && !*out_unhandled, NULL);
|
|
|
a85faa |
|
|
|
a85faa |
/* Non-NULL only for unit tests; normally use /etc/sysconfig/network */
|
|
|
a85faa |
if (!network_file)
|
|
|
a85faa |
@@ -4982,8 +4981,6 @@ connection_from_file_full (const char *filename,
|
|
|
a85faa |
return NULL;
|
|
|
a85faa |
|
|
|
a85faa |
if (!svGetValueBoolean (parsed, "NM_CONTROLLED", TRUE)) {
|
|
|
a85faa |
- g_assert (out_unhandled != NULL);
|
|
|
a85faa |
-
|
|
|
a85faa |
connection = create_unhandled_connection (filename, parsed, "unmanaged", out_unhandled);
|
|
|
a85faa |
if (!connection)
|
|
|
a85faa |
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
|
|
|
a85faa |
@@ -5136,8 +5133,6 @@ connection_from_file_full (const char *filename,
|
|
|
a85faa |
else if (!strcasecmp (type, TYPE_BRIDGE))
|
|
|
a85faa |
connection = bridge_connection_from_ifcfg (filename, parsed, error);
|
|
|
a85faa |
else {
|
|
|
a85faa |
- g_assert (out_unhandled != NULL);
|
|
|
a85faa |
-
|
|
|
a85faa |
connection = create_unhandled_connection (filename, parsed, "unrecognized", out_unhandled);
|
|
|
a85faa |
if (!connection)
|
|
|
a85faa |
PARSE_WARNING ("connection type was unrecognized but device was not uniquely identified; device may be managed");
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
|
|
|
a85faa |
index b73f2f5..3a67a83 100644
|
|
|
a85faa |
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
|
|
|
a85faa |
@@ -67,11 +67,14 @@ _connection_from_file (const char *filename,
|
|
|
a85faa |
{
|
|
|
a85faa |
NMConnection *connection;
|
|
|
a85faa |
GError *error = NULL;
|
|
|
a85faa |
+ char *unhandled_fallback = NULL;
|
|
|
a85faa |
|
|
|
a85faa |
g_assert (!out_unhandled || !*out_unhandled);
|
|
|
a85faa |
|
|
|
a85faa |
- connection = connection_from_file_test (filename, network_file, test_type, out_unhandled, &error);
|
|
|
a85faa |
+ connection = connection_from_file_test (filename, network_file, test_type,
|
|
|
a85faa |
+ out_unhandled ?: &unhandled_fallback, &error);
|
|
|
a85faa |
g_assert_no_error (error);
|
|
|
a85faa |
+ g_assert (!unhandled_fallback);
|
|
|
a85faa |
|
|
|
a85faa |
if (out_unhandled && *out_unhandled)
|
|
|
a85faa |
nmtst_assert_connection_verifies (connection);
|
|
|
a85faa |
@@ -89,13 +92,12 @@ _connection_from_file_fail (const char *filename,
|
|
|
a85faa |
NMConnection *connection;
|
|
|
a85faa |
GError *local = NULL;
|
|
|
a85faa |
char *unhandled = NULL;
|
|
|
a85faa |
- char **p_unhandled = (nmtst_get_rand_int () % 2) ? &unhandled : NULL;
|
|
|
a85faa |
|
|
|
a85faa |
- connection = connection_from_file_test (filename, network_file, test_type, p_unhandled, &local);
|
|
|
a85faa |
+ connection = connection_from_file_test (filename, network_file, test_type, &unhandled, &local);
|
|
|
a85faa |
|
|
|
a85faa |
g_assert (!connection);
|
|
|
a85faa |
g_assert (local);
|
|
|
a85faa |
- g_assert (!p_unhandled || !*p_unhandled);
|
|
|
a85faa |
+ g_assert (!unhandled);
|
|
|
a85faa |
g_propagate_error (error, local);
|
|
|
a85faa |
}
|
|
|
a85faa |
|
|
|
a85faa |
--
|
|
|
a85faa |
2.7.4
|
|
|
a85faa |
|
|
|
a85faa |
|
|
|
a85faa |
From eb446ad72bfdac1f5f93dcc2714cb222b0a18dc5 Mon Sep 17 00:00:00 2001
|
|
|
a85faa |
From: Thomas Haller <thaller@redhat.com>
|
|
|
a85faa |
Date: Tue, 23 Aug 2016 14:36:09 +0200
|
|
|
a85faa |
Subject: [PATCH 2/2] ifcfg-rh: accept TEAM connections also without DEVICETYPE
|
|
|
a85faa |
setting
|
|
|
a85faa |
|
|
|
a85faa |
Allow omitting DEVICETYPE=Team or DEVICETYPE=TeamPort and accept
|
|
|
a85faa |
team connections based on the presence of TEAM_CONFIG/TEAM_MASTER
|
|
|
a85faa |
alone.
|
|
|
a85faa |
|
|
|
a85faa |
Also, check first for a team slave before checking for bond
|
|
|
a85faa |
slave. That is what initscripts do and matters if somebody wrongly
|
|
|
a85faa |
sets MASTER and TEAM_MASTER.
|
|
|
a85faa |
|
|
|
a85faa |
libteam: https://github.com/jpirko/libteam/commit/20d45a1e026c27f4ec37383d4bb2c446a2744c02
|
|
|
a85faa |
initscripts: https://git.fedorahosted.org/cgit/initscripts.git/commit/?id=3235be4a3da91bc91c698b318935240dbdf81aac
|
|
|
a85faa |
|
|
|
a85faa |
https://bugzilla.redhat.com/show_bug.cgi?id=1367180
|
|
|
a85faa |
(cherry picked from commit 114eb5b9634353731ed50b44299e650958bff596)
|
|
|
a85faa |
(cherry picked from commit a82b7c8d5e5753ebdf92b285cfc3ed74208d8901)
|
|
|
a85faa |
---
|
|
|
a85faa |
src/settings/plugins/ifcfg-rh/reader.c | 48 +++++++++++++---------
|
|
|
a85faa |
.../ifcfg-rh/tests/network-scripts/Makefile.am | 6 ++-
|
|
|
a85faa |
.../tests/network-scripts/ifcfg-test-team-master | 6 ---
|
|
|
a85faa |
.../tests/network-scripts/ifcfg-test-team-master-1 | 6 +++
|
|
|
a85faa |
.../tests/network-scripts/ifcfg-test-team-master-2 | 5 +++
|
|
|
a85faa |
.../tests/network-scripts/ifcfg-test-team-port | 5 ---
|
|
|
a85faa |
.../tests/network-scripts/ifcfg-test-team-port-1 | 5 +++
|
|
|
a85faa |
.../tests/network-scripts/ifcfg-test-team-port-2 | 4 ++
|
|
|
a85faa |
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 18 ++++----
|
|
|
a85faa |
9 files changed, 62 insertions(+), 41 deletions(-)
|
|
|
a85faa |
delete mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master
|
|
|
a85faa |
create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-1
|
|
|
a85faa |
create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-2
|
|
|
a85faa |
delete mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port
|
|
|
a85faa |
create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port-1
|
|
|
a85faa |
create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port-2
|
|
|
a85faa |
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
|
|
|
a85faa |
index e3d8ee1..d1ea597 100644
|
|
|
a85faa |
--- a/src/settings/plugins/ifcfg-rh/reader.c
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/reader.c
|
|
|
a85faa |
@@ -1621,26 +1621,29 @@ check_if_bond_slave (shvarFile *ifcfg,
|
|
|
a85faa |
*/
|
|
|
a85faa |
}
|
|
|
a85faa |
|
|
|
a85faa |
-static void
|
|
|
a85faa |
+static gboolean
|
|
|
a85faa |
check_if_team_slave (shvarFile *ifcfg,
|
|
|
a85faa |
NMSettingConnection *s_con)
|
|
|
a85faa |
{
|
|
|
a85faa |
- char *value;
|
|
|
a85faa |
+ gs_free char *value = NULL;
|
|
|
a85faa |
|
|
|
a85faa |
- value = svGetValue (ifcfg, "DEVICETYPE", FALSE);
|
|
|
a85faa |
- if (!value)
|
|
|
a85faa |
- return;
|
|
|
a85faa |
- if (strcasecmp (value, TYPE_TEAM_PORT)) {
|
|
|
a85faa |
- g_free (value);
|
|
|
a85faa |
- return;
|
|
|
a85faa |
- }
|
|
|
a85faa |
- g_free (value);
|
|
|
a85faa |
value = svGetValue (ifcfg, "TEAM_MASTER", FALSE);
|
|
|
a85faa |
if (!value)
|
|
|
a85faa |
- return;
|
|
|
a85faa |
+ return FALSE;
|
|
|
a85faa |
g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL);
|
|
|
a85faa |
g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_TEAM_SETTING_NAME, NULL);
|
|
|
a85faa |
- g_free (value);
|
|
|
a85faa |
+ return TRUE;
|
|
|
a85faa |
+}
|
|
|
a85faa |
+
|
|
|
a85faa |
+static void
|
|
|
a85faa |
+check_if_slave (shvarFile *ifcfg,
|
|
|
a85faa |
+ NMSettingConnection *s_con)
|
|
|
a85faa |
+{
|
|
|
a85faa |
+ g_return_if_fail (NM_IS_SETTING_CONNECTION (s_con));
|
|
|
a85faa |
+
|
|
|
a85faa |
+ if (check_if_team_slave (ifcfg, s_con))
|
|
|
a85faa |
+ return;
|
|
|
a85faa |
+ check_if_bond_slave (ifcfg, s_con);
|
|
|
a85faa |
}
|
|
|
a85faa |
|
|
|
a85faa |
typedef struct {
|
|
|
a85faa |
@@ -3948,8 +3951,7 @@ wired_connection_from_ifcfg (const char *file,
|
|
|
a85faa |
g_object_unref (connection);
|
|
|
a85faa |
return NULL;
|
|
|
a85faa |
}
|
|
|
a85faa |
- check_if_bond_slave (ifcfg, NM_SETTING_CONNECTION (con_setting));
|
|
|
a85faa |
- check_if_team_slave (ifcfg, NM_SETTING_CONNECTION (con_setting));
|
|
|
a85faa |
+ check_if_slave (ifcfg, (NMSettingConnection *) con_setting);
|
|
|
a85faa |
nm_connection_add_setting (connection, con_setting);
|
|
|
a85faa |
|
|
|
a85faa |
wired_setting = make_wired_setting (ifcfg, file, &s_8021x, error);
|
|
|
a85faa |
@@ -4099,8 +4101,7 @@ infiniband_connection_from_ifcfg (const char *file,
|
|
|
a85faa |
g_object_unref (connection);
|
|
|
a85faa |
return NULL;
|
|
|
a85faa |
}
|
|
|
a85faa |
- check_if_bond_slave (ifcfg, NM_SETTING_CONNECTION (con_setting));
|
|
|
a85faa |
- check_if_team_slave (ifcfg, NM_SETTING_CONNECTION (con_setting));
|
|
|
a85faa |
+ check_if_slave (ifcfg, (NMSettingConnection *) con_setting);
|
|
|
a85faa |
nm_connection_add_setting (connection, con_setting);
|
|
|
a85faa |
|
|
|
a85faa |
infiniband_setting = make_infiniband_setting (ifcfg, file, error);
|
|
|
a85faa |
@@ -4599,8 +4600,6 @@ is_bond_device (const char *name, shvarFile *parsed)
|
|
|
a85faa |
|
|
|
a85faa |
if (svGetValueBoolean (parsed, "BONDING_MASTER", FALSE))
|
|
|
a85faa |
return TRUE;
|
|
|
a85faa |
-
|
|
|
a85faa |
- /* XXX: Check for "bond[\d]+"? */
|
|
|
a85faa |
|
|
|
a85faa |
return FALSE;
|
|
|
a85faa |
}
|
|
|
a85faa |
@@ -4816,8 +4815,7 @@ vlan_connection_from_ifcfg (const char *file,
|
|
|
a85faa |
g_object_unref (connection);
|
|
|
a85faa |
return NULL;
|
|
|
a85faa |
}
|
|
|
a85faa |
- check_if_bond_slave (ifcfg, NM_SETTING_CONNECTION (con_setting));
|
|
|
a85faa |
- check_if_team_slave (ifcfg, NM_SETTING_CONNECTION (con_setting));
|
|
|
a85faa |
+ check_if_slave (ifcfg, (NMSettingConnection *) con_setting);
|
|
|
a85faa |
nm_connection_add_setting (connection, con_setting);
|
|
|
a85faa |
|
|
|
a85faa |
vlan_setting = make_vlan_setting (ifcfg, file, error);
|
|
|
a85faa |
@@ -5008,6 +5006,16 @@ connection_from_file_full (const char *filename,
|
|
|
a85faa |
type = g_strdup (TYPE_ETHERNET);
|
|
|
a85faa |
g_free (devtype);
|
|
|
a85faa |
}
|
|
|
a85faa |
+ if (!type) {
|
|
|
a85faa |
+ gs_free char *t = NULL;
|
|
|
a85faa |
+
|
|
|
a85faa |
+ /* Team and TeamPort types are also accepted by the mere
|
|
|
a85faa |
+ * presense of TEAM_CONFIG/TEAM_MASTER. They don't require
|
|
|
a85faa |
+ * DEVICETYPE. */
|
|
|
a85faa |
+ t = svGetValue (parsed, "TEAM_CONFIG", FALSE);
|
|
|
a85faa |
+ if (t)
|
|
|
a85faa |
+ type = g_strdup (TYPE_TEAM);
|
|
|
a85faa |
+ }
|
|
|
a85faa |
|
|
|
a85faa |
if (!type)
|
|
|
a85faa |
type = svGetValue (parsed, "TYPE", FALSE);
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
|
|
|
a85faa |
index fc759e6..7531ec0 100644
|
|
|
a85faa |
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
|
|
|
a85faa |
@@ -132,8 +132,10 @@ EXTRA_DIST = \
|
|
|
a85faa |
ifcfg-test-dcb-pgpct-not-100 \
|
|
|
a85faa |
ifcfg-test-fcoe-fabric \
|
|
|
a85faa |
ifcfg-test-fcoe-vn2vn \
|
|
|
a85faa |
- ifcfg-test-team-master \
|
|
|
a85faa |
- ifcfg-test-team-port \
|
|
|
a85faa |
+ ifcfg-test-team-master-1 \
|
|
|
a85faa |
+ ifcfg-test-team-master-2 \
|
|
|
a85faa |
+ ifcfg-test-team-port-1 \
|
|
|
a85faa |
+ ifcfg-test-team-port-2 \
|
|
|
a85faa |
ifcfg-test-team-port-empty-config \
|
|
|
a85faa |
ifcfg-test-vlan-trailing-spaces \
|
|
|
a85faa |
ifcfg-test-dns-options \
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master
|
|
|
a85faa |
deleted file mode 100644
|
|
|
a85faa |
index 7edc736..0000000
|
|
|
a85faa |
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master
|
|
|
a85faa |
+++ /dev/null
|
|
|
a85faa |
@@ -1,6 +0,0 @@
|
|
|
a85faa |
-DEVICE=team0
|
|
|
a85faa |
-ONBOOT=no
|
|
|
a85faa |
-DEVICETYPE=Team
|
|
|
a85faa |
-BOOTPROTO=dhcp
|
|
|
a85faa |
-TEAM_CONFIG="{ \"device\": \"team0\", \"link_watch\": { \"name\": \"ethtool\" } }"
|
|
|
a85faa |
-
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-1 b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-1
|
|
|
a85faa |
new file mode 100644
|
|
|
a85faa |
index 0000000..7edc736
|
|
|
a85faa |
--- /dev/null
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-1
|
|
|
a85faa |
@@ -0,0 +1,6 @@
|
|
|
a85faa |
+DEVICE=team0
|
|
|
a85faa |
+ONBOOT=no
|
|
|
a85faa |
+DEVICETYPE=Team
|
|
|
a85faa |
+BOOTPROTO=dhcp
|
|
|
a85faa |
+TEAM_CONFIG="{ \"device\": \"team0\", \"link_watch\": { \"name\": \"ethtool\" } }"
|
|
|
a85faa |
+
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-2 b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-2
|
|
|
a85faa |
new file mode 100644
|
|
|
a85faa |
index 0000000..d01e37c
|
|
|
a85faa |
--- /dev/null
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-2
|
|
|
a85faa |
@@ -0,0 +1,5 @@
|
|
|
a85faa |
+DEVICE=team0
|
|
|
a85faa |
+ONBOOT=no
|
|
|
a85faa |
+BOOTPROTO=dhcp
|
|
|
a85faa |
+TEAM_CONFIG="{ \"device\": \"team0\", \"link_watch\": { \"name\": \"ethtool\" } }"
|
|
|
a85faa |
+
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port
|
|
|
a85faa |
deleted file mode 100644
|
|
|
a85faa |
index 966bec6..0000000
|
|
|
a85faa |
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port
|
|
|
a85faa |
+++ /dev/null
|
|
|
a85faa |
@@ -1,5 +0,0 @@
|
|
|
a85faa |
-TYPE=Ethernet
|
|
|
a85faa |
-TEAM_PORT_CONFIG="{ \"p4p1\": { \"prio\": -10, \"sticky\": true } }"
|
|
|
a85faa |
-DEVICE=p4p1
|
|
|
a85faa |
-TEAM_MASTER=team0
|
|
|
a85faa |
-DEVICETYPE=TeamPort
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port-1 b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port-1
|
|
|
a85faa |
new file mode 100644
|
|
|
a85faa |
index 0000000..966bec6
|
|
|
a85faa |
--- /dev/null
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port-1
|
|
|
a85faa |
@@ -0,0 +1,5 @@
|
|
|
a85faa |
+TYPE=Ethernet
|
|
|
a85faa |
+TEAM_PORT_CONFIG="{ \"p4p1\": { \"prio\": -10, \"sticky\": true } }"
|
|
|
a85faa |
+DEVICE=p4p1
|
|
|
a85faa |
+TEAM_MASTER=team0
|
|
|
a85faa |
+DEVICETYPE=TeamPort
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port-2 b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port-2
|
|
|
a85faa |
new file mode 100644
|
|
|
a85faa |
index 0000000..992510e
|
|
|
a85faa |
--- /dev/null
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-port-2
|
|
|
a85faa |
@@ -0,0 +1,4 @@
|
|
|
a85faa |
+TYPE=Ethernet
|
|
|
a85faa |
+TEAM_PORT_CONFIG="{ \"p4p1\": { \"prio\": -10, \"sticky\": true } }"
|
|
|
a85faa |
+DEVICE=p4p1
|
|
|
a85faa |
+TEAM_MASTER=team0
|
|
|
a85faa |
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
|
|
|
a85faa |
index 3a67a83..3e3f7ca 100644
|
|
|
a85faa |
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
|
|
|
a85faa |
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
|
|
|
a85faa |
@@ -8430,15 +8430,15 @@ test_write_fcoe_mode (gconstpointer user_data)
|
|
|
a85faa |
}
|
|
|
a85faa |
|
|
|
a85faa |
static void
|
|
|
a85faa |
-test_read_team_master (void)
|
|
|
a85faa |
+test_read_team_master (gconstpointer user_data)
|
|
|
a85faa |
{
|
|
|
a85faa |
+ const char *const PATH_NAME = user_data;
|
|
|
a85faa |
NMConnection *connection;
|
|
|
a85faa |
NMSettingConnection *s_con;
|
|
|
a85faa |
NMSettingTeam *s_team;
|
|
|
a85faa |
const char *expected_config = "{ \"device\": \"team0\", \"link_watch\": { \"name\": \"ethtool\" } }";
|
|
|
a85faa |
|
|
|
a85faa |
- connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-master",
|
|
|
a85faa |
- NULL, TYPE_ETHERNET, NULL);
|
|
|
a85faa |
+ connection = _connection_from_file (PATH_NAME, NULL, TYPE_ETHERNET, NULL);
|
|
|
a85faa |
|
|
|
a85faa |
g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "team0");
|
|
|
a85faa |
|
|
|
a85faa |
@@ -8546,15 +8546,15 @@ test_write_team_master (void)
|
|
|
a85faa |
}
|
|
|
a85faa |
|
|
|
a85faa |
static void
|
|
|
a85faa |
-test_read_team_port (void)
|
|
|
a85faa |
+test_read_team_port (gconstpointer user_data)
|
|
|
a85faa |
{
|
|
|
a85faa |
+ const char *const PATH_NAME = user_data;
|
|
|
a85faa |
NMConnection *connection;
|
|
|
a85faa |
NMSettingConnection *s_con;
|
|
|
a85faa |
NMSettingTeamPort *s_team_port;
|
|
|
a85faa |
const char *expected_config = "{ \"p4p1\": { \"prio\": -10, \"sticky\": true } }";
|
|
|
a85faa |
|
|
|
a85faa |
- connection = _connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-port",
|
|
|
a85faa |
- NULL, TYPE_ETHERNET, NULL);
|
|
|
a85faa |
+ connection = _connection_from_file (PATH_NAME, NULL, TYPE_ETHERNET, NULL);
|
|
|
a85faa |
|
|
|
a85faa |
s_con = nm_connection_get_setting_connection (connection);
|
|
|
a85faa |
g_assert (s_con);
|
|
|
a85faa |
@@ -9048,9 +9048,11 @@ int main (int argc, char **argv)
|
|
|
a85faa |
g_test_add_func (TPATH "bridge/write-component", test_write_bridge_component);
|
|
|
a85faa |
g_test_add_func (TPATH "bridge/read-missing-stp", test_read_bridge_missing_stp);
|
|
|
a85faa |
|
|
|
a85faa |
- g_test_add_func (TPATH "team/read-master", test_read_team_master);
|
|
|
a85faa |
+ g_test_add_data_func (TPATH "team/read-master-1", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-master-1", test_read_team_master);
|
|
|
a85faa |
+ g_test_add_data_func (TPATH "team/read-master-2", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-master-2", test_read_team_master);
|
|
|
a85faa |
g_test_add_func (TPATH "team/write-master", test_write_team_master);
|
|
|
a85faa |
- g_test_add_func (TPATH "team/read-port", test_read_team_port);
|
|
|
a85faa |
+ g_test_add_data_func (TPATH "team/read-port-1", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-port-1", test_read_team_port);
|
|
|
a85faa |
+ g_test_add_data_func (TPATH "team/read-port-2", TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-port-2", test_read_team_port);
|
|
|
a85faa |
g_test_add_func (TPATH "team/write-port", test_write_team_port);
|
|
|
a85faa |
g_test_add_func (TPATH "team/read-port-empty-config", test_read_team_port_empty_config);
|
|
|
a85faa |
|
|
|
a85faa |
--
|
|
|
a85faa |
2.7.4
|
|
|
a85faa |
|