Merge "Reload OSD when AppArmor policies are changed"

This commit is contained in:
Zuul 2018-07-19 06:52:33 +00:00 committed by Gerrit Code Review
commit 81774fe2c0
1 changed files with 18 additions and 8 deletions

View File

@ -153,8 +153,23 @@ def tune_network_adapters():
ceph.tune_nic(interface)
@restart_on_change({'/etc/apparmor.d/usr.bin.ceph-osd': ['apparmor']},
restart_functions={'apparmor': service_reload})
def aa_profile_changed(service_name='ceph-osd-all'):
"""
Reload AA profie and restart OSD processes.
"""
log("Loading new AppArmor profile")
service_reload('apparmor')
log("Restarting ceph-osd services with new AppArmor profile")
if ceph.systemd():
for osd_id in ceph.get_local_osd_ids():
service_restart('ceph-osd@{}'.format(osd_id))
else:
service_restart(service_name)
@restart_on_change({
'/etc/apparmor.d/usr.bin.ceph-osd': ['ceph-osd-all']},
restart_functions={'ceph-osd-all': aa_profile_changed})
def copy_profile_into_place():
"""
Copy the apparmor profiles included with the charm
@ -215,12 +230,7 @@ def install_apparmor_profile():
if new_install or config().changed('aa-profile-mode'):
aa_context = CephOsdAppArmorContext()
aa_context.setup_aa_profile()
service_reload('apparmor')
if ceph.systemd():
for osd_id in ceph.get_local_osd_ids():
service_restart('ceph-osd@{}'.format(osd_id))
else:
service_restart('ceph-osd-all')
aa_profile_changed()
def install_udev_rules():