integ/config/puppet-modules/openstack/puppet-ceph-2.2.0/centos/patches/0009-fix-ceph-osd-disk-partition-for-nvme-disks.patch
Changcheng Liu e6ddff6eb0 puppet-ceph: osd use filestore and configured id
* integrate create filestore OSD patch
    The ceph-disk default create bluestore in mimic version.
    For maximize compability, still create filestore OSD here.

* prepare osd to be started via init script
    use osd id already configured in the database
    instead of generating a new one

* fix ceph osd disk partition for nvme disks

Story: 2003605

Depends-On: Ic9c4aed8dbab5d3e141cf9c1b2b1892731b14779
Change-Id: Iaa3319a7647e5622037d12c53673da0e4199ceb4
Co-Authored-By: Daniel Badea <daniel.badea@intel.com>
Signed-off-by: Changcheng Liu <changcheng.liu@intel.com>
Signed-off-by: Daniel Badea <daniel.badea@windriver.com>
2019-04-26 00:33:52 +00:00

90 lines
3.5 KiB
Diff

From b0dd34d2d580c817f9ef6eb62927ba63bebe73c3 Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Thu, 25 Apr 2019 15:37:53 +0000
Subject: [PATCH] fix ceph osd disk partition for nvme disks
---
manifests/osd.pp | 38 +++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/manifests/osd.pp b/manifests/osd.pp
index c51a445..5bd30c5 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -138,10 +138,17 @@ 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
-ceph-disk --verbose --log-stdout prepare --filestore ${cluster_uuid_option} ${uuid_option} ${osdid_option} --fs-type xfs --zap-disk $(readlink -f ${data}) $(readlink -f ${journal})
+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})
mkdir -p /var/lib/ceph/osd/ceph-${osdid}
ceph auth del osd.${osdid} || true
-mount $(readlink -f ${data})1 /var/lib/ceph/osd/ceph-${osdid}
+part=\${disk}
+if [[ \$part == *nvme* ]]; then
+ part=\${part}p1
+else
+ part=\${part}1
+fi
+mount $(readlink -f \${part}) /var/lib/ceph/osd/ceph-${osdid}
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}
@@ -183,12 +190,17 @@ if ! test -b \$disk ; then
chown -h ceph:ceph \$disk
fi
fi
-# activate happens via udev when using the entire device
+part=\${disk}
+if [[ \${part} == *nvme* ]]; then
+ part=\${part}p1
+else
+ part=\${part}1
+fi
if ! test -b \$disk || ! test -b \${disk}1 || ! test -b \${disk}p1 ; then
- ceph-disk activate \${disk}1 || true
+ ceph-disk activate \${part} || true
fi
if test -f ${udev_rules_file}.disabled && ( test -b \${disk}1 || test -b \${disk}p1 ); then
- ceph-disk activate \${disk}1 || true
+ ceph-disk activate \${part} || true
fi
",
unless => "/bin/true # comment to satisfy puppet syntax requirements
@@ -206,8 +218,14 @@ ls -ld /var/lib/ceph/osd/${cluster_name}-* | grep \" $(readlink -f ${data})\$\"
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f ${data})
+part=\${disk}
+if [[ \${part} == *nvme* ]]; then
+ part=\${part}p1
+else
+ part=\${part}1
+fi
if [ -z \"\$id\" ] ; then
- id=$(ceph-disk list | sed -nEe \"s:^ *\${disk}1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
+ id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([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)
@@ -227,8 +245,14 @@ fi
unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f ${data})
+part=${disk}
+if [[ \$part == *nvme* ]]; then
+ part=\${part}p1
+else
+ part=\${part}1
+fi
if [ -z \"\$id\" ] ; then
- id=$(ceph-disk list | sed -nEe \"s:^ *\${disk}1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
+ id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([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)
--
1.8.3.1