![Joao Pedro Alexandroni](/assets/img/avatar_default.png)
There were a few missing white spaces, so the patch 11 could not be applied correctly TEST PLAN: PASS: Patch 11 applied correctly Closes-bug: #1975725 Signed-off-by: Joao Pedro Alexandroni <JoaoPedroAlexandroni.CordovadeSouza@windriver.com> Change-Id: I3b9ec6a2245ecee358e32ccd12dfa26d51f84af5
135 lines
5.3 KiB
Diff
135 lines
5.3 KiB
Diff
From 1259ec9c739e1e6032df5cc5ebb104ba1709bf5b Mon Sep 17 00:00:00 2001
|
|
From: Joao Pedro Alexandroni
|
|
<JoaoPedroAlexandroni.CordovadeSouza@windriver.com>
|
|
Date: Wed, 25 May 2022 14:40:46 -0300
|
|
Subject: [PATCH] osd add support for mpath
|
|
|
|
The device node in /dev/ and device path in /dev/disk/by-path
|
|
can not be used directly for mpath devices, use /dev/mapper/mpathN
|
|
and /dev/disk/by-id/dm-uuid-mpath-<WWID> instead and change the
|
|
scripts in osd.pp accordingly.
|
|
|
|
Signed-off-by: Joao Pedro Alexandroni <JoaoPedroAlexandroni.CordovadeSouza@windriver.com>
|
|
---
|
|
manifests/osd.pp | 55 ++++++++++++++++++++++++++++++++++++++++--------
|
|
1 file changed, 46 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/manifests/osd.pp b/manifests/osd.pp
|
|
index ab65924..098b69e 100644
|
|
--- a/manifests/osd.pp
|
|
+++ b/manifests/osd.pp
|
|
@@ -138,8 +138,14 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
|
|
|
|
command => "/bin/true # comment to satisfy puppet syntax requirements
|
|
set -ex
|
|
-disk=$(readlink -f ${data})
|
|
-ceph-disk --verbose --log-stdout prepare --filestore ${cluster_uuid_option} ${uuid_option} ${osdid_option} --fs-type xfs --zap-disk \${disk} $(readlink -f ${journal})
|
|
+if [[ ${data} == *mpath* ]]; then
|
|
+ disk=$(find -L /dev/mapper/ -samefile ${data})
|
|
+ journal_part=${journal}
|
|
+else
|
|
+ disk=$(readlink -f ${data})
|
|
+ test -z ${journal} || journal_part=$(readlink -f ${journal})
|
|
+fi
|
|
+ceph-disk --verbose --log-stdout prepare --filestore ${cluster_uuid_option} ${uuid_option} ${osdid_option} --fs-type xfs --zap-disk \${disk} \${journal_part}
|
|
mkdir -p /var/lib/ceph/osd/ceph-${osdid}
|
|
ceph auth del osd.${osdid} || true
|
|
part=\${disk}
|
|
@@ -148,7 +154,11 @@ if [[ \$part == *nvme* ]]; then
|
|
else
|
|
part=\${part}1
|
|
fi
|
|
-mount $(readlink -f \${part}) /var/lib/ceph/osd/ceph-${osdid}
|
|
+if [[ ${data} == *mpath* ]]; then
|
|
+ mount \${part} /var/lib/ceph/osd/ceph-${osdid}
|
|
+else
|
|
+ mount $(readlink -f \${part}) /var/lib/ceph/osd/ceph-${osdid}
|
|
+fi
|
|
ceph-osd --id ${osdid} --mkfs --mkkey --mkjournal
|
|
ceph auth add osd.${osdid} osd 'allow *' mon 'allow rwx' -i /var/lib/ceph/osd/ceph-${osdid}/keyring
|
|
umount /var/lib/ceph/osd/ceph-${osdid}
|
|
@@ -158,7 +168,14 @@ 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 -ex
|
|
+if [[ ${data} == *mpath* ]]; then
|
|
+ ceph-disk list --format json ${data}| grep '\"type\": \"data\"'| grep '\"uuid\": \"${uuid}\"'
|
|
+else
|
|
+ ceph-disk list | grep -v 'unknown cluster' | grep \" *$(readlink -f ${data}).*ceph data\" | grep -v unprepared | grep 'osd uuid ${uuid}'
|
|
+fi
|
|
+",
|
|
|
|
logoutput => true,
|
|
timeout => $exec_timeout,
|
|
@@ -182,7 +199,11 @@ restorecon -R $(readlink -f ${data})
|
|
exec { $ceph_activate:
|
|
command => "/bin/true # comment to satisfy puppet syntax requirements
|
|
set -ex
|
|
-disk=$(readlink -f ${data})
|
|
+if [[ ${data} == *mpath* ]]; then
|
|
+ disk=$(find -L /dev/mapper/ -samefile ${data})
|
|
+else
|
|
+ disk=$(readlink -f ${data})
|
|
+fi
|
|
if ! test -b \$disk ; then
|
|
echo \$disk | egrep -e '^/dev' -q -v
|
|
mkdir -p \$disk
|
|
@@ -217,7 +238,11 @@ ls -ld /var/lib/ceph/osd/${cluster_name}-* | grep \" $(readlink -f ${data})\$\"
|
|
exec { "remove-osd-${name}":
|
|
command => "/bin/true # comment to satisfy puppet syntax requirements
|
|
set -ex
|
|
-disk=$(readlink -f ${data})
|
|
+if [[ ${data} == *mpath* ]]; then
|
|
+ disk=$(find -L /dev/mapper/ -samefile ${data})
|
|
+else
|
|
+ disk=$(readlink -f ${data})
|
|
+fi
|
|
part=\${disk}
|
|
if [[ \${part} == *nvme* ]]; then
|
|
part=\${part}p1
|
|
@@ -225,7 +250,11 @@ 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\")
|
|
+ if [[ ${data} == *mpath* ]]; then
|
|
+ id=$(ceph-disk list --format json ${data} | sed -n 's/.*\"whoami\": \"\\([0-9]\\+\\)\".*/\\1/p')
|
|
+ else
|
|
+ id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
|
|
+ fi
|
|
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)
|
|
@@ -244,7 +273,11 @@ fi
|
|
",
|
|
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
|
set -ex
|
|
-disk=$(readlink -f ${data})
|
|
+if [[ ${data} == *mpath* ]]; then
|
|
+ disk=$(find -L /dev/mapper/ -samefile ${data})
|
|
+else
|
|
+ disk=$(readlink -f ${data})
|
|
+fi
|
|
part=${disk}
|
|
if [[ \$part == *nvme* ]]; then
|
|
part=\${part}p1
|
|
@@ -252,7 +285,11 @@ 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\")
|
|
+ if [[ ${data} == *mpath* ]]; then
|
|
+ id=$(ceph-disk list --format json ${data} | sed -n 's/.*\"whoami\": \"\\([0-9]\\+\\)\".*/\\1/p')
|
|
+ else
|
|
+ id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
|
|
+ fi
|
|
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)
|
|
--
|
|
2.36.1
|
|
|