diff --git a/0006-ceph-volume-decrease-number-of-pvs-calls-in-lvm-list.patch b/0006-ceph-volume-decrease-number-of-pvs-calls-in-lvm-list.patch new file mode 100644 index 0000000000000000000000000000000000000000..f29a576c687e3494f294b18302e5882a200b3e73 --- /dev/null +++ b/0006-ceph-volume-decrease-number-of-pvs-calls-in-lvm-list.patch @@ -0,0 +1,66 @@ +From 1a38ea3b96dbe8fd2f2fca8ee9a501ef1423027f Mon Sep 17 00:00:00 2001 +From: Guillaume Abrioux +Date: Mon, 20 Jun 2022 13:43:43 +0200 +Subject: [PATCH] ceph-volume: decrease number of `pvs` calls in `lvm list` + +current implementation of `List.create_report()` implies a lot of calls +to `pvs` process. This could be avoided. + +current implementation: +``` +>>> import timeit +>>> from ceph_volume.devices.lvm.listing import List +>>> timeit.timeit(List([]).main, number=1000) + +... + +93.03700458299136 +``` + +new implementation: + +``` +>>> import timeit +>>> from ceph_volume.devices.lvm.listing import List +>>> timeit.timeit(List([]).main, number=1000) + +... + +62.16391600697534 +``` + +In this example, it improves performance by ~30% + +Fixes: https://tracker.ceph.com/issues/56127 + +Signed-off-by: Guillaume Abrioux +--- + src/ceph-volume/ceph_volume/devices/lvm/listing.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/ceph-volume/ceph_volume/devices/lvm/listing.py b/src/ceph-volume/ceph_volume/devices/lvm/listing.py +index 44d5063ce37..c16afdaa767 100644 +--- a/src/ceph-volume/ceph_volume/devices/lvm/listing.py ++++ b/src/ceph-volume/ceph_volume/devices/lvm/listing.py +@@ -101,6 +101,8 @@ class List(object): + + report = {} + ++ pvs = api.get_pvs() ++ + for lv in lvs: + if not api.is_ceph_device(lv): + continue +@@ -109,8 +111,7 @@ 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 [] ++ lv_report['devices'] = [pv.name for pv in pvs if pv.lv_uuid == lv.lv_uuid] if pvs else [] + report[osd_id].append(lv_report) + + phys_devs = self.create_report_non_lv_device(lv) +-- +2.33.0 + diff --git a/0007-add-judgment-for-ceph-volume-lvm-activate.patch b/0007-add-judgment-for-ceph-volume-lvm-activate.patch new file mode 100644 index 0000000000000000000000000000000000000000..16a67330e10143e096eee77ca28c78991084bca9 --- /dev/null +++ b/0007-add-judgment-for-ceph-volume-lvm-activate.patch @@ -0,0 +1,29 @@ +From 8a00d0cbd71650f95093f2ed46bf8c839059a6b1 Mon Sep 17 00:00:00 2001 +From: yangxiaoliang +Date: Thu, 25 Aug 2022 06:29:30 +0000 +Subject: [PATCH] ceph-volume: add judgment for lvm activate Signed-off-by: + yangxiaoliang + +--- + src/ceph-volume/ceph_volume/devices/lvm/activate.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py +index 70fceeab645..70c1c10355d 100644 +--- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py ++++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py +@@ -270,7 +270,10 @@ class Activate(object): + elif not osd_id and osd_fsid: + tags = {'ceph.osd_fsid': osd_fsid} + elif osd_id and not osd_fsid: +- raise RuntimeError('could not activate osd.{}, please provide the ' ++ if not osd_id.isdigit(): ++ tags = {'ceph.osd_fsid': osd_id} ++ else: ++ raise RuntimeError('could not activate osd.{}, please provide the ' + 'osd_fsid too'.format(osd_id)) + else: + raise RuntimeError('Please provide both osd_id and osd_fsid') +-- +2.33.0 + diff --git a/ceph.spec b/ceph.spec index f412f766cb828c9270cef223d7c8b86e5d0708f8..d786f7ca69b8cee0a1d0ce4708e3abbb50c0c48f 100644 --- a/ceph.spec +++ b/ceph.spec @@ -125,7 +125,7 @@ ################################################################################# Name: ceph Version: 16.2.7 -Release: 4 +Release: 6 %if 0%{?fedora} || 0%{?rhel} || 0%{?openEuler} Epoch: 2 %endif @@ -148,6 +148,8 @@ 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-ceph-volume-decrease-number-of-pvs-calls-in-lvm-list.patch +Patch7: 0007-add-judgment-for-ceph-volume-lvm-activate.patch %if 0%{?suse_version} # _insert_obs_source_lines_here ExclusiveArch: x86_64 aarch64 ppc64le s390x @@ -2486,6 +2488,16 @@ exit 0 %config %{_sysconfdir}/prometheus/ceph/ceph_default_alerts.yml %changelog +* Thu Aug 25 2022 yangxiaoliang - 2:16.2.7-6 +- add judgment for ceph-volume lvm activate + +<<<<<<< HEAD +* Mon Jul 25 2022 yangxiaoliang - 2:16.2.7-5 +======= +* Thu Aug 25 2022 yangxiaoliang - 2:16.2.7-5 +>>>>>>> 98b17e8... ceph-volume: add judgment for lvm activate +- fix ceph-volume lvm list calls many times pvs + * Mon Jul 18 2022 yangxiaoliang - 2:16.2.7-4 - fix ceph-volume lvm api function undefined error