Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-support / puppet / files / puppet-ceph / 0001-Roll-up-TIS-patches.patch
1 From ff98c42f0e6ce22969e986933d0a60d73a281a1d Mon Sep 17 00:00:00 2001
2 From: Don Penney <don.penney@windriver.com>
3 Date: Tue, 10 Jan 2017 13:31:17 -0500
4 Subject: [PATCH 1/5] Roll up TIS patches
5
6 ---
7  manifests/mon.pp | 14 +++++++++++---
8  manifests/osd.pp | 38 +++++++++++++++++++-------------------
9  manifests/rgw.pp |  7 +++++++
10  3 files changed, 37 insertions(+), 22 deletions(-)
11
12 diff --git a/manifests/mon.pp b/manifests/mon.pp
13 index bc0298c..fa99df5 100644
14 --- a/manifests/mon.pp
15 +++ b/manifests/mon.pp
16 @@ -65,6 +65,8 @@ define ceph::mon (
17    $authentication_type = 'cephx',
18    $key = undef,
19    $keyring  = undef,
20 +  $fsid = undef,
21 +  $service_ensure = 'running',
22    $exec_timeout = $::ceph::params::exec_timeout,
23    ) {
24  
25 @@ -154,6 +156,10 @@ test -e \$mon_data/done
26          }
27        }
28  
29 +      if $fsid {
30 +        $fsid_option = "--fsid ${fsid}"
31 +      }
32 +
33        Ceph_config<||>
34        # prevent automatic creation of the client.admin key by ceph-create-keys
35        -> exec { "ceph-mon-${cluster_name}.client.admin.keyring-${id}":
36 @@ -176,7 +182,8 @@ if [ ! -d \$mon_data ] ; then
37                --setuser ceph --setgroup ceph \
38                --mkfs \
39                --id ${id} \
40 -              --keyring ${keyring_path} ; then
41 +              --keyring ${keyring_path} \
42 +              ${fsid_option} ; then
43              touch \$mon_data/done \$mon_data/${init} \$mon_data/keyring
44              chown -h ceph:ceph \$mon_data/done \$mon_data/${init} \$mon_data/keyring
45          else
46 @@ -186,7 +193,8 @@ if [ ! -d \$mon_data ] ; then
47          if ceph-mon ${cluster_option} \
48                --mkfs \
49                --id ${id} \
50 -              --keyring ${keyring_path} ; then
51 +              --keyring ${keyring_path} \
52 +              ${fsid_option} ; then
53              touch \$mon_data/done \$mon_data/${init} \$mon_data/keyring
54          else
55              rm -fr \$mon_data
56 @@ -203,7 +211,7 @@ test -d  \$mon_data
57          timeout   => $exec_timeout,
58        }
59        -> service { $mon_service:
60 -        ensure => running,
61 +        ensure => $service_ensure,
62        }
63  
64        # if the service is running before we setup the configs, notify service
65 diff --git a/manifests/osd.pp b/manifests/osd.pp
66 index d24b95e..9b8cd99 100644
67 --- a/manifests/osd.pp
68 +++ b/manifests/osd.pp
69 @@ -52,6 +52,8 @@ define ceph::osd (
70    $ensure = present,
71    $journal = "''",
72    $cluster = undef,
73 +  $cluster_uuid = undef,
74 +  $uuid = undef,
75    $exec_timeout = $::ceph::params::exec_timeout,
76    $selinux_file_context = 'ceph_var_lib_t',
77    $fsid = $::ceph::profile::params::fsid,
78 @@ -68,6 +70,14 @@ define ceph::osd (
79      }
80      $cluster_option = "--cluster ${cluster_name}"
81  
82 +    if $cluster_uuid {
83 +      $cluster_uuid_option = "--cluster-uuid ${cluster_uuid}"
84 +    }
85 +
86 +    if $uuid {
87 +      $uuid_option = "--osd-uuid ${uuid}"
88 +    }
89 +
90      if $ensure == present {
91  
92        $ceph_check_udev = "ceph-osd-check-udev-${name}"
93 @@ -120,25 +130,15 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
94        Exec[$ceph_check_udev] -> Exec[$ceph_prepare]
95        # ceph-disk: prepare should be idempotent http://tracker.ceph.com/issues/7475
96        exec { $ceph_prepare:
97 -        command   => "/bin/true # comment to satisfy puppet syntax requirements
98 -set -ex
99 -disk=$(readlink -f ${data})
100 -if ! test -b \$disk ; then
101 -    echo \$disk | egrep -e '^/dev' -q -v
102 -    mkdir -p \$disk
103 -    if getent passwd ceph >/dev/null 2>&1; then
104 -        chown -h ceph:ceph \$disk
105 -    fi
106 -fi
107 -ceph-disk prepare ${cluster_option} ${fsid_option} $(readlink -f ${data}) $(readlink -f ${journal})
108 -udevadm settle
109 -",
110 -        unless    => "/bin/true # comment to satisfy puppet syntax requirements
111 -set -ex
112 -disk=$(readlink -f ${data})
113 -ceph-disk list | egrep \" *(\${disk}1?|\${disk}p1?) .*ceph data, (prepared|active)\" ||
114 -{ test -f \$disk/fsid && test -f \$disk/ceph_fsid && test -f \$disk/magic ;}
115 -",
116 +
117 +        command   => "/usr/sbin/ceph-disk prepare ${cluster_option} ${cluster_uuid_option} ${uuid_option} --fs-type xfs --zap-disk ${data} ${journal}",
118 +        # We don't want to erase the disk if:
119 +        # 1. There is already ceph data on the disk for our cluster AND
120 +        # 2. The uuid for the OSD we are configuring matches the uuid for the
121 +        #    OSD on the disk. We don't want to attempt to re-use an OSD that
122 +        #    had previously been deleted.
123 +        unless    => "/usr/sbin/ceph-disk list | grep -v 'unknown cluster' | grep ' *${data}.*ceph data' | grep 'osd uuid ${uuid}'",
124 +
125          logoutput => true,
126          timeout   => $exec_timeout,
127          tag       => 'prepare',
128 diff --git a/manifests/rgw.pp b/manifests/rgw.pp
129 index 2612785..ebc83ce 100644
130 --- a/manifests/rgw.pp
131 +++ b/manifests/rgw.pp
132 @@ -185,6 +185,13 @@ define ceph::rgw (
133        provider => $::ceph::params::service_provider,
134      }
135    # Everything else that is supported by puppet-ceph should run systemd.
136 +  } elsif $::service_provider == 'systemd' {
137 +    Service {
138 +      name     => "radosgw-${name}",
139 +      start    => "systemctl start ceph-radosgw",
140 +      stop     => "systemctl stop ceph-radosgw",
141 +      status   => "systemctl status ceph-radosgw",
142 +    }
143    } else {
144      Service {
145        name   => "ceph-radosgw@${name}",
146 -- 
147 2.7.4
148