Merge "puppet-ceph: Add multipath disk support"

This commit is contained in:
Zuul 2023-02-15 15:59:36 +00:00 committed by Gerrit Code Review
commit 2a258e8906
2 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,79 @@
From: Matheus Guilhermino <matheus.machadoguilhermino@windriver.com>
Date: Mon, 13 Feb 2023 16:41:29 -0300
Subject: Add multipath disk support
To support multipath devices, detect when a persistent device name
evaluates to a device mapper device and derive the data partition based on
what is required by the subsequent command.
Fix parsing of 'ceph-disk list' output so that it properly identifies
the OSD.
Signed-off-by: Robert Church <robert.church@windriver.com>
Signed-off-by: Matheus Guilhermino <matheus.machadoguilhermino@windriver.com>
---
manifests/osd.pp | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/manifests/osd.pp b/manifests/osd.pp
index 8baa49a..f77e851 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -143,7 +143,9 @@ ceph-disk --verbose --log-stdout prepare --filestore ${cluster_uuid_option} ${u
mkdir -p /var/lib/ceph/osd/ceph-${osdid}
ceph auth del osd.${osdid} || true
part=\${disk}
-if [[ \$part == *nvme* ]]; then
+if [[ \${disk} == *dm-* ]]; then
+ part=${data}-part1
+elif [[ \${part} == *nvme* ]]; then
part=\${part}p1
else
part=\${part}1
@@ -191,7 +193,9 @@ if ! test -b \$disk ; then
fi
fi
part=\${disk}
-if [[ \${part} == *nvme* ]]; then
+if [[ \${disk} == *dm-* ]]; then
+ part=${data}-part1
+elif [[ \${part} == *nvme* ]]; then
part=\${part}p1
else
part=\${part}1
@@ -219,13 +223,15 @@ ls -ld /var/lib/ceph/osd/${cluster_name}-* | grep \" $(readlink -f ${data})\$\"
set -ex
disk=$(readlink -f ${data})
part=\${disk}
-if [[ \${part} == *nvme* ]]; then
+if [[ \${disk} == *dm-* ]]; then
+ part=$(readlink -f ${data}-part1)
+elif [[ \${part} == *nvme* ]]; then
part=\${part}p1
else
part=\${part}1
fi
if [ -z \"\$id\" ] ; then
- id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
+ id=$(ceph-disk list | sed -nEe \"s:^ .*${part} .*(ceph data|mounted on).*osd/ceph-([0-9]+).*:\\2:p\")
fi
if [ -z \"\$id\" ] ; then
id=$(ls -ld /var/lib/ceph/osd/${cluster_name}-* | sed -nEe \"s:.*/${cluster_name}-([0-9]+) *-> *\${disk}\$:\\1:p\" || true)
@@ -246,13 +252,15 @@ fi
set -ex
disk=$(readlink -f ${data})
part=${disk}
-if [[ \$part == *nvme* ]]; then
+if [[ \${disk} == *dm-* ]]; then
+ part=${data}-part1
+elif [[ \${part} == *nvme* ]]; then
part=\${part}p1
else
part=\${part}1
fi
if [ -z \"\$id\" ] ; then
- id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
+ id=$(ceph-disk list | sed -nEe \"s:^ .*${part} .*(ceph data|mounted on).*osd/ceph-([0-9]+).*:\\2:p\")
fi
if [ -z \"\$id\" ] ; then
id=$(ls -ld /var/lib/ceph/osd/${cluster_name}-* | sed -nEe \"s:.*/${cluster_name}-([0-9]+) *-> *\${disk}\$:\\1:p\" || true)

View File

@ -7,4 +7,5 @@
0008-ceph-mimic-prepare-activate-osd.patch
0009-fix-ceph-osd-disk-partition-for-nvme-disks.patch
0010-wipe-unprepared-disks.patch
0011-Fix-service-parameter-passing.patch
0011-Fix-service-parameter-passing.patch
0012-Add-multipath-disk-support.patch