]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: fix simple scan 47361/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 29 Jul 2022 13:58:05 +0000 (15:58 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 29 Jul 2022 14:15:08 +0000 (16:15 +0200)
commit5a10e3e9e865aafd9d3f90beb186777060d17f08
treedf8c7c322c42566e8facb87cbc50a6c1c7866df9
parent5515138425f6777f89bfe19044c40a5e8804a443
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>
src/ceph-volume/ceph_volume/tests/util/test_disk.py
src/ceph-volume/ceph_volume/util/disk.py