Exemplo n.º 1
0
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()
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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()
Exemplo n.º 5
0
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()
Exemplo n.º 6
0
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')