[hooks] config_changed checks for "sysctl". fixes LP: #1366598
This commit is contained in:
parent
85e5ec6965
commit
5eccec9dc2
@ -115,3 +115,9 @@ options:
|
|||||||
.
|
.
|
||||||
This network will be used for tenant network traffic in overlay
|
This network will be used for tenant network traffic in overlay
|
||||||
networks.
|
networks.
|
||||||
|
sysctl:
|
||||||
|
type: string
|
||||||
|
default:
|
||||||
|
description: |
|
||||||
|
YAML formatted associative array of sysctl values, e.g.:
|
||||||
|
'{ kernel.pid_max : 4194303 }'
|
@ -33,6 +33,7 @@ from charmhelpers.contrib.openstack.utils import (
|
|||||||
openstack_upgrade_available,
|
openstack_upgrade_available,
|
||||||
)
|
)
|
||||||
from charmhelpers.payload.execd import execd_preinstall
|
from charmhelpers.payload.execd import execd_preinstall
|
||||||
|
from charmhelpers.core.sysctl import create as create_sysctl
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from quantum_utils import (
|
from quantum_utils import (
|
||||||
@ -78,6 +79,11 @@ def config_changed():
|
|||||||
global CONFIGS
|
global CONFIGS
|
||||||
if openstack_upgrade_available(get_common_package()):
|
if openstack_upgrade_available(get_common_package()):
|
||||||
CONFIGS = do_openstack_upgrade()
|
CONFIGS = do_openstack_upgrade()
|
||||||
|
|
||||||
|
sysctl_dict = config('sysctl')
|
||||||
|
if sysctl_dict:
|
||||||
|
create_sysctl(sysctl_dict, '/etc/sysctl.d/50-quantum-gateway.conf')
|
||||||
|
|
||||||
# Re-run joined hooks as config might have changed
|
# Re-run joined hooks as config might have changed
|
||||||
for r_id in relation_ids('shared-db'):
|
for r_id in relation_ids('shared-db'):
|
||||||
db_joined(relation_id=r_id)
|
db_joined(relation_id=r_id)
|
||||||
|
@ -40,7 +40,8 @@ TO_PATCH = [
|
|||||||
'lsb_release',
|
'lsb_release',
|
||||||
'stop_services',
|
'stop_services',
|
||||||
'b64decode',
|
'b64decode',
|
||||||
'is_relation_made'
|
'is_relation_made',
|
||||||
|
'create_sysctl',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ class TestQuantumHooks(CharmTestCase):
|
|||||||
def test_config_changed(self):
|
def test_config_changed(self):
|
||||||
def mock_relids(rel):
|
def mock_relids(rel):
|
||||||
return ['relid']
|
return ['relid']
|
||||||
|
self.test_config.set('sysctl', '{ kernel.max_pid: "1337"}')
|
||||||
self.openstack_upgrade_available.return_value = True
|
self.openstack_upgrade_available.return_value = True
|
||||||
self.valid_plugin.return_value = True
|
self.valid_plugin.return_value = True
|
||||||
self.relation_ids.side_effect = mock_relids
|
self.relation_ids.side_effect = mock_relids
|
||||||
@ -112,6 +114,7 @@ class TestQuantumHooks(CharmTestCase):
|
|||||||
self.assertTrue(_pgsql_db_joined.called)
|
self.assertTrue(_pgsql_db_joined.called)
|
||||||
self.assertTrue(_amqp_joined.called)
|
self.assertTrue(_amqp_joined.called)
|
||||||
self.assertTrue(_amqp_nova_joined.called)
|
self.assertTrue(_amqp_nova_joined.called)
|
||||||
|
self.create_sysctl.assert_called()
|
||||||
|
|
||||||
def test_config_changed_upgrade(self):
|
def test_config_changed_upgrade(self):
|
||||||
self.openstack_upgrade_available.return_value = True
|
self.openstack_upgrade_available.return_value = True
|
||||||
|
Loading…
Reference in New Issue
Block a user