Skip to content

Commit fdba746

Browse files
mvollmertomasmatus
authored andcommitted
networking: Fix renaming of bridges and other groups
Fixes: RHEL-131249 Always use the new interface name of a group in member settings and only activate the members immediately when the group name has not changed.
1 parent 62130cd commit fdba746

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

pkg/networkmanager/interfaces.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,10 +1707,7 @@ export function set_member(model, group_connection, group_settings, member_type,
17071707
/* Turn the main_connection into a member for group.
17081708
*/
17091709

1710-
const group_iface = group_connection
1711-
? group_connection.Interfaces[0].Name
1712-
: group_settings.connection.interface_name;
1713-
1710+
const group_iface = group_settings.connection.interface_name;
17141711
if (!group_iface)
17151712
return false;
17161713

@@ -1744,10 +1741,12 @@ export function set_member(model, group_connection, group_settings, member_type,
17441741
}
17451742

17461743
return settings_applier(model, iface.Device, main_connection)(member_settings).then(function () {
1747-
// If the group already exists, activate or deactivate the member immediately so that
1748-
// the settings actually apply and the interface becomes a member. Otherwise we
1749-
// activate it later when the group is created.
1750-
if (group_connection) {
1744+
// If the group already exists (with the correct name),
1745+
// activate or deactivate the member immediately so that
1746+
// the settings actually apply and the interface becomes a
1747+
// member. Otherwise we activate it later when the group
1748+
// is created.
1749+
if (group_connection && group_connection.Interfaces[0].Name == group_iface) {
17511750
const group_dev = group_connection.Interfaces[0].Device;
17521751
if (group_dev && group_dev.ActiveConnection)
17531752
return main_connection.activate(iface.Device);

test/verify/check-networkmanager-bond

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,17 @@ class TestBonding(netlib.NetworkCase):
164164
iface = m.execute("cd /sys/class/net; ls -d e* | head -n1").strip()
165165
b.wait_visible(f"tr[data-interface='{iface}']")
166166

167-
# Make a simple bond without any members. This is enough to
168-
# test the renaming.
167+
iface1 = "cockpit1"
168+
self.add_veth(iface1, dhcp_cidr="10.111.113.1/24", dhcp_range=['10.111.113.2', '10.111.113.254'])
169+
self.nm_activate_eth(iface1)
170+
self.wait_for_iface(iface1)
169171

170172
b.click("button:contains('Add bond')")
171173
b.wait_visible("#network-bond-settings-dialog")
172174
b.select_from_dropdown("#network-bond-settings-link-monitoring-select", "arp")
173175
b.set_input_text("#network-bond-settings-monitoring-targets-input", "1.1.1.1")
174176
b.set_input_text("#network-bond-settings-interface-name-input", "tbond")
177+
b.set_checked(f"input[data-iface='{iface1}']", val=True)
175178
b.click("#network-bond-settings-dialog button:contains('Add')")
176179
b.wait_not_present("#network-bond-settings-dialog")
177180

@@ -180,7 +183,6 @@ class TestBonding(netlib.NetworkCase):
180183

181184
b.click("#networking-interfaces tr[data-interface='tbond'] button")
182185
self.wait_onoff("#network-interface .pf-v5-c-card__header", val=True)
183-
self.wait_for_iface_setting('Status', 'Configuring')
184186

185187
self.configure_iface_setting('Bond')
186188
b.wait_visible("#network-bond-settings-dialog")
@@ -194,6 +196,10 @@ class TestBonding(netlib.NetworkCase):
194196
b.wait_not_present("#network-bond-settings-dialog")
195197
b.wait_text("#network-interface-name", "tbond3000")
196198

199+
# Check that the member is still there and active
200+
b.wait_visible(f"#network-interface-members tr[data-interface='{iface1}']")
201+
self.wait_onoff(f"#network-interface-members tr[data-interface='{iface1}']", val=True)
202+
197203
def testActive(self):
198204
b = self.browser
199205

0 commit comments

Comments
 (0)