Added gc_threshold overrides to sysctl.conf
When clouds have a large number of hosts, the default size of the ARP cache is too small. The cache can overflow, which means that the system has no way to reach some ip addresses. Setting the threshold limits higher addresses the situation, in a reasonably safe way (the maximum impact is 5MB or so of additional RAM used). Docs on ARP at http://man7.org/linux/man-pages/man7/arp.7.html, and more discussion of the issue in the bug. Change-Id: Iaf8382ee0b42e1444cfea589bb05a687cd0c23fa Closes-Bug: 1780348
This commit is contained in:
parent
9254beb043
commit
c9a19c4077
11
config.yaml
11
config.yaml
|
@ -379,7 +379,16 @@ options:
|
|||
# Other config
|
||||
sysctl:
|
||||
type: string
|
||||
default:
|
||||
default: |
|
||||
{ vm.swappiness : 1,
|
||||
net.ipv4.neigh.default.gc_thresh1 : 128,
|
||||
net.ipv4.neigh.default.gc_thresh2 : 28672,
|
||||
net.ipv4.neigh.default.gc_thresh3 : 32768,
|
||||
net.ipv6.neigh.default.gc_thresh1 : 128,
|
||||
net.ipv6.neigh.default.gc_thresh2 : 28672,
|
||||
net.ipv6.neigh.default.gc_thresh3 : 32768,
|
||||
net.nf_conntrack_max : 1000000,
|
||||
net.netfilter.nf_conntrack_max : 1000000 }
|
||||
description: |
|
||||
YAML formatted associative array of sysctl values, e.g.:
|
||||
'{ kernel.pid_max : 4194303 }'
|
||||
|
|
|
@ -19,13 +19,11 @@ import json
|
|||
import platform
|
||||
import sys
|
||||
import uuid
|
||||
import yaml
|
||||
import os
|
||||
import subprocess
|
||||
import grp
|
||||
import shutil
|
||||
|
||||
|
||||
import charmhelpers.core.unitdata as unitdata
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
|
@ -184,10 +182,7 @@ def config_changed():
|
|||
|
||||
sysctl_settings = config('sysctl')
|
||||
if sysctl_settings:
|
||||
sysctl_dict = yaml.safe_load(sysctl_settings)
|
||||
sysctl_dict['vm.swappiness'] = sysctl_dict.get('vm.swappiness', 1)
|
||||
create_sysctl(yaml.dump(sysctl_dict),
|
||||
'/etc/sysctl.d/50-nova-compute.conf')
|
||||
create_sysctl(sysctl_settings, '/etc/sysctl.d/50-nova-compute.conf')
|
||||
|
||||
remove_libvirt_network('default')
|
||||
|
||||
|
|
|
@ -215,21 +215,11 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||
self.migration_enabled.return_value = False
|
||||
self.test_config.set(
|
||||
'sysctl',
|
||||
'{ kernel.max_pid : "1337", vm.swappiness : 10 }')
|
||||
'{foo : bar}'
|
||||
)
|
||||
hooks.config_changed()
|
||||
self.create_sysctl.assert_called_with(
|
||||
"{kernel.max_pid: '1337', vm.swappiness: 10}\n",
|
||||
'/etc/sysctl.d/50-nova-compute.conf')
|
||||
|
||||
@patch.object(hooks, 'compute_joined')
|
||||
def test_config_changed_with_sysctl_swappy_default(self, compute_joined):
|
||||
self.test_config.set(
|
||||
'sysctl',
|
||||
'{ kernel.max_pid : "1337" }')
|
||||
self.migration_enabled.return_value = False
|
||||
hooks.config_changed()
|
||||
self.create_sysctl.assert_called_with(
|
||||
"{kernel.max_pid: '1337', vm.swappiness: 1}\n",
|
||||
'{foo : bar}',
|
||||
'/etc/sysctl.d/50-nova-compute.conf')
|
||||
|
||||
@patch.object(hooks, 'compute_joined')
|
||||
|
|
Loading…
Reference in New Issue