Ido Barkan has posted comments on this change.
Change subject: caps: raise if bridge has more than one port ......................................................................
Patch Set 2: Code-Review-1
(2 comments)
https://gerrit.ovirt.org/#/c/46321/2/vdsm/caps.py File vdsm/caps.py:
Line 97: host_ports = [port for port in attrs['ports'] if Line 98: not port.startswith('vnet')] Line 99: if not host_ports: # Port-less bridge Line 100: continue Line 101: if len(host_ports) > 1: to keep the original meaning you should test for '== 1' Line 102: raise RuntimeError('bridge with more than one port') Line 103: iface, = host_ports Line 104: if iface in caps['vlans']: Line 105: vlan_id = caps['vlans'][iface]['vlanid']
Line 99: if not host_ports: # Port-less bridge Line 100: continue Line 101: if len(host_ports) > 1: Line 102: raise RuntimeError('bridge with more than one port') Line 103: iface, = host_ports now, this defense is not needed anymore so you can just extract hots_ports[0], otherwise the exception would be already raised. Line 104: if iface in caps['vlans']: Line 105: vlan_id = caps['vlans'][iface]['vlanid'] Line 106: iface = caps['vlans'][iface]['iface'] Line 107: iface_qdiscs = qdiscs.get(iface)