diff --git a/0005-ceph-volume-lvm-api-function-no-undefined.patch b/0005-ceph-volume-lvm-api-function-no-undefined.patch new file mode 100644 index 0000000000000000000000000000000000000000..7ba6cc51626bc3aa0398933ed6d3c0347c3202eb --- /dev/null +++ b/0005-ceph-volume-lvm-api-function-no-undefined.patch @@ -0,0 +1,32 @@ +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 +(cherry picked from commit a5e4216b49704783c55fb83b3ae6dde35b0082ad) +diff --git a/ceph-16.2.7-code/ceph_code/ceph/src/ceph-volume/ceph_volume/api/lvm.py b/openeuler-ceph-16.2.7-code/ceph_dev/src/ceph-volume/ceph_volume/api/lvm.py +index e555120..bbafa06 100644 +--- a/ceph-16.2.7-code/ceph_code/ceph/src/ceph-volume/ceph_volume/api/lvm.py ++++ b/openeuler-ceph-16.2.7-code/ceph_dev/src/ceph-volume/ceph_volume/api/lvm.py +@@ -1163,7 +1163,7 @@ def get_lv_by_fullname(full_name): + """ + try: + vg_name, lv_name = full_name.split('/') +- res_lv = get_first_lv(filters={'lv_name': lv_name, ++ res_lv = get_single_lv(filters={'lv_name': lv_name, + 'vg_name': vg_name}) + except ValueError: + res_lv = None diff --git a/ceph.spec b/ceph.spec index c5495707e58445ac2c17beed0b48d03f62ce2faa..1337b7390e6cf6b89eadfd368985ee5479e9368a 100644 --- a/ceph.spec +++ b/ceph.spec @@ -147,6 +147,7 @@ Patch1: 0001-fix-error-transform-is-not-a-member-of-std.patch Patch2: 0002-enable-install-deps-in-openEuler.patch Patch3: 0003-isa-l-update.patch Patch4: 0004-cmake-add-support-python-3.10.patch +Patch5: 0005-ceph-volume-lvm-api-function-no-undefined.patch %if 0%{?suse_version} # _insert_obs_source_lines_here ExclusiveArch: x86_64 aarch64 ppc64le s390x @@ -2485,6 +2486,9 @@ exit 0 %config %{_sysconfdir}/prometheus/ceph/ceph_default_alerts.yml %changelog +* Mon Jul 18 2022 yangxiaoliang - 2:16.2.7-4 +- fix ceph-volume lvm api function undefined error + * Fri Mar 11 2022 wangzengliang - 2:16.2.7-3 - cmake: add support python 3.10