Skip to content

Commit

Permalink
Merge pull request #29417 from jan--f/wip-41022-mimic
Browse files Browse the repository at this point in the history
mimic: simple: when 'type' file is not present activate fails
  • Loading branch information
jan--f committed Aug 7, 2019
2 parents 790c435 + a0faba5 commit 505297c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 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
Expand Up @@ -199,4 +199,4 @@ def test_wal_device_is_not_large_enough(self, stub_vgs, fakedevice, factory, con
with pytest.raises(RuntimeError) as error:
bluestore.MixedType(args, [hdd], [], [ssd]).computed['osds'][0]
expected = 'Unable to use device 1.50 GB /dev/sda, LVs would be smaller than 1GB'
assert expected in str(error), str(error)
assert expected in str(error.value), str(error.value)
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 505297c

Please sign in to comment.