]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: drop is_locked_raw_device()
authorGuillaume Abrioux <gabrioux@ibm.com>
Thu, 10 Aug 2023 08:01:12 +0000 (08:01 +0000)
committerGuillaume Abrioux <gabrioux@ibm.com>
Tue, 5 Sep 2023 13:22:57 +0000 (15:22 +0200)
commitd9ca3bd992a24ba94553bc550b2bfe0b56aa84f4
tree1ec592134767cd1bfa6911c13ae858c92266bfd5
parent725516d007e95656ef0081ee75675e95af9a0d2d
ceph-volume: drop is_locked_raw_device()

This functions works for what it is supposed to do:

check if a device is busy.

That being said, this induces a race condition in `get_devices()`

Indeed, it does:

1/ `os.open()` with `(os.O_RDWR | os.O_EXCL)`
2/ `os.close()`

The second call has an effect: it triggers a udev event which causes
systemd-udevd to re-process the device. This seems to be a question of
millisecond but because of this, /sys (sysfs) isn't fully populated as
expected. Given that get_devices() collects a lot of details from sysfs
in a loop, some of these details can be missed.

ceph-volume overall doesn't make decisions based on `is_locked_raw_device()`
This detail is used only for reporting (inventory).
For this reason, dropping this function seems reasonnable.
As a compromise, we can check if the device has partitions and/or a FileSystem
on it.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 2422ad867dff9d526d7e8be543178c897991097f)
src/ceph-volume/ceph_volume/tests/util/test_disk.py
src/ceph-volume/ceph_volume/util/device.py
src/ceph-volume/ceph_volume/util/disk.py