def ensure_mtu():
    '''
    Ensures required MTU of the underlying networking of the node.
    '''
    interface_mtu = config('network-device-mtu')
    fabric_interface = get_fabric_interface()
    if fabric_interface in get_bridges():
        attached_interfaces = get_bridge_nics(fabric_interface)
        for interface in attached_interfaces:
            set_nic_mtu(interface, interface_mtu)
    set_nic_mtu(fabric_interface, interface_mtu)
Exemplo n.º 2
0
def ensure_mtu():
    '''
    Ensures required MTU of the underlying networking of the node.
    '''
    interface_mtu = config('network-device-mtu')
    fabric_interface = get_fabric_interface()
    if fabric_interface in get_bridges():
        attached_interfaces = get_bridge_nics(fabric_interface)
        for interface in attached_interfaces:
            set_nic_mtu(interface, interface_mtu)
    set_nic_mtu(fabric_interface, interface_mtu)
Exemplo n.º 3
0
def get_mgmt_interface():
    '''
    Returns the managment interface.
    '''
    mgmt_interface = config('mgmt-interface')
    if not mgmt_interface:
        try:
            return get_iface_from_addr(unit_get('private-address'))
        except:
            for bridge_interface in get_bridges():
                if (get_host_ip(unit_get('private-address'))
                        in get_iface_addr(bridge_interface)):
                    return bridge_interface
    elif interface_exists(mgmt_interface):
        return mgmt_interface
    else:
        log('Provided managment interface %s does not exist' % mgmt_interface)
        return get_iface_from_addr(unit_get('private-address'))
def get_mgmt_interface():
    '''
    Returns the managment interface.
    '''
    mgmt_interface = config('mgmt-interface')
    if not mgmt_interface:
        try:
            return get_iface_from_addr(unit_get('private-address'))
        except:
            for bridge_interface in get_bridges():
                if (get_host_ip(unit_get('private-address'))
                        in get_iface_addr(bridge_interface)):
                    return bridge_interface
    elif interface_exists(mgmt_interface):
        return mgmt_interface
    else:
        log('Provided managment interface %s does not exist'
            % mgmt_interface)
        return get_iface_from_addr(unit_get('private-address'))
Exemplo n.º 5
0
 def test_get_bridges(self, _glob):
     _glob.return_value = ['/sys/devices/virtual/net/br0/bridge']
     self.assertEqual(['br0'], net_ip.get_bridges())