Skip to content

Commit

Permalink
Merge pull request ceph#29386 from alfredodeza/wip-rm40987
Browse files Browse the repository at this point in the history
ceph-volume  simple: better detection when 'type' file is not present

Reviewed-by: Andrew Schoen <[email protected]>
  • Loading branch information
andrewschoen authored Jul 30, 2019
2 parents 6015ff4 + e48ad3a commit eb48959
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ceph-volume/ceph_volume/devices/simple/activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ def validate_devices(self, json_config):
try:
objectstore = json_config['type']
except KeyError:
logger.warning('"type" was not defined, will assume "bluestore"')
objectstore = 'bluestore'
if {'data', 'journal'}.issubset(set(devices)):
logger.warning(
'"type" key not found, assuming "filestore" since journal key is present'
)
objectstore = 'filestore'
else:
logger.warning(
'"type" key not found, assuming "bluestore" since journal key is not present'
)
objectstore = 'bluestore'

# Go through all the device combinations that are absolutely required,
# raise an error describing what was expected and what was found
Expand Down
10 changes: 10 additions & 0 deletions src/ceph-volume/ceph_volume/tests/devices/simple/test_activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,21 @@ def test_filestore_with_all_devices(self):
result = activation.validate_devices({'type': 'filestore', 'journal': {}, 'data': {}})
assert result is True

def test_filestore_without_type(self):
activation = activate.Activate([])
result = activation.validate_devices({'journal': {}, 'data': {}})
assert result is True

def test_bluestore_with_all_devices(self):
activation = activate.Activate([])
result = activation.validate_devices({'type': 'bluestore', 'data': {}, 'block': {}})
assert result is True

def test_bluestore_without_type(self):
activation = activate.Activate([])
result = activation.validate_devices({'data': {}, 'block': {}})
assert result is True

def test_bluestore_is_default(self):
activation = activate.Activate([])
result = activation.validate_devices({'data': {}, 'block': {}})
Expand Down

0 comments on commit eb48959

Please sign in to comment.