예제 #1
0
파일: validator.py 프로젝트: wuyeliang/vdsm
def validate_network_setup(nets, bonds, net_info):
    kernel_nics = nics()
    kernel_bonds = Bond.bonds()
    for net, attrs in six.iteritems(nets):
        validate_net_configuration(net, attrs, bonds, kernel_bonds,
                                   kernel_nics)
    for bond, attrs in six.iteritems(bonds):
        validate_bond_configuration(bond, attrs, nets, net_info['networks'],
                                    kernel_nics)
예제 #2
0
파일: validator.py 프로젝트: nirs/vdsm
def validate_network_setup(nets, bonds, net_info):
    kernel_nics = nics()
    kernel_bonds = Bond.bonds()
    for net, attrs in six.iteritems(nets):
        validate_net_configuration(
            net, attrs, bonds, kernel_bonds, kernel_nics)
    for bond, attrs in six.iteritems(bonds):
        validate_bond_configuration(
            bond, attrs, nets, net_info['networks'], kernel_nics)
예제 #3
0
def permanent_address():
    paddr = {}
    for b in Bond.bonds():
        with open('/proc/net/bonding/' + b) as f:
            for line in f:
                if line.startswith('Slave Interface: '):
                    slave = line[len('Slave Interface: '):-1]
                elif line.startswith('Permanent HW addr: ') and slave:
                    paddr[slave] = line[len('Permanent HW addr: '):-1]
    return paddr
예제 #4
0
def validate_network_setup(nets, bonds):
    ovs_networks = info.create_netinfo(info.OvsInfo())['networks']
    kernel_nics = nics()
    kernel_bonds = Bond.bonds()
    for net, attrs in six.iteritems(nets):
        validator.validate_net_configuration(
            net, attrs, bonds, kernel_bonds, kernel_nics)
    for bond, attrs in six.iteritems(bonds):
        validator.validate_bond_configuration(
            bond, attrs, nets, ovs_networks, kernel_nics)
예제 #5
0
def validate_network_setup(nets, bonds):
    ovs_networks = info.create_netinfo(info.OvsInfo())['networks']
    kernel_nics = nics()
    kernel_bonds = Bond.bonds()
    for net, attrs in six.iteritems(nets):
        validator.validate_net_configuration(net, attrs, bonds, kernel_bonds,
                                             kernel_nics)
    for bond, attrs in six.iteritems(bonds):
        validator.validate_bond_configuration(bond, attrs, nets, ovs_networks,
                                              kernel_nics)
예제 #6
0
파일: bonding.py 프로젝트: nirs/vdsm
def permanent_address():
    paddr = {}
    for b in Bond.bonds():
        with open('/proc/net/bonding/' + b) as f:
            for line in f:
                if line.startswith('Slave Interface: '):
                    slave = line[len('Slave Interface: '):-1]
                elif line.startswith('Permanent HW addr: ') and slave:
                    paddr[slave] = line[len('Permanent HW addr: '):-1]
    return paddr
예제 #7
0
def validate_network_setup(nets, bonds, net_info):
    kernel_nics = nics()
    kernel_bonds = Bond.bonds()
    current_nets = net_info['networks']
    for net, attrs in six.iteritems(nets):
        validate_net_configuration(
            net,
            attrs,
            bonds,
            kernel_bonds,
            kernel_nics,
            current_nets,
            RunningConfig().networks,
        )
    for bond, attrs in six.iteritems(bonds):
        validate_bond_configuration(bond, attrs, nets, current_nets,
                                    kernel_nics)
    validate_nic_usage(
        nets,
        bonds,
        _get_kernel_nets_nics(current_nets, kernel_bonds, nets),
        _get_kernel_bonds_slaves(kernel_bonds, bonds),
    )
예제 #8
0
 def test_bond_list(self, bond0, bond1, bond2):
     actual_bond_set = set(Bond.bonds())
     expected_bond_set = {b.master for b in (bond0, bond1, bond2)}
     assert expected_bond_set <= actual_bond_set
예제 #9
0
def _get_kernel_bonds_slaves():
    kernel_bonds_slaves = set()
    for bond_name in Bond.bonds():
        kernel_bonds_slaves |= Bond(bond_name).slaves
    return kernel_bonds_slaves
예제 #10
0
파일: configurator.py 프로젝트: EdDev/vdsm
def _get_kernel_bonds_slaves():
    kernel_bonds_slaves = set()
    for bond_name in Bond.bonds():
        kernel_bonds_slaves |= Bond(bond_name).slaves
    return kernel_bonds_slaves
예제 #11
0
 def test_bond_list(self):
     with bond_device() as b1, bond_device() as b2, bond_device() as b3:
         actual_bond_set = set(Bond.bonds())
         expected_bond_set = set([b1.master, b2.master, b3.master])
         self.assertLessEqual(expected_bond_set, actual_bond_set)
예제 #12
0
파일: link_bond_test.py 프로젝트: nirs/vdsm
 def test_bond_list(self):
     with bond_device() as b1, bond_device() as b2, bond_device() as b3:
         actual_bond_set = set(Bond.bonds())
         expected_bond_set = set([b1.master, b2.master, b3.master])
         self.assertLessEqual(expected_bond_set, actual_bond_set)