Beispiel #1
0
 def test_rescan_osd_devices(self):
     cmd = [
         'udevadm', 'trigger',
         '--subsystem-match=block', '--action=add'
     ]
     ceph.rescan_osd_devices()
     self.subprocess.call.assert_called_with(cmd)
Beispiel #2
0
def config_changed():
    utils.juju_log('INFO', 'Begin config-changed hook.')

    utils.juju_log('INFO', 'Monitor hosts are ' + repr(get_mon_hosts()))

    fsid = utils.config_get('fsid')
    if fsid == '':
        utils.juju_log('CRITICAL', 'No fsid supplied, cannot proceed.')
        sys.exit(1)

    monitor_secret = utils.config_get('monitor-secret')
    if monitor_secret == '':
        utils.juju_log('CRITICAL',
                       'No monitor-secret supplied, cannot proceed.')
        sys.exit(1)

    emit_cephconf()

    for dev in utils.config_get('osd-devices').split(' '):
        osdize(dev)

    # Support use of single node ceph
    if (not ceph.is_bootstrapped() and
        int(utils.config_get('monitor-count')) == 1):
        bootstrap_monitor_cluster()
        ceph.wait_for_bootstrap()

    if ceph.is_bootstrapped():
        ceph.rescan_osd_devices()

    utils.juju_log('INFO', 'End config-changed hook.')
Beispiel #3
0
def mon_relation():
    utils.juju_log('INFO', 'Begin mon-relation hook.')
    emit_cephconf()

    moncount = int(utils.config_get('monitor-count'))
    if len(get_mon_hosts()) >= moncount:
        bootstrap_monitor_cluster()
        ceph.wait_for_bootstrap()
        ceph.rescan_osd_devices()
        notify_osds()
        notify_radosgws()
        notify_client()
    else:
        utils.juju_log('INFO',
                       'Not enough mons ({}), punting.'.format(
                            len(get_mon_hosts())))

    utils.juju_log('INFO', 'End mon-relation hook.')
Beispiel #4
0
def start():
    # In case we're being redeployed to the same machines, try
    # to make sure everything is running as soon as possible.
    subprocess.call(['start', 'ceph-mon-all-starter'])
    ceph.rescan_osd_devices()