]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: `get_first_*()` refactor 43960/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 8 Mar 2021 08:59:26 +0000 (09:59 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 16 Nov 2021 14:57:43 +0000 (15:57 +0100)
commitb51eeefb981cff3b1b66a770dd8457d2bd3cd41d
tree0dbc26afb731be975a36540629418891e8de73a6
parent80726a08b9b8f04143ace55e4959aeb8ec834098
ceph-volume: `get_first_*()` refactor

As indicated by commit 17957d9beb42a04b8f180ccb7ba07d43179a41d3 those
fuctions were meant to avoid writing something like following:

```
lvs = get_lvs()
if len(lvs) >= 1:
lvs = lv[0]
```

Those functions should return `None` if 0 or more than 1 item is returned.
The current name of these functions are confusing and can lead to thinking that
we just want the first item returned, even though it returns more than 1
item, let's rename them to `get_single_pv()`, `get_single_vg()` and
`get_single_lv()`

Closes: https://tracker.ceph.com/issues/49643
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit a5e4216b49704783c55fb83b3ae6dde35b0082ad)
src/ceph-volume/ceph_volume/api/lvm.py
src/ceph-volume/ceph_volume/devices/lvm/prepare.py
src/ceph-volume/ceph_volume/devices/lvm/zap.py
src/ceph-volume/ceph_volume/devices/simple/scan.py
src/ceph-volume/ceph_volume/tests/api/test_lvm.py
src/ceph-volume/ceph_volume/tests/conftest.py
src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py
src/ceph-volume/ceph_volume/tests/devices/lvm/test_listing.py
src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py
src/ceph-volume/ceph_volume/util/device.py