From 28734856c1f8d2f202b7429ccb8326146c3594a7 Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Mon, 18 Jul 2022 15:13:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9ceph-volume=20lvm=20api?= =?UTF-8?q?=20get=5Ffirst=5Flv=20=E5=87=BD=E6=95=B0=E6=9C=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...volume-lvm-api-function-no-undefined.patch | 32 +++++++++++++++++++ ceph.spec | 4 +++ 2 files changed, 36 insertions(+) create mode 100644 0005-ceph-volume-lvm-api-function-no-undefined.patch 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 0000000..7ba6cc5 --- /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 c549570..44e85fd 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 - 1:16.2.7 +- fix ceph-volume lvm api function undefined error + * Fri Mar 11 2022 wangzengliang - 2:16.2.7-3 - cmake: add support python 3.10 -- Gitee From 7b6e8102d9210cfd04f86175f01be38b5122b261 Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Mon, 18 Jul 2022 07:47:46 +0000 Subject: [PATCH 2/2] update ceph.spec. --- ceph.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ceph.spec b/ceph.spec index 44e85fd..1337b73 100644 --- a/ceph.spec +++ b/ceph.spec @@ -2486,7 +2486,7 @@ exit 0 %config %{_sysconfdir}/prometheus/ceph/ceph_default_alerts.yml %changelog -* Mon Jul 18 2022 yangxiaoliang - 1:16.2.7 +* 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 -- Gitee