]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: fix simple scan
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 29 Jul 2022 13:58:05 +0000 (15:58 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 2 Aug 2022 09:18:24 +0000 (11:18 +0200)
commit6a242b1e4a9c555a2c12904e56b21fc8c40771a0
tree9008dec02037d9ecead4953b155e292728883204
parent2817f5df20b184621646fec4a2135f49a81e5741
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>
(cherry picked from commit 5a10e3e9e865aafd9d3f90beb186777060d17f08)
src/ceph-volume/ceph_volume/tests/util/test_disk.py
src/ceph-volume/ceph_volume/util/disk.py