summaryrefslogtreecommitdiffstats
path: root/src/ceph-volume/ceph_volume/tests/util/test_disk.py
diff options
context:
space:
mode:
authorGuillaume Abrioux <gabrioux@redhat.com>2022-07-29 15:58:05 +0200
committerGuillaume Abrioux <gabrioux@redhat.com>2022-07-29 16:15:08 +0200
commit5a10e3e9e865aafd9d3f90beb186777060d17f08 (patch)
treedf8c7c322c42566e8facb87cbc50a6c1c7866df9 /src/ceph-volume/ceph_volume/tests/util/test_disk.py
parentMerge pull request #47347 from anthonyeleven/anthonyeleven/essthree (diff)
downloadceph-5a10e3e9e865aafd9d3f90beb186777060d17f08.tar.xz
ceph-5a10e3e9e865aafd9d3f90beb186777060d17f08.zip
ceph-volume: fix simple scan
When the class `Device` is instantiated with a path instead of a block device, it fails like following. ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 130, in __init__ self._parse() File "/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 233, in _parse self.ceph_device = disk.has_bluestore_label(self.path) File "/usr/lib/python3.6/site-packages/ceph_volume/util/disk.py", line 906, in has_bluestore_label with open(device_path, "rb") as fd: IsADirectoryError: [Errno 21] Is a directory: '/var/lib/ceph/osd/ceph-0/' ``` passing a path instead of a block device is valid, `simple scan` needs it. Fixes: https://tracker.ceph.com/issues/56969 Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
Diffstat (limited to 'src/ceph-volume/ceph_volume/tests/util/test_disk.py')
-rw-r--r--src/ceph-volume/ceph_volume/tests/util/test_disk.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ceph-volume/ceph_volume/tests/util/test_disk.py b/src/ceph-volume/ceph_volume/tests/util/test_disk.py
index 299463504c6..fcd644a861b 100644
--- a/src/ceph-volume/ceph_volume/tests/util/test_disk.py
+++ b/src/ceph-volume/ceph_volume/tests/util/test_disk.py
@@ -515,3 +515,10 @@ class TestAllowLoopDevsWarning(object):
log = caplog.records[0]
assert log.levelname == "WARNING"
assert "will never be supported in production" in log.message
+
+
+class TestHasBlueStoreLabel(object):
+ def test_device_path_is_a_path(self, fake_filesystem):
+ device_path = '/var/lib/ceph/osd/ceph-0'
+ fake_filesystem.create_dir(device_path)
+ assert not disk.has_bluestore_label(device_path) \ No newline at end of file