From dc6b7f451ba3409c725dcded440f4847e150de93 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sun, 23 Feb 2025 12:39:47 +0100 Subject: bond: T7191: fix error message when member interface is used multiple times Sharing the same physical interface among multiple bond interfaces causes information to be lost within the error message set interfaces bonding bond10 member interface eth1 set interfaces bonding bond10 member interface eth2 set interfaces bonding bond20 member interface eth1 set interfaces bonding bond20 member interface eth2 commit Results in: [ interfaces bonding bond10 ] Can not add interface "eth1" to bond, it is already a member of bond "b"! [[interfaces bonding bond10]] failed [ interfaces bonding bond20 ] Can not add interface "eth1" to bond, it is already a member of bond "b"! It should infact output the full name of the bond interface. --- smoketest/scripts/cli/test_interfaces_bonding.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'smoketest') diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py index 1a72f9dc4..f99fd0363 100755 --- a/smoketest/scripts/cli/test_interfaces_bonding.py +++ b/smoketest/scripts/cli/test_interfaces_bonding.py @@ -167,18 +167,25 @@ class BondingInterfaceTest(BasicInterfaceTest.TestCase): def test_bonding_multi_use_member(self): # Define available bonding hash policies - for interface in ['bond10', 'bond20']: + bonds = ['bond10', 'bond20', 'bond30'] + for interface in bonds: for member in self._members: self.cli_set(self._base_path + [interface, 'member', 'interface', member]) # check validate() - can not use the same member interfaces multiple times with self.assertRaises(ConfigSessionError): self.cli_commit() - - self.cli_delete(self._base_path + ['bond20']) + # only keep the first bond interface configuration + for interface in bonds[1:]: + self.cli_delete(self._base_path + [interface]) self.cli_commit() + bond = bonds[0] + member_ifaces = read_file(f'/sys/class/net/{bond}/bonding/slaves').split() + for member in self._members: + self.assertIn(member, member_ifaces) + def test_bonding_source_interface(self): # Re-use member interface that is already a source-interface bond = 'bond99' -- cgit v1.2.3