def _remove_redundant_ovs_bridge(running_config): """ Remove OVS Bridge if there is no OVS net/bond anymore. """ for net, attr in iter_ovs_nets(running_config.networks): return for bond, attr in iter_ovs_bonds(running_config.bonds): return log('Removing redundant OVS bridge') destroy_ovs_bridge()
def bondings_caps(running_config): ovs_bonding_caps = {} routes = netinfo_routes.get_routes() for bonding, attrs in iter_ovs_bonds(running_config.bonds): options = parse_bond_options(attrs.get('options'), keep_custom=True) net_info = _get_net_info(bonding, routes) net_info['slaves'] = attrs.get('nics') net_info['active_slave'] = _get_active_slave(bonding) net_info['opts'] = options ovs_bonding_caps[bonding] = net_info return ovs_bonding_caps
def _mtus_bonds(running_config): """ Bonding and its slaves should have the same MTU. Check slaves of every bonding, if not consistent, set them all the biggest found MTU. """ changes = {} for bonding, attrs in iter_ovs_bonds(running_config.bonds): slaves = running_config.bonds[bonding].get('nics') mtu = max(netinfo.mtus.getMtu(bonding), max([netinfo.mtus.getMtu(slave) for slave in slaves])) _update_mtu_changes(mtu, slaves, changes) return changes
def _mtus_bonds(running_config): """ Bonding and its slaves should have the same MTU. Check slaves of every bonding, if not consistent, set them all the biggest found MTU. """ changes = {} for bonding, attrs in iter_ovs_bonds(running_config.bonds): slaves = running_config.bonds[bonding].get('nics') mtu = max(netinfo.getMtu(bonding), max([netinfo.getMtu(slave) for slave in slaves])) _update_mtu_changes(mtu, slaves, changes) return changes
def bondings_caps(running_config): ovs_bonding_caps = {} dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces() routes = netinfo._get_routes() for bonding, attrs in iter_ovs_bonds(running_config.bonds): options = get_bond_options(attrs.get('options'), keep_custom=True) net_info = _get_net_info(attrs, bonding, dhcpv4ifaces, dhcpv6ifaces, routes) net_info['slaves'] = attrs.get('nics') net_info['active_slave'] = _get_active_slave(bonding) net_info['opts'] = options ovs_bonding_caps[bonding] = net_info return ovs_bonding_caps