Add config for sysctl

Allows the administrator to set custom sysctls on the storage
nodes. This is especially useful for setting kernel.pid_max.

Change-Id: Id902f799796a121578eba10de22e0eb9cc627b9d
Closes-bug: 1396613
This commit is contained in:
Chris MacNaughton 2017-02-02 07:56:53 -05:00
parent 36aaca68c1
commit 58c92e15b1
2 changed files with 14 additions and 0 deletions

View File

@ -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 }'

View File

@ -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)