add bluestore-specific config options

Adds bluestore-specific options related to the metadata-only journal.

The options allow a user to control:

1. path to a bluestore wal (block special file or regular file)
2. path to a bluestore db (block special file or regular file)
3. size of both

Their configuration works similarly to the FileStore journal. If paths
are not specified both WAL and DB will be collocated on the same block
device as data.

Other options can be configured via an existing config-flags option if needed.
http://docs.ceph.com/docs/master/rados/configuration/bluestore-config-ref/

Closes-Bug: #1710474
Change-Id: Ia85092230d4dcb0435354deb276012f923547393
Depends-On: I483ee9dae4ce69c71ae06359d0fb96aaa1c56cbc
Depends-On: Idbbb69acec92b2f2efca80691ca73a2030bcf633
This commit is contained in:
Dmitrii Shcherbakov 2017-08-28 16:13:52 +03:00 committed by James Page
parent 023b086b0d
commit 189e7620c0
6 changed files with 79 additions and 7 deletions

View File

@ -72,6 +72,16 @@ options:
that OSD.
.
Only supported with ceph >= 0.48.3.
bluestore-wal:
type: string
default:
description: |
Path to a BlueStore WAL block device or file.
bluestore-db:
type: string
default:
description: |
Path to a BlueStore WAL db block device or file
osd-journal-size:
type: int
default: 1024
@ -83,6 +93,20 @@ options:
partition for the journal.
.
Only supported with ceph >= 0.48.3.
bluestore-block-wal-size:
type: int
default: 0
description: |
Size of a partition or file to use for BlueStore WAL (RocksDB WAL)
A default value is not set as it is calculated by ceph-disk if
not specified.
bluestore-block-db-size:
type: int
default: 0
description: |
Size of a partition or file to use for BlueStore metadata
or RocksDB SSTs. A default value is not set as it is calculated
by ceph-disk if not specified.
osd-format:
type: string
default: xfs

View File

@ -264,6 +264,8 @@ def get_ceph_context(upgrading=False):
'upgrade_in_progress': upgrading,
'bluestore': config('bluestore'),
'bluestore_experimental': cmp_pkgrevno('ceph', '12.1.0') < 0,
'bluestore_block_wal_size': config('bluestore-block-wal-size'),
'bluestore_block_db_size': config('bluestore-block-db-size'),
}
if config('prefer-ipv6'):

View File

