[hooks] config_changed checks for "sysctl". fixes LP: #1366598
This commit is contained in:
parent
85e5ec6965
commit
5eccec9dc2
@ -92,7 +92,7 @@ options:
|
||||
accomodate the packet overhead of using GRE tunnels.
|
||||
enable-l3-agent:
|
||||
type: boolean
|
||||
default: True
|
||||
default: True
|
||||
description: |
|
||||
Optional configuration to support use of linux router
|
||||
Note that this is used only for Cisco n1kv plugin.
|
||||
@ -115,3 +115,9 @@ options:
|
||||
.
|
||||
This network will be used for tenant network traffic in overlay
|
||||
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,
|
||||
)
|
||||
from charmhelpers.payload.execd import execd_preinstall
|
||||
from charmhelpers.core.sysctl import create as create_sysctl
|
||||
|
||||
import sys
|
||||
from quantum_utils import (
|
||||
@ -78,6 +79,11 @@ def config_changed():
|
||||
global CONFIGS
|
||||
if openstack_upgrade_available(get_common_package()):
|
||||
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
|
||||
for r_id in relation_ids('shared-db'):
|
||||
db_joined(relation_id=r_id)
|
||||
|
@ -40,7 +40,8 @@ TO_PATCH = [
|
||||
'lsb_release',
|
||||
'stop_services',
|
||||
'b64decode',
|
||||
'is_relation_made'
|
||||
'is_relation_made',
|
||||
'create_sysctl',
|
||||
]
|
||||
|
||||
|
||||
@ -98,6 +99,7 @@ class TestQuantumHooks(CharmTestCase):
|
||||
def test_config_changed(self):
|
||||
def mock_relids(rel):
|
||||
return ['relid']
|
||||
self.test_config.set('sysctl', '{ kernel.max_pid: "1337"}')
|
||||
self.openstack_upgrade_available.return_value = True
|
||||
self.valid_plugin.return_value = True
|
||||
self.relation_ids.side_effect = mock_relids
|
||||
@ -112,6 +114,7 @@ class TestQuantumHooks(CharmTestCase):
|
||||
self.assertTrue(_pgsql_db_joined.called)
|
||||
self.assertTrue(_amqp_joined.called)
|
||||
self.assertTrue(_amqp_nova_joined.called)
|
||||
self.create_sysctl.assert_called()
|
||||
|
||||
def test_config_changed_upgrade(self):
|
||||
self.openstack_upgrade_available.return_value = True
|
||||
|
Loading…
Reference in New Issue
Block a user