From 315127f83266dbcd71f48122967b9370d4e1dc15 Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Wed, 13 Jul 2022 16:28:05 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9ceph-volume=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=EF=BC=8Clvm=20api=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 --- ...-ceph-volume-lvm-api-function-no-undefined.patch | 13 +++++++++++++ 1 file changed, 13 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..8249e91 --- /dev/null +++ b/0005-ceph-volume-lvm-api-function-no-undefined.patch @@ -0,0 +1,13 @@ +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 -- Gitee From fbf55e4310b9bfb4339790c6020c20ba26d18435 Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Fri, 15 Jul 2022 15:12:17 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BC=98=E5=8C=96ceph-volume=20lvm=20list?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E5=93=8D=E5=BA=94=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0006-speed_up_ceph-volume_lvm_list.patch | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 0006-speed_up_ceph-volume_lvm_list.patch diff --git a/0006-speed_up_ceph-volume_lvm_list.patch b/0006-speed_up_ceph-volume_lvm_list.patch new file mode 100644 index 0000000..987687b --- /dev/null +++ b/0006-speed_up_ceph-volume_lvm_list.patch @@ -0,0 +1,24 @@ +diff --git a/src/ceph-volume/ceph_volume/devices/lvm/listing.py b/src/ceph-volume/ceph_volume/devices/lvm/listing.py +index 1ae8489f6fc..9dcbe5509a5 100644 +--- a/src/ceph-volume/ceph_volume/devices/lvm/listing.py ++++ b/src/ceph-volume/ceph_volume/devices/lvm/listing.py +@@ -101,7 +101,7 @@ class List(object): + """ + + report = {} +- ++ pvs_all = get_pvs() + for lv in lvs: + if not api.is_ceph_device(lv): + continue +@@ -110,8 +110,8 @@ class List(object): + report.setdefault(osd_id, []) + lv_report = lv.as_dict() + +- pvs = api.get_pvs(filters={'lv_uuid': lv.lv_uuid}) +- lv_report['devices'] = [pv.name for pv in pvs] if pvs else [] ++ #pvs = api.get_pvs(filters={'lv_uuid': lv.lv_uuid}) ++ lv_report['devices'] = [pv.name for pv in pvs_all if pv.lv_uuid == lv_uuid] if pvs_all else [] + report[osd_id].append(lv_report) + + phys_devs = self.create_report_non_lv_device(lv) -- Gitee From 796199582e80b30cca71ab4ec028dd4c4bd57025 Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Fri, 15 Jul 2022 07:53:59 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=200006?= =?UTF-8?q?-speed=5Fup=5Fceph-volume=5Flvm=5Flist.patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0006-speed_up_ceph-volume_lvm_list.patch | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 0006-speed_up_ceph-volume_lvm_list.patch diff --git a/0006-speed_up_ceph-volume_lvm_list.patch b/0006-speed_up_ceph-volume_lvm_list.patch deleted file mode 100644 index 987687b..0000000 --- a/0006-speed_up_ceph-volume_lvm_list.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/src/ceph-volume/ceph_volume/devices/lvm/listing.py b/src/ceph-volume/ceph_volume/devices/lvm/listing.py -index 1ae8489f6fc..9dcbe5509a5 100644 ---- a/src/ceph-volume/ceph_volume/devices/lvm/listing.py -+++ b/src/ceph-volume/ceph_volume/devices/lvm/listing.py -@@ -101,7 +101,7 @@ class List(object): - """ - - report = {} -- -+ pvs_all = get_pvs() - for lv in lvs: - if not api.is_ceph_device(lv): - continue -@@ -110,8 +110,8 @@ class List(object): - report.setdefault(osd_id, []) - lv_report = lv.as_dict() - -- pvs = api.get_pvs(filters={'lv_uuid': lv.lv_uuid}) -- lv_report['devices'] = [pv.name for pv in pvs] if pvs else [] -+ #pvs = api.get_pvs(filters={'lv_uuid': lv.lv_uuid}) -+ lv_report['devices'] = [pv.name for pv in pvs_all if pv.lv_uuid == lv_uuid] if pvs_all else [] - report[osd_id].append(lv_report) - - phys_devs = self.create_report_non_lv_device(lv) -- Gitee From 18eef405f07174764da8c71befd63543c6bc1a0a Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Mon, 18 Jul 2022 01:43:04 +0000 Subject: [PATCH 4/8] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=200005?= =?UTF-8?q?-ceph-volume-lvm-api-function-no-undefined.patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-ceph-volume-lvm-api-function-no-undefined.patch | 13 ------------- 1 file changed, 13 deletions(-) delete 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 deleted file mode 100644 index 8249e91..0000000 --- a/0005-ceph-volume-lvm-api-function-no-undefined.patch +++ /dev/null @@ -1,13 +0,0 @@ -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 -- Gitee From 08b5b92434dbf6e88f390aabcdbf07aaeaf142fe Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Mon, 18 Jul 2022 10:00:47 +0800 Subject: [PATCH 5/8] fix ceph-volume lvm api function undefined error --- ...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 13b6b0b61d6e185294975bbc783ea8b4ce67cb72 Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Mon, 18 Jul 2022 11:31:59 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=A7=A3=E5=86=B3ceph-volume=20list=20?= =?UTF-8?q?=E5=A4=9A=E6=AC=A1=E8=B0=83=E7=94=A8pvs=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0006-lvm-list-pvs.patch | 42 +++++++++++++++++++++++++++++++++++++++++ ceph.spec | 4 ++++ 2 files changed, 46 insertions(+) create mode 100644 0006-lvm-list-pvs.patch diff --git a/0006-lvm-list-pvs.patch b/0006-lvm-list-pvs.patch new file mode 100644 index 0000000..985383e --- /dev/null +++ b/0006-lvm-list-pvs.patch @@ -0,0 +1,42 @@ +From e3a715977c576b901a14ae40744bf66c611c777e Mon Sep 17 00:00:00 2001 +From: yangxiaoliang <154920043@qq.com> +Date: Mon, 18 Jul 2022 11:22:27 +0800 +Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96lvm=20list=EF=BC=8C=E5=87=8F?= + =?UTF-8?q?=E5=B0=91pvs=E8=B0=83=E7=94=A8=E6=AC=A1=E6=95=B0=EF=BC=8C?= + =?UTF-8?q?=E7=BC=A9=E7=9F=AD=E5=93=8D=E5=BA=94=E6=97=B6=E9=97=B4?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + src/ceph-volume/ceph_volume/devices/lvm/listing.py | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/ceph-volume/ceph_volume/devices/lvm/listing.py b/src/ceph-volume/ceph_volume/devices/lvm/listing.py +index 1ae8489f6..52502577b 100644 +--- a/src/ceph-volume/ceph_volume/devices/lvm/listing.py ++++ b/src/ceph-volume/ceph_volume/devices/lvm/listing.py +@@ -101,7 +101,7 @@ class List(object): + """ + + report = {} +- ++ pvs_all = api.get_pvs() + for lv in lvs: + if not api.is_ceph_device(lv): + continue +@@ -110,8 +110,9 @@ class List(object): + report.setdefault(osd_id, []) + lv_report = lv.as_dict() + +- pvs = api.get_pvs(filters={'lv_uuid': lv.lv_uuid}) +- lv_report['devices'] = [pv.name for pv in pvs] if pvs else [] ++ #pvs = api.get_pvs(filters={'lv_uuid': lv.lv_uuid}) ++ #lv_report['devices'] = [pv.name for pv in pvs] if pvs else [] ++ lv_report['devices'] = [pv.name for pv in pvs_all if pv.lv_uuid == lv.lv_uuid] if pvs_all else [] + report[osd_id].append(lv_report) + + phys_devs = self.create_report_non_lv_device(lv) +-- +2.20.1 + diff --git a/ceph.spec b/ceph.spec index 44e85fd..d0b43cb 100644 --- a/ceph.spec +++ b/ceph.spec @@ -148,6 +148,7 @@ 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 +Patch6: 0006-lvm-list-pvs.patch %if 0%{?suse_version} # _insert_obs_source_lines_here ExclusiveArch: x86_64 aarch64 ppc64le s390x @@ -2486,6 +2487,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 list called pvs many times + * Mon Jul 18 2022 yangxiaoliang - 1:16.2.7 - fix ceph-volume lvm api function undefined error -- Gitee From fc0f59daa8d75a22a63ebc808daab2ebec252f1e Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Mon, 18 Jul 2022 03:36:46 +0000 Subject: [PATCH 7/8] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=200006?= =?UTF-8?q?-lvm-list-pvs.patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0006-lvm-list-pvs.patch | 42 ----------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 0006-lvm-list-pvs.patch diff --git a/0006-lvm-list-pvs.patch b/0006-lvm-list-pvs.patch deleted file mode 100644 index 985383e..0000000 --- a/0006-lvm-list-pvs.patch +++ /dev/null @@ -1,42 +0,0 @@ -From e3a715977c576b901a14ae40744bf66c611c777e Mon Sep 17 00:00:00 2001 -From: yangxiaoliang <154920043@qq.com> -Date: Mon, 18 Jul 2022 11:22:27 +0800 -Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96lvm=20list=EF=BC=8C=E5=87=8F?= - =?UTF-8?q?=E5=B0=91pvs=E8=B0=83=E7=94=A8=E6=AC=A1=E6=95=B0=EF=BC=8C?= - =?UTF-8?q?=E7=BC=A9=E7=9F=AD=E5=93=8D=E5=BA=94=E6=97=B6=E9=97=B4?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - src/ceph-volume/ceph_volume/devices/lvm/listing.py | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/src/ceph-volume/ceph_volume/devices/lvm/listing.py b/src/ceph-volume/ceph_volume/devices/lvm/listing.py -index 1ae8489f6..52502577b 100644 ---- a/src/ceph-volume/ceph_volume/devices/lvm/listing.py -+++ b/src/ceph-volume/ceph_volume/devices/lvm/listing.py -@@ -101,7 +101,7 @@ class List(object): - """ - - report = {} -- -+ pvs_all = api.get_pvs() - for lv in lvs: - if not api.is_ceph_device(lv): - continue -@@ -110,8 +110,9 @@ class List(object): - report.setdefault(osd_id, []) - lv_report = lv.as_dict() - -- pvs = api.get_pvs(filters={'lv_uuid': lv.lv_uuid}) -- lv_report['devices'] = [pv.name for pv in pvs] if pvs else [] -+ #pvs = api.get_pvs(filters={'lv_uuid': lv.lv_uuid}) -+ #lv_report['devices'] = [pv.name for pv in pvs] if pvs else [] -+ lv_report['devices'] = [pv.name for pv in pvs_all if pv.lv_uuid == lv.lv_uuid] if pvs_all else [] - report[osd_id].append(lv_report) - - phys_devs = self.create_report_non_lv_device(lv) --- -2.20.1 - -- Gitee From f493ca529e1914f45502f3696d818c946f12fe63 Mon Sep 17 00:00:00 2001 From: yangxiaoliang <154920043@qq.com> Date: Mon, 18 Jul 2022 03:38:51 +0000 Subject: [PATCH 8/8] update ceph.spec. --- ceph.spec | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ceph.spec b/ceph.spec index d0b43cb..44e85fd 100644 --- a/ceph.spec +++ b/ceph.spec @@ -148,7 +148,6 @@ 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 -Patch6: 0006-lvm-list-pvs.patch %if 0%{?suse_version} # _insert_obs_source_lines_here ExclusiveArch: x86_64 aarch64 ppc64le s390x @@ -2487,9 +2486,6 @@ exit 0 %config %{_sysconfdir}/prometheus/ceph/ceph_default_alerts.yml %changelog -* Mon Jul 18 2022 yangxiaoliang - 1:16.2.7 -- fix ceph-volume lvm list called pvs many times - * Mon Jul 18 2022 yangxiaoliang - 1:16.2.7 - fix ceph-volume lvm api function undefined error -- Gitee