예제 #1
0
def add_device(request, device_path, bucket=None):
    charms_ceph.utils.osdize(device_path, hookenv.config('osd-format'),
                             ceph_hooks.get_journal_devices(),
                             hookenv.config('ignore-device-errors'),
                             hookenv.config('osd-encrypt'),
                             hookenv.config('bluestore'),
                             hookenv.config('osd-encrypt-keymanager'))
    # Make it fast!
    if hookenv.config('autotune'):
        charms_ceph.utils.tune_dev(device_path)
    mounts = filter(lambda disk: device_path in disk.device,
                    psutil.disk_partitions())
    for osd in mounts:
        osd_id = osd.mountpoint.split('/')[-1].split('-')[-1]
        request.ops.append({
            'op': 'move-osd-to-bucket',
            'osd': "osd.{}".format(osd_id),
            'bucket': bucket
        })

    # Ensure mon's count of osds is accurate
    db = kv()
    bootstrapped_osds = len(db.get('osd-devices', []))
    for r_id in hookenv.relation_ids('mon'):
        hookenv.relation_set(relation_id=r_id,
                             relation_settings={
                                 'bootstrapped-osds': bootstrapped_osds,
                             })

    return request
 def test_get_journal_devices(self, mock_config, mock_storage_list,
                              mock_os_path_exists):
     '''Devices returned as expected'''
     config = {'osd-journal': '/dev/vda /dev/vdb'}
     mock_config.side_effect = lambda key: config[key]
     mock_storage_list.return_value = []
     mock_os_path_exists.return_value = True
     devices = ceph_hooks.get_journal_devices()
     mock_storage_list.assert_called()
     mock_os_path_exists.assert_called()
     self.assertEqual(devices, set(['/dev/vda', '/dev/vdb']))
예제 #3
0
def add_device(request, device_path, bucket=None):
    ceph.osdize(dev, config('osd-format'), get_journal_devices(),
                config('osd-reformat'), config('ignore-device-errors'),
                config('osd-encrypt'))
    # Make it fast!
    if config('autotune'):
        ceph.tune_dev(dev)
    mounts = filter(lambda disk: device_path in disk.device,
                    psutil.disk_partitions())
    if mounts:
        osd = mounts[0]
        osd_id = osd.mountpoint.split('/')[-1].split('-')[-1]
        request.ops.append({
            'op': 'move-osd-to-bucket',
            'osd': "osd.{}".format(osd_id),
            'bucket': bucket
        })
    return request
예제 #4
0
def add_device(request, device_path, bucket=None):
    ceph.utils.osdize(dev, hookenv.config('osd-format'),
                      ceph_hooks.get_journal_devices(),
                      hookenv.config('ignore-device-errors'),
                      hookenv.config('osd-encrypt'),
                      hookenv.config('bluestore'),
                      hookenv.config('osd-encrypt-keymanager'))
    # Make it fast!
    if hookenv.config('autotune'):
        ceph.utils.tune_dev(dev)
    mounts = filter(lambda disk: device_path
                    in disk.device, psutil.disk_partitions())
    for osd in mounts:
        osd_id = osd.mountpoint.split('/')[-1].split('-')[-1]
        request.ops.append({
            'op': 'move-osd-to-bucket',
            'osd': "osd.{}".format(osd_id),
            'bucket': bucket})
    return request