Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-support / puppet / files / puppet-ceph / 0009-fix-ceph-osd-disk-partition-for-nvme-disks.patch
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
5
6 ---
7  manifests/osd.pp | 38 +++++++++++++++++++++++++++++++-------
8  1 file changed, 31 insertions(+), 7 deletions(-)
9
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
15  
16          command   => "/bin/true # comment to satisfy puppet syntax requirements
17  set -ex
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}
24 +part=\${disk}
25 +if [[ \$part == *nvme* ]]; then
26 +   part=\${part}p1
27 +else 
28 +   part=\${part}1
29 +fi
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
36      fi
37  fi
38 -# activate happens via udev when using the entire device
39 +part=\${disk}
40 +if [[ \${part} == *nvme* ]]; then
41 +   part=\${part}p1
42 +else 
43 +   part=\${part}1
44 +fi
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
48  fi
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
52  fi
53  ",
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
57  set -ex
58  disk=$(readlink -f ${data})
59 +part=\${disk}
60 +if [[ \${part} == *nvme* ]]; then
61 +   part=\${part}p1
62 +else 
63 +   part=\${part}1
64 +fi
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\")
68  fi
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
73  set -ex
74  disk=$(readlink -f ${data})
75 +part=${disk}
76 +if [[ \$part == *nvme* ]]; then
77 +   part=\${part}p1
78 +else 
79 +   part=\${part}1
80 +fi
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\")
84  fi
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)
87 -- 
88 1.8.3.1
89