Fix osd object name restriction
The list of devices provided to the charm is currently incorrectly parsed such that object names are always limited to 256 chars. This patch ensures that the expected criteria is met. Change-Id: Ic5b25af614c77b35484b12dc654df5ac595d9d80 Closes-Bug: 1775029
This commit is contained in:
parent
bebf8601c9
commit
a777297594
|
@ -269,7 +269,11 @@ def use_short_objects():
|
|||
if cmp_pkgrevno('ceph', "10.2.0") >= 0:
|
||||
if config('osd-format') in ('ext4'):
|
||||
return True
|
||||
for device in config('osd-devices'):
|
||||
devices = config('osd-devices')
|
||||
if not devices:
|
||||
return False
|
||||
|
||||
for device in devices.split():
|
||||
if device and not device.startswith('/dev'):
|
||||
# TODO: determine format of directory based
|
||||
# OSD location
|
||||
|
|
|
@ -518,6 +518,28 @@ class CephHooksTestCase(unittest.TestCase):
|
|||
['udevadm', 'control', '--reload-rules']
|
||||
)
|
||||
|
||||
@patch.object(ceph_hooks, 'config')
|
||||
@patch.object(ceph_hooks, 'cmp_pkgrevno')
|
||||
def test_use_short_objects(self, mock_cmp_pkgrevno, mock_config):
|
||||
|
||||
def fake_config(key):
|
||||
return config.get(key, None)
|
||||
|
||||
mock_config.side_effect = fake_config
|
||||
mock_cmp_pkgrevno.return_value = True
|
||||
|
||||
config = {'osd-devices': '/dev/sdb /dev/sdc', 'osd-format': 'ext4'}
|
||||
self.assertTrue(ceph_hooks.use_short_objects())
|
||||
|
||||
config = {'osd-devices': '/dev/sdb /dev/sdc', 'osd-format': 'xfs'}
|
||||
self.assertFalse(ceph_hooks.use_short_objects())
|
||||
|
||||
config = {'osd-devices': '/srv/osd', 'osd-format': 'xfs'}
|
||||
self.assertTrue(ceph_hooks.use_short_objects())
|
||||
|
||||
config = {'osd-devices': '/srv/osd', 'osd-format': 'ext4'}
|
||||
self.assertTrue(ceph_hooks.use_short_objects())
|
||||
|
||||
|
||||
@patch.object(ceph_hooks, 'relation_get')
|
||||
@patch.object(ceph_hooks, 'relation_set')
|
||||
|
|
Loading…
Reference in New Issue