Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-support / puppet / files / puppet-ceph / 0008-ceph-mimic-prepare-activate-osd.patch
1 From 4c2e2a196cb5a6890e35098c8499688fc1c26f5c Mon Sep 17 00:00:00 2001
2 From: Daniel Badea <daniel.badea@windriver.com>
3 Date: Thu, 4 Apr 2019 16:52:12 +0000
4 Subject: [PATCH] ceph-mimic-prepare-activate-osd
5
6 Prepare and activate disk using filestore
7 and given OSD id.
8 ---
9  manifests/osd.pp | 18 ++++++++++++++++--
10  1 file changed, 16 insertions(+), 2 deletions(-)
11
12 diff --git a/manifests/osd.pp b/manifests/osd.pp
13 index 889d28a..c51a445 100644
14 --- a/manifests/osd.pp
15 +++ b/manifests/osd.pp
16 @@ -54,6 +54,7 @@ define ceph::osd (
17    $cluster = undef,
18    $cluster_uuid = undef,
19    $uuid = undef,
20 +  $osdid = undef,
21    $exec_timeout = $::ceph::params::exec_timeout,
22    $selinux_file_context = 'ceph_var_lib_t',
23    $fsid = undef,
24 @@ -78,6 +79,10 @@ define ceph::osd (
25        $uuid_option = "--osd-uuid ${uuid}"
26      }
27  
28 +    if $osdid {
29 +      $osdid_option = "--osd-id ${osdid}"
30 +    }
31 +
32      if $ensure == present {
33  
34        $ceph_check_udev = "ceph-osd-check-udev-${name}"
35 @@ -131,7 +136,16 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
36        # ceph-disk: prepare should be idempotent http://tracker.ceph.com/issues/7475
37        exec { $ceph_prepare:
38  
39 -        command   => "/usr/sbin/ceph-disk --verbose --log-stdout prepare ${cluster_option} ${cluster_uuid_option} ${uuid_option} --fs-type xfs --zap-disk $(readlink -f ${data}) $(readlink -f ${journal})",
40 +        command   => "/bin/true # comment to satisfy puppet syntax requirements
41 +set -ex
42 +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})
43 +mkdir -p /var/lib/ceph/osd/ceph-${osdid}
44 +ceph auth del osd.${osdid} || true
45 +mount $(readlink -f ${data})1 /var/lib/ceph/osd/ceph-${osdid}
46 +ceph-osd --id ${osdid} --mkfs --mkkey --mkjournal
47 +ceph auth add osd.${osdid} osd 'allow *' mon 'allow rwx' -i /var/lib/ceph/osd/ceph-${osdid}/keyring
48 +umount /var/lib/ceph/osd/ceph-${osdid}
49 +",
50          # We don't want to erase the disk if:
51          # 1. There is already ceph data on the disk for our cluster AND
52          # 2. The uuid for the OSD we are configuring matches the uuid for the
53 @@ -171,7 +185,7 @@ if ! test -b \$disk ; then
54  fi
55  # activate happens via udev when using the entire device
56  if ! test -b \$disk || ! test -b \${disk}1 || ! test -b \${disk}p1 ; then
57 -  ceph-disk activate \$disk || true
58 +  ceph-disk activate \${disk}1 || true
59  fi
60  if test -f ${udev_rules_file}.disabled && ( test -b \${disk}1 || test -b \${disk}p1 ); then
61    ceph-disk activate \${disk}1 || true
62 -- 
63 1.8.3.1
64