summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-07-19 06:52:33 +0000
committerGerrit Code Review <review@openstack.org>2018-07-19 06:52:33 +0000
commit81774fe2c015b20dc7aa9339799f23236ac6b980 (patch)
tree9cc23dfcdfb59767190e56086061a6a6660bcfc2
parentcfbd4436f1e731b95cf68ac24f4f377bda9b66e6 (diff)
parent9f5d3429c834b25491bacafa852d5f8a901b5bd9 (diff)
Merge "Reload OSD when AppArmor policies are changed"
-rwxr-xr-xhooks/ceph_hooks.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/hooks/ceph_hooks.py b/hooks/ceph_hooks.py
index 0eca970..dfea736 100755
--- a/hooks/ceph_hooks.py
+++ b/hooks/ceph_hooks.py
@@ -153,8 +153,23 @@ def tune_network_adapters():
153 ceph.tune_nic(interface) 153 ceph.tune_nic(interface)
154 154
155 155
156@restart_on_change({'/etc/apparmor.d/usr.bin.ceph-osd': ['apparmor']}, 156def aa_profile_changed(service_name='ceph-osd-all'):
157 restart_functions={'apparmor': service_reload}) 157 """
158 Reload AA profie and restart OSD processes.
159 """
160 log("Loading new AppArmor profile")
161 service_reload('apparmor')
162 log("Restarting ceph-osd services with new AppArmor profile")
163 if ceph.systemd():
164 for osd_id in ceph.get_local_osd_ids():
165 service_restart('ceph-osd@{}'.format(osd_id))
166 else:
167 service_restart(service_name)
168
169
170@restart_on_change({
171 '/etc/apparmor.d/usr.bin.ceph-osd': ['ceph-osd-all']},
172 restart_functions={'ceph-osd-all': aa_profile_changed})
158def copy_profile_into_place(): 173def copy_profile_into_place():
159 """ 174 """
160 Copy the apparmor profiles included with the charm 175 Copy the apparmor profiles included with the charm
@@ -215,12 +230,7 @@ def install_apparmor_profile():
215 if new_install or config().changed('aa-profile-mode'): 230 if new_install or config().changed('aa-profile-mode'):
216 aa_context = CephOsdAppArmorContext() 231 aa_context = CephOsdAppArmorContext()
217 aa_context.setup_aa_profile() 232 aa_context.setup_aa_profile()
218 service_reload('apparmor') 233 aa_profile_changed()
219 if ceph.systemd():
220 for osd_id in ceph.get_local_osd_ids():
221 service_restart('ceph-osd@{}'.format(osd_id))
222 else:
223 service_restart('ceph-osd-all')
224 234
225 235
226def install_udev_rules(): 236def install_udev_rules():