summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xactions/add_disk.py3
-rwxr-xr-xhooks/ceph_hooks.py6
-rw-r--r--tests/basic_deployment.py7
-rw-r--r--unit_tests/test_ceph_hooks.py22
4 files changed, 31 insertions, 7 deletions
diff --git a/actions/add_disk.py b/actions/add_disk.py
index 21ea1ec..78c7b5e 100755
--- a/actions/add_disk.py
+++ b/actions/add_disk.py
@@ -39,8 +39,7 @@ def add_device(request, device_path, bucket=None):
39 ceph.utils.tune_dev(dev) 39 ceph.utils.tune_dev(dev)
40 mounts = filter(lambda disk: device_path 40 mounts = filter(lambda disk: device_path
41 in disk.device, psutil.disk_partitions()) 41 in disk.device, psutil.disk_partitions())
42 if mounts: 42 for osd in mounts:
43 osd = mounts[0]
44 osd_id = osd.mountpoint.split('/')[-1].split('-')[-1] 43 osd_id = osd.mountpoint.split('/')[-1].split('-')[-1]
45 request.ops.append({ 44 request.ops.append({
46 'op': 'move-osd-to-bucket', 45 'op': 'move-osd-to-bucket',
diff --git a/hooks/ceph_hooks.py b/hooks/ceph_hooks.py
index 605d599..6d2b2ec 100755
--- a/hooks/ceph_hooks.py
+++ b/hooks/ceph_hooks.py
@@ -273,7 +273,11 @@ def use_short_objects():
273 if cmp_pkgrevno('ceph', "10.2.0") >= 0: 273 if cmp_pkgrevno('ceph', "10.2.0") >= 0:
274 if config('osd-format') in ('ext4'): 274 if config('osd-format') in ('ext4'):
275 return True 275 return True
276 for device in config('osd-devices'): 276 devices = config('osd-devices')
277 if not devices:
278 return False
279
280 for device in devices.split():
277 if device and not device.startswith('/dev'): 281 if device and not device.startswith('/dev'):
278 # TODO: determine format of directory based 282 # TODO: determine format of directory based
279 # OSD location 283 # OSD location
diff --git a/tests/basic_deployment.py b/tests/basic_deployment.py
index 6e5f880..5251ada 100644
--- a/tests/basic_deployment.py
+++ b/tests/basic_deployment.py
@@ -766,10 +766,9 @@ class CephOsdBasicDeployment(OpenStackAmuletDeployment):
766 'add-disk', params=add_disk_params) 766 'add-disk', params=add_disk_params)
767 action_ids.append(action_id) 767 action_ids.append(action_id)
768 768
769 # NOTE(fnordahl): LP: #1774694 769 for unit in range(0, 3):
770 # for unit in range(0, 3): 770 assert u.wait_on_action(action_ids[unit]), (
771 # assert u.wait_on_action(action_ids[unit]), ( 771 'add-disk action failed.')
772 # 'add-disk action failed.')
773 772
774 u.log.debug('Wait for idle/ready status...') 773 u.log.debug('Wait for idle/ready status...')
775 self._auto_wait_for_status(include_only=['ceph-osd']) 774 self._auto_wait_for_status(include_only=['ceph-osd'])
diff --git a/unit_tests/test_ceph_hooks.py b/unit_tests/test_ceph_hooks.py
index f8c442e..f2cfa28 100644
--- a/unit_tests/test_ceph_hooks.py
+++ b/unit_tests/test_ceph_hooks.py
@@ -483,6 +483,28 @@ class CephHooksTestCase(unittest.TestCase):
483 ['udevadm', 'control', '--reload-rules'] 483 ['udevadm', 'control', '--reload-rules']
484 ) 484 )
485 485
486 @patch.object(ceph_hooks, 'config')
487 @patch.object(ceph_hooks, 'cmp_pkgrevno')
488 def test_use_short_objects(self, mock_cmp_pkgrevno, mock_config):
489
490 def fake_config(key):
491 return config.get(key, None)
492
493 mock_config.side_effect = fake_config
494 mock_cmp_pkgrevno.return_value = True
495
496 config = {'osd-devices': '/dev/sdb /dev/sdc', 'osd-format': 'ext4'}
497 self.assertTrue(ceph_hooks.use_short_objects())
498
499 config = {'osd-devices': '/dev/sdb /dev/sdc', 'osd-format': 'xfs'}
500 self.assertFalse(ceph_hooks.use_short_objects())
501
502 config = {'osd-devices': '/srv/osd', 'osd-format': 'xfs'}
503 self.assertTrue(ceph_hooks.use_short_objects())
504
505 config = {'osd-devices': '/srv/osd', 'osd-format': 'ext4'}
506 self.assertTrue(ceph_hooks.use_short_objects())
507
486 508
487@patch.object(ceph_hooks, 'relation_get') 509@patch.object(ceph_hooks, 'relation_get')
488@patch.object(ceph_hooks, 'relation_set') 510@patch.object(ceph_hooks, 'relation_set')