Ondřej Svoboda has uploaded a new change for review.
Change subject: netinfo: remove an assertion from getBondingForNic ......................................................................
netinfo: remove an assertion from getBondingForNic
The following commands show that a NIC cannot be enslaved to multiple bonds:
# ip link add type dummy # ip link add type bond # ip link add type bond # echo +dummy0 > /sys/class/net/bond0/bonding/slaves # echo +dummy0 > /sys/class/net/bond1/bonding/slaves -bash: echo: write error: Device or resource busy
The reason to remove assertions is quoted from Nir Soffer's https://gerrit.ovirt.org/34361/ (which this patch replaces, partially):
The code was assuming that asserts are always available, and if running within optimized mode, the code would skip the assert and use invalid configuration, possibly corrupting application state or failing with unrelated errors, hiding the root cause of the error.
Change-Id: I0b39d3b0040c86a8c4c4babe4af03b9cf8f6bdd4 Signed-off-by: Ondřej Svoboda osvoboda@redhat.com --- M lib/vdsm/netinfo.py 1 file changed, 2 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/45072/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py index dfe8994..bac6ec5 100644 --- a/lib/vdsm/netinfo.py +++ b/lib/vdsm/netinfo.py @@ -897,11 +897,8 @@ def getBondingForNic(self, nic): bondings = [b for (b, attrs) in self.bondings.iteritems() if nic in attrs['slaves']] - if bondings: - assert len(bondings) == 1, \ - "Unexpected configuration: More than one bonding per nic" - return bondings[0] - return None + # only a single bond can have the NIC as a slave + return bondings[0] if bondings else None
def getNicsVlanAndBondingForNetwork(self, network): vlan = None