From 0de8da2116a46405221ac6965c1f8b77c6ad47c8 Mon Sep 17 00:00:00 2001 From: Felipe Sanches Zanoni Date: Sat, 11 Mar 2023 11:47:02 -0300 Subject: [PATCH] Fix puppet-ceph multipath osd disk partition detection The puppet-ceph module is not correctly checking the OSD partition when it belongs to a multipath disk or any /dev/dm-X device. This fix changes the parsing string when running ceph-disk list command to verify osd disk is already created. Without multipath disk, the readlink command will return, for example, '/dev/sdb' for any partition of that disk. The output of ceph-disk is like: /dev/sdb : /dev/sdb1 ceph data, prepared, cluster ceph, osd.0, osd uuid e3c08a72-c755-4dec-b353-e4df4b4690c4, journal /dev/sdb2 /dev/sdb2 ceph journal, for /dev/sdb1 This way when grepping '/dev/sdb.*ceph data', it will detect the line with the partition '/dev/sdb1' with no errors. But with multipath disk the readlink command returns /dev/dm-X for disks and partitions. For example, it will return /dev/dm-6 when using /dev/dm-6 : /dev/dm-7 ceph data, prepared, cluster ceph, osd.0, osd uuid e3c08a72-c755-4dec-b353-e4df4b4690c4, journal /dev/dm-8 /dev/dm-8 ceph journal, for /dev/dm-7 This way when grepping '/dev/dm-6.*ceph data', it will not detect the line with the partition /dev/dm-7. Test-Plan: PASS: Fresh install AIO-SX with ceph backend and verify ceph is HEALTH_OK (with multipath disks) PASS: Lock/Unlock controller-0 and verify ceph is HEALTH_OK (with multipath disks) PASS: Fresh install AIO-SX with ceph backend and verify ceph is HEALTH_OK (with regular disks) PASS: Lock/Unlock controller-0 and verify ceph is HEALTH_OK (with regular disks) Closes-bug: 2009227 Signed-off-by: Felipe Sanches Zanoni Change-Id: Iad11c803b68983ad70fb1edfce5a9acc156a10f4 --- ...h-multipath-ceph-partition-detection.patch | 44 +++++++++++++++++++ .../puppet-ceph-2.4.1/debian/patches/series | 1 + 2 files changed, 45 insertions(+) create mode 100644 config/puppet-modules/openstack/puppet-ceph-2.4.1/debian/patches/0013-Fix-puppet-ceph-multipath-ceph-partition-detection.patch diff --git a/config/puppet-modules/openstack/puppet-ceph-2.4.1/debian/patches/0013-Fix-puppet-ceph-multipath-ceph-partition-detection.patch b/config/puppet-modules/openstack/puppet-ceph-2.4.1/debian/patches/0013-Fix-puppet-ceph-multipath-ceph-partition-detection.patch new file mode 100644 index 000000000..b4e2169c3 --- /dev/null +++ b/config/puppet-modules/openstack/puppet-ceph-2.4.1/debian/patches/0013-Fix-puppet-ceph-multipath-ceph-partition-detection.patch @@ -0,0 +1,44 @@ +From df61ca00f106f0dbf3a2add926d55d323ca6d941 Mon Sep 17 00:00:00 2001 +From: Felipe Sanches Zanoni +Date: Sat, 11 Mar 2023 10:35:01 -0300 +Subject: [PATCH] Fix puppet-ceph multipath ceph partition detection + +The puppet-ceph module is not correctly checking the OSD +partition when it belongs to a multipath disk or any /dev/dm-X +device. + +This fix changes the parsing string when running ceph-disk list +command to verify osd disk is already created. + +Signed-off-by: Felipe Sanches Zanoni +--- + manifests/osd.pp | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/manifests/osd.pp b/manifests/osd.pp +index f77e851..f97a3ab 100644 +--- a/manifests/osd.pp ++++ b/manifests/osd.pp +@@ -160,8 +160,17 @@ umount /var/lib/ceph/osd/ceph-${osdid} + # 2. The uuid for the OSD we are configuring matches the uuid for the + # OSD on the disk. We don't want to attempt to re-use an OSD that + # had previously been deleted. +- unless => "/usr/sbin/ceph-disk list | grep -v 'unknown cluster' | grep \" *$(readlink -f ${data}).*ceph data\" | grep -v unprepared | grep 'osd uuid ${uuid}'", +- ++ unless => "/bin/true # comment to satisfy puppet syntax requirements ++set -e ++disk=$(readlink -f ${data}) ++# If disk is multipath, must add partition number at the end of string. ++if [[ \${disk} == *dm-* ]]; then ++ ceph_part=${data}-part1 ++else ++ ceph_part=${data} ++fi ++/usr/sbin/ceph-disk list | grep -v 'unknown cluster' | grep \" *$(readlink -f \${ceph_part}).*ceph data\" | grep -v unprepared | grep 'osd uuid ${uuid}' ++", + logoutput => true, + timeout => $exec_timeout, + tag => 'prepare', +-- +2.25.1 + diff --git a/config/puppet-modules/openstack/puppet-ceph-2.4.1/debian/patches/series b/config/puppet-modules/openstack/puppet-ceph-2.4.1/debian/patches/series index d4d3a67cf..ab677bf59 100644 --- a/config/puppet-modules/openstack/puppet-ceph-2.4.1/debian/patches/series +++ b/config/puppet-modules/openstack/puppet-ceph-2.4.1/debian/patches/series @@ -9,3 +9,4 @@ 0010-wipe-unprepared-disks.patch 0011-Fix-service-parameter-passing.patch 0012-Add-multipath-disk-support.patch +0013-Fix-puppet-ceph-multipath-ceph-partition-detection.patch