]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: Refactor is_ceph_device to simplify error handling 62026/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Thu, 27 Feb 2025 07:53:59 +0000 (08:53 +0100)
committerGuillaume Abrioux <gabrioux@ibm.com>
Mon, 3 Mar 2025 09:46:10 +0000 (10:46 +0100)
commit7193adafaeab609008f0662e52ccb37dfdd5fefd
treecd035590edaa5d96b49cd62a2bc566be5a105d95
parentfc085405abe33023f67b7e5592b6e0eddcc097f8
ceph-volume: Refactor is_ceph_device to simplify error handling

Replace the try-except block with a direct get() call on lv.tags to
check for ceph.osd_id. This avoids catching AttributeError unnecessarily
and makes the logic more concise. Additionally, the warning message is
now logged when osd_id is None or 'null', ensuring consistency in
error handling.
Also, this fixes the unit test `api/test_lvm.py::TestVolume::test_is_not_ceph_device()`
as `api.lvm.is_ceph_device()` expects a `Volume` object.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
src/ceph-volume/ceph_volume/api/lvm.py
src/ceph-volume/ceph_volume/tests/api/test_lvm.py
src/ceph-volume/ceph_volume/tests/util/test_device.py