def assertBridgeClean(bridge, vlan, bonding, nics): ports = set(netinfo.ports(bridge)) ifaces = set(nics) if vlan is not None: ifaces.add(vlan) else: ifaces.add(bonding) brifs = ports - ifaces if brifs: raise ConfigNetworkError(ne.ERR_USED_BRIDGE, "bridge %s has interfaces" " %s connected" % (bridge, brifs))
def assertBridgeClean(bridge, vlan, bonding, nics): ports = set(netinfo.ports(bridge)) ifaces = set(nics) if vlan is not None: ifaces.add('%s.%s' % ((bonding or nics[0]), vlan)) else: ifaces.add(bonding) brifs = ports - ifaces if brifs: raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'bridge %s has interfaces' ' %s connected' % (bridge, brifs))
def assertBridgeClean(bridge, vlan, bonding, nics): ports = set(netinfo.ports(bridge)) ifaces = set(nics) if vlan: ifaces.add((bonding or nics[0]) + '.' + vlan) else: ifaces.add(bonding) brifs = ports - ifaces if brifs: raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'bridge %s has interfaces' ' %s connected' % (bridge, brifs))
def _update_bridge_ports_mtu(bridge, mtu): for port in netinfo.ports(bridge): ipwrapper.linkSet(port, ['mtu', str(mtu)])