Merge "Lower vm.swappiness to reduce guest memory latency"
This commit is contained in:
commit
2a1c5ddb14
@ -17,6 +17,7 @@
|
||||
import platform
|
||||
import sys
|
||||
import uuid
|
||||
import yaml
|
||||
|
||||
|
||||
import charmhelpers.core.unitdata as unitdata
|
||||
@ -152,9 +153,12 @@ def config_changed():
|
||||
do_openstack_upgrade(CONFIGS)
|
||||
send_remote_restart = True
|
||||
|
||||
sysctl_dict = config('sysctl')
|
||||
if sysctl_dict:
|
||||
create_sysctl(sysctl_dict, '/etc/sysctl.d/50-nova-compute.conf')
|
||||
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')
|
||||
|
||||
destroy_libvirt_network('default')
|
||||
|
||||
|
@ -238,9 +238,24 @@ class NovaComputeRelationsTests(CharmTestCase):
|
||||
@patch.object(hooks, 'compute_joined')
|
||||
def test_config_changed_with_sysctl(self, compute_joined):
|
||||
self.git_install_requested.return_value = False
|
||||
self.test_config.set('sysctl', '{ kernel.max_pid : "1337" }')
|
||||
self.test_config.set(
|
||||
'sysctl',
|
||||
'{ kernel.max_pid : "1337", vm.swappiness : 10 }')
|
||||
hooks.config_changed()
|
||||
self.assertTrue(self.create_sysctl.called)
|
||||
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.git_install_requested.return_value = False
|
||||
self.test_config.set(
|
||||
'sysctl',
|
||||
'{ kernel.max_pid : "1337" }')
|
||||
hooks.config_changed()
|
||||
self.create_sysctl.assert_called_with(
|
||||
"{kernel.max_pid: '1337', vm.swappiness: 1}\n",
|
||||
'/etc/sysctl.d/50-nova-compute.conf')
|
||||
|
||||
@patch.object(hooks, 'config_value_changed')
|
||||
def test_config_changed_git(self, config_val_changed):
|
||||
|
Loading…
x
Reference in New Issue
Block a user