def tune_network_adapters(): interfaces = netifaces.interfaces() for interface in interfaces: if interface == "lo": # Skip the loopback continue log("Looking up {} for possible sysctl tuning.".format(interface)) ceph.tune_nic(interface)
def test_tune_nic(self, save_sysctls, get_link_speed, check_output): get_link_speed.return_value = 10000 ceph.tune_nic('eth0') save_sysctls.assert_has_calls([ call(save_location='/etc/sysctl.d/51-ceph-osd-charm-eth0.conf', sysctl_dict={ 'net.core.rmem_max': 524287, 'net.core.wmem_max': 524287, 'net.core.rmem_default': 524287, 'net.ipv4.tcp_wmem': '10000000 10000000 10000000', 'net.core.netdev_max_backlog': 300000, 'net.core.optmem_max': 524287, 'net.ipv4.tcp_mem': '10000000 10000000 10000000', 'net.ipv4.tcp_rmem': '10000000 10000000 10000000', 'net.core.wmem_default': 524287 }) ]) check_output.assert_called_with( ['sysctl', '-p', '/etc/sysctl.d/' '51-ceph-osd-charm-eth0.conf']) self.status_set.assert_has_calls([ call('maintenance', 'Tuning device eth0'), ])
def test_tune_nic(self, save_sysctls, get_link_speed, check_output): get_link_speed.return_value = 10000 ceph.tune_nic('eth0') save_sysctls.assert_has_calls([ call( save_location='/etc/sysctl.d/51-ceph-osd-charm-eth0.conf', sysctl_dict={ 'net.core.rmem_max': 524287, 'net.core.wmem_max': 524287, 'net.core.rmem_default': 524287, 'net.ipv4.tcp_wmem': '10000000 10000000 10000000', 'net.core.netdev_max_backlog': 300000, 'net.core.optmem_max': 524287, 'net.ipv4.tcp_mem': '10000000 10000000 10000000', 'net.ipv4.tcp_rmem': '10000000 10000000 10000000', 'net.core.wmem_default': 524287 }) ]) check_output.assert_called_with(['sysctl', '-p', '/etc/sysctl.d/' '51-ceph-osd-charm-eth0.conf']) self.status_set.assert_has_calls([ call('maintenance', 'Tuning device eth0'), ])