puppet-ceph: 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.

Test Plan:
PASS - AIO-SX: HPE multipath install/bootstrap/unlock
PASS - AIO-SX: Qemu virtual multipath install/bootstrap/unlock
PASS - AIO-DX: Qemu virtual multipath install/bootstrap/unlock
PASS - AIO-DX+: Qemu virtual multipath install/bootstrap/unlock
PASS - 2+2 (controller storage): Qemu virtual multipath install/
bootstrap/unlock
PASS - 2+2+2 (dedicated storage): Qemu virtual multipath install/
bootstrap/unlock
PASS - Add OSD ceph storage configuration (AIO-SX)
PASS - Expand CGTS volume group using extra disk (Partition) (AIO-SX)
PASS - Expand CGTS volume group using extra disk (disk) (AIO-SX)
PASS - Add nova local volume group using extra disk (AIO-SX)
PASS - App pod that alocates and writes into a PVC (AIO-SX)
PASS - Local disk Commands (Disk API) - AIO-SX/DX
- host-disk-list
- host-disk-show
- host-disk-partition-list
- host-disk-partition-show
- host-pv-list
- host-pv-show
- host-stor-list
- host-stor-show
- host-lvg-list
- host-lvg-show
- host-pv-add
PASS - Create nova-local volume group
PASS - Local disk Commands on AIO-DX after swact

Regression:
PASS - AIO-SX: Non-multipath install/bootstrap/unlock (NVME)
PASS - AIO-DX: Non-multipath install/bootstrap/unlock (SSD)
PASS - 2+2: Non-multipath install/bootstrap/unlock (SSD)
PASS - 2+2+2 : Non-multipath install/bootstrap/unlock (SSD and HD)
PASS - Distributed cloud: Non-multipath install/bootstrap/unlock

Depends-On: https://review.opendev.org/c/starlingx/tools/+/860590
Story: 2010046
Task: 47201
Signed-off-by: Robert Church <robert.church@windriver.com>
Change-Id: Ibdeab472c6b38684438bf5e7f695865f3e9ecba1
Signed-off-by: Matheus Guilhermino <matheus.machadoguilhermino@windriver.com>
This commit is contained in:
Robert Church 2023-01-21 07:44:17 -06:00 committed by Matheus Guilhermino
parent c13cd3cf54
commit 66572c9207
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