def osd_in(args): """Resume the ceph-osd units on this local machine only @raises subprocess.CalledProcessError should the osd units fails to osd_in. @raises OSError if the unit can't get the local osd ids """ for local_id in get_local_osd_ids(): cmd = ['ceph', '--id', 'osd-upgrade', 'osd', 'in', str(local_id)] check_call(cmd) assess_status()
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)
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)
def osd_out(args): """Pause the ceph-osd units on the local machine only. Optionally uses the 'osd-number' from juju action param to only osd_out a specific osd. @raises CalledProcessError if the ceph commands fails. @raises OSError if it can't get the local osd ids. """ for local_id in get_local_osd_ids(): cmd = ['ceph', '--id', 'osd-upgrade', 'osd', 'out', str(local_id)] check_call(cmd) assess_status()
def pause(args): """Pause the ceph-osd units on the local machine only. Optionally uses the 'osd-number' from juju action param to only pause a specific osd. If all the osds are not stopped then the paused status is not set. @raises CalledProcessError if the ceph commands fails. @raises OSError if it can't get the local osd ids. """ for local_id in get_local_osd_ids(): cmd = ['ceph', '--id', 'osd-upgrade', 'osd', 'out', str(local_id)] check_call(cmd) set_unit_paused() assess_status()
def install_apparmor_profile(): """ Install ceph apparmor profiles and configure based on current setting of 'aa-profile-mode' configuration option. """ log('Installing apparmor profile for ceph-osd') copy_profile_into_place() if 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')