]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: `get_first_*()` refactor 39907/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 8 Mar 2021 08:59:26 +0000 (09:59 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 7 Apr 2021 07:13:39 +0000 (09:13 +0200)
commita5e4216b49704783c55fb83b3ae6dde35b0082ad
tree9573a563fa40dd0d85989ff63979587c03f7c2de
parentbb45bf90a6f95ef202a85f3034643a5efd63b897
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>
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