diff --git a/config.yaml b/config.yaml index 45b71e9..cea53d9 100644 --- a/config.yaml +++ b/config.yaml @@ -141,3 +141,9 @@ options: description: | Apply system hardening. Supports a space-delimited list of modules to run. Supported modules currently include os, ssh, apache and mysql. + sysctl: + type: string + default: + description: | + YAML formatted associative array of sysctl values, e.g.: + '{ kernel.pid_max : 4194303 }' diff --git a/hooks/swift_storage_hooks.py b/hooks/swift_storage_hooks.py index 6bf1324..f2ab78a 100755 --- a/hooks/swift_storage_hooks.py +++ b/hooks/swift_storage_hooks.py @@ -59,6 +59,9 @@ from charmhelpers.core.host import ( add_to_updatedb_prunepath, rsync, ) + +from charmhelpers.core.sysctl import create as create_sysctl + from charmhelpers.payload.execd import execd_preinstall from charmhelpers.contrib.openstack.utils import ( @@ -122,6 +125,11 @@ def config_changed(): save_script_rc() if relations_of_type('nrpe-external-master'): update_nrpe_config() + + sysctl_dict = config('sysctl') + if sysctl_dict: + create_sysctl(sysctl_dict, '/etc/sysctl.d/50-swift-storage-charm.conf') + add_to_updatedb_prunepath(STORAGE_MOUNT_PATH)