Skip to content

Commit

Permalink
Merge pull request #29416 from jan--f/wip-41021-nautilus
Browse files Browse the repository at this point in the history
nautilus: simple: when 'type' file is not present activate fails
  • Loading branch information
jan--f committed Aug 6, 2019
2 parents deee443 + c3e3307 commit 6f82bc1
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
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
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 6f82bc1

Please sign in to comment.