@ -1477,11 +1477,13 @@ def osdize_dev(dev, osd_format, osd_journal, reformat_osd=False,
if wal:
cmd.append('--block.wal')
least_used_wal = find_least_used_utility_device(wal)
cmd.append(least_used_wal)
db = get_devices('bluestore-db')
if db:
cmd.append('--block.db')
least_used_db = find_least_used_utility_device(db)
cmd.append(least_used_db)
elif cmp_pkgrevno('ceph', '12.1.0') >= 0 and not bluestore:
cmd.append('--filestore')

View File

@ -37,3 +37,11 @@ storage:
type: block
multiple:
range: 0-
bluestore-db:
type: block
multiple:
range: 0-
bluestore-wal:
type: block
multiple:
range: 0-

View File

@ -64,6 +64,12 @@ keyring = /var/lib/ceph/osd/$cluster-$id/keyring
{% if not bluestore_experimental -%}
osd objectstore = bluestore
{%- endif -%}
{% if bluestore_block_wal_size -%}
bluestore block wal size = {{ bluestore_block_wal_size }}
{%- endif %}
{% if bluestore_block_db_size -%}
bluestore block db size = {{ bluestore_block_db_size }}
{%- endif %}
{%- else %}
osd journal size = {{ osd_journal_size }}
filestore xattr use omap = true

View File

@ -1,4 +1,5 @@
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -35,7 +36,16 @@ CHARM_CONFIG = {'config-flags': '',
'prefer-ipv6': False,
'customize-failure-domain': False,
'bluestore': False,
'crush-initial-weight': '0'}
'crush-initial-weight': '0',
'bluestore': False,
'bluestore-block-wal-size': 0,
'bluestore-block-db-size': 0,
'bluestore-wal': None,
'bluestore-db': None}
BLUESTORE_WAL_TEST_SIZE = 128 * 2 ** 20
BLUESTORE_DB_TEST_SIZE = 2 * 2 ** 30
class CephHooksTestCase(unittest.TestCase):
@ -75,7 +85,9 @@ class CephHooksTestCase(unittest.TestCase):
'upgrade_in_progress': False,
'use_syslog': 'true',
'bluestore': False,
'bluestore_experimental': False}
'bluestore_experimental': False,
'bluestore_block_wal_size': 0,
'bluestore_block_db_size': 0}
self.assertEqual(ctxt, expected)
@patch.object(ceph_hooks, 'get_fsid', lambda *args: '1234')
@ -112,7 +124,9 @@ class CephHooksTestCase(unittest.TestCase):
'upgrade_in_progress': False,
'use_syslog': 'true',
'bluestore': False,
'bluestore_experimental': True}
'bluestore_experimental': True,
'bluestore_block_wal_size': 0,
'bluestore_block_db_size': 0}
self.assertEqual(ctxt, expected)
@patch.object(ceph_hooks, 'get_fsid', lambda *args: '1234')
@ -128,6 +142,12 @@ class CephHooksTestCase(unittest.TestCase):
def test_get_ceph_context_bluestore(self, mock_config, mock_config2):
config = copy.deepcopy(CHARM_CONFIG)
config['bluestore'] = True
BLUESTORE_WAL = '/dev/sdb /dev/sdc'
BLUESTORE_DB = '/dev/sdb /dev/sdc'
config['bluestore-block-wal-size'] = BLUESTORE_WAL_TEST_SIZE
config['bluestore-block-db-size'] = BLUESTORE_DB_TEST_SIZE
config['bluestore-wal'] = BLUESTORE_WAL
config['bluestore-db'] = BLUESTORE_DB
mock_config.side_effect = lambda key: config[key]
mock_config2.side_effect = lambda key: config[key]
ctxt = ceph_hooks.get_ceph_context()
@ -149,7 +169,9 @@ class CephHooksTestCase(unittest.TestCase):
'upgrade_in_progress': False,
'use_syslog': 'true',
'bluestore': True,
'bluestore_experimental': False}
'bluestore_experimental': False,
'bluestore_block_wal_size': BLUESTORE_WAL_TEST_SIZE,
'bluestore_block_db_size': BLUESTORE_DB_TEST_SIZE}
self.assertEqual(ctxt, expected)
@patch.object(ceph_hooks, 'get_fsid', lambda *args: '1234')
@ -166,6 +188,8 @@ class CephHooksTestCase(unittest.TestCase):
def test_get_ceph_context_bluestore_old(self, mock_config, mock_config2):
config = copy.deepcopy(CHARM_CONFIG)
config['bluestore'] = True
config['bluestore-block-wal-size'] = BLUESTORE_WAL_TEST_SIZE
config['bluestore-block-db-size'] = BLUESTORE_DB_TEST_SIZE
mock_config.side_effect = lambda key: config[key]
mock_config2.side_effect = lambda key: config[key]
ctxt = ceph_hooks.get_ceph_context()
@ -187,7 +211,9 @@ class CephHooksTestCase(unittest.TestCase):
'upgrade_in_progress': False,
'use_syslog': 'true',
'bluestore': True,
'bluestore_experimental': True}
'bluestore_experimental': True,
'bluestore_block_wal_size': BLUESTORE_WAL_TEST_SIZE,
'bluestore_block_db_size': BLUESTORE_DB_TEST_SIZE}
self.assertEqual(ctxt, expected)
@patch.object(ceph_hooks, 'get_fsid', lambda *args: '1234')
@ -225,7 +251,9 @@ class CephHooksTestCase(unittest.TestCase):
'upgrade_in_progress': False,
'use_syslog': 'true',
'bluestore': False,
'bluestore_experimental': False}
'bluestore_experimental': False,
'bluestore_block_wal_size': 0,
'bluestore_block_db_size': 0}
self.assertEqual(ctxt, expected)
@patch.object(ceph_hooks, 'get_fsid', lambda *args: '1234')
@ -265,7 +293,9 @@ class CephHooksTestCase(unittest.TestCase):
'upgrade_in_progress': False,
'use_syslog': 'true',
'bluestore': False,
'bluestore_experimental': False}
'bluestore_experimental': False,
'bluestore_block_wal_size': 0,
'bluestore_block_db_size': 0}
self.assertEqual(ctxt, expected)
@patch.object(ceph_hooks, 'ceph')