1 From b0dd34d2d580c817f9ef6eb62927ba63bebe73c3 Mon Sep 17 00:00:00 2001
2 From: Daniel Badea <daniel.badea@windriver.com>
3 Date: Thu, 25 Apr 2019 15:37:53 +0000
4 Subject: [PATCH] fix ceph osd disk partition for nvme disks
7 manifests/osd.pp | 38 +++++++++++++++++++++++++++++++-------
8 1 file changed, 31 insertions(+), 7 deletions(-)
10 diff --git a/manifests/osd.pp b/manifests/osd.pp
11 index c51a445..5bd30c5 100644
12 --- a/manifests/osd.pp
13 +++ b/manifests/osd.pp
14 @@ -138,10 +138,17 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
16 command => "/bin/true # comment to satisfy puppet syntax requirements
18 -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})
19 +disk=$(readlink -f ${data})
20 +ceph-disk --verbose --log-stdout prepare --filestore ${cluster_uuid_option} ${uuid_option} ${osdid_option} --fs-type xfs --zap-disk \${disk} $(readlink -f ${journal})
21 mkdir -p /var/lib/ceph/osd/ceph-${osdid}
22 ceph auth del osd.${osdid} || true
23 -mount $(readlink -f ${data})1 /var/lib/ceph/osd/ceph-${osdid}
25 +if [[ \$part == *nvme* ]]; then
30 +mount $(readlink -f \${part}) /var/lib/ceph/osd/ceph-${osdid}
31 ceph-osd --id ${osdid} --mkfs --mkkey --mkjournal
32 ceph auth add osd.${osdid} osd 'allow *' mon 'allow rwx' -i /var/lib/ceph/osd/ceph-${osdid}/keyring
33 umount /var/lib/ceph/osd/ceph-${osdid}
34 @@ -183,12 +190,17 @@ if ! test -b \$disk ; then
35 chown -h ceph:ceph \$disk
38 -# activate happens via udev when using the entire device
40 +if [[ \${part} == *nvme* ]]; then
45 if ! test -b \$disk || ! test -b \${disk}1 || ! test -b \${disk}p1 ; then
46 - ceph-disk activate \${disk}1 || true
47 + ceph-disk activate \${part} || true
49 if test -f ${udev_rules_file}.disabled && ( test -b \${disk}1 || test -b \${disk}p1 ); then
50 - ceph-disk activate \${disk}1 || true
51 + ceph-disk activate \${part} || true
54 unless => "/bin/true # comment to satisfy puppet syntax requirements
55 @@ -206,8 +218,14 @@ ls -ld /var/lib/ceph/osd/${cluster_name}-* | grep \" $(readlink -f ${data})\$\"
56 command => "/bin/true # comment to satisfy puppet syntax requirements
58 disk=$(readlink -f ${data})
60 +if [[ \${part} == *nvme* ]]; then
65 if [ -z \"\$id\" ] ; then
66 - id=$(ceph-disk list | sed -nEe \"s:^ *\${disk}1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
67 + id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
69 if [ -z \"\$id\" ] ; then
70 id=$(ls -ld /var/lib/ceph/osd/${cluster_name}-* | sed -nEe \"s:.*/${cluster_name}-([0-9]+) *-> *\${disk}\$:\\1:p\" || true)
71 @@ -227,8 +245,14 @@ fi
72 unless => "/bin/true # comment to satisfy puppet syntax requirements
74 disk=$(readlink -f ${data})
76 +if [[ \$part == *nvme* ]]; then
81 if [ -z \"\$id\" ] ; then
82 - id=$(ceph-disk list | sed -nEe \"s:^ *\${disk}1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
83 + id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
85 if [ -z \"\$id\" ] ; then
86 id=$(ls -ld /var/lib/ceph/osd/${cluster_name}-* | sed -nEe \"s:.*/${cluster_name}-([0-9]+) *-> *\${disk}\$:\\1:p\" || true)