6f6345c9da
Story: 2003389 Task: 24503 Change-Id: I06ee6bd6563b44c28aff7e23adf0f442466481af Signed-off-by: chenyan <yan.chen@intel.com>
149 lines
5.1 KiB
Diff
149 lines
5.1 KiB
Diff
From ff98c42f0e6ce22969e986933d0a60d73a281a1d Mon Sep 17 00:00:00 2001
|
|
From: Don Penney <don.penney@windriver.com>
|
|
Date: Tue, 10 Jan 2017 13:31:17 -0500
|
|
Subject: [PATCH 1/5] Roll up TIS patches
|
|
|
|
---
|
|
manifests/mon.pp | 14 +++++++++++---
|
|
manifests/osd.pp | 38 +++++++++++++++++++-------------------
|
|
manifests/rgw.pp | 7 +++++++
|
|
3 files changed, 37 insertions(+), 22 deletions(-)
|
|
|
|
diff --git a/manifests/mon.pp b/manifests/mon.pp
|
|
index bc0298c..fa99df5 100644
|
|
--- a/manifests/mon.pp
|
|
+++ b/manifests/mon.pp
|
|
@@ -65,6 +65,8 @@ define ceph::mon (
|
|
$authentication_type = 'cephx',
|
|
$key = undef,
|
|
$keyring = undef,
|
|
+ $fsid = undef,
|
|
+ $service_ensure = 'running',
|
|
$exec_timeout = $::ceph::params::exec_timeout,
|
|
) {
|
|
|
|
@@ -154,6 +156,10 @@ test -e \$mon_data/done
|
|
}
|
|
}
|
|
|
|
+ if $fsid {
|
|
+ $fsid_option = "--fsid ${fsid}"
|
|
+ }
|
|
+
|
|
Ceph_config<||>
|
|
# prevent automatic creation of the client.admin key by ceph-create-keys
|
|
-> exec { "ceph-mon-${cluster_name}.client.admin.keyring-${id}":
|
|
@@ -176,7 +182,8 @@ if [ ! -d \$mon_data ] ; then
|
|
--setuser ceph --setgroup ceph \
|
|
--mkfs \
|
|
--id ${id} \
|
|
- --keyring ${keyring_path} ; then
|
|
+ --keyring ${keyring_path} \
|
|
+ ${fsid_option} ; then
|
|
touch \$mon_data/done \$mon_data/${init} \$mon_data/keyring
|
|
chown -h ceph:ceph \$mon_data/done \$mon_data/${init} \$mon_data/keyring
|
|
else
|
|
@@ -186,7 +193,8 @@ if [ ! -d \$mon_data ] ; then
|
|
if ceph-mon ${cluster_option} \
|
|
--mkfs \
|
|
--id ${id} \
|
|
- --keyring ${keyring_path} ; then
|
|
+ --keyring ${keyring_path} \
|
|
+ ${fsid_option} ; then
|
|
touch \$mon_data/done \$mon_data/${init} \$mon_data/keyring
|
|
else
|
|
rm -fr \$mon_data
|
|
@@ -203,7 +211,7 @@ test -d \$mon_data
|
|
timeout => $exec_timeout,
|
|
}
|
|
-> service { $mon_service:
|
|
- ensure => running,
|
|
+ ensure => $service_ensure,
|
|
}
|
|
|
|
# if the service is running before we setup the configs, notify service
|
|
diff --git a/manifests/osd.pp b/manifests/osd.pp
|
|
index d24b95e..9b8cd99 100644
|
|
--- a/manifests/osd.pp
|
|
+++ b/manifests/osd.pp
|
|
@@ -52,6 +52,8 @@ define ceph::osd (
|
|
$ensure = present,
|
|
$journal = "''",
|
|
$cluster = undef,
|
|
+ $cluster_uuid = undef,
|
|
+ $uuid = undef,
|
|
$exec_timeout = $::ceph::params::exec_timeout,
|
|
$selinux_file_context = 'ceph_var_lib_t',
|
|
$fsid = $::ceph::profile::params::fsid,
|
|
@@ -68,6 +70,14 @@ define ceph::osd (
|
|
}
|
|
$cluster_option = "--cluster ${cluster_name}"
|
|
|
|
+ if $cluster_uuid {
|
|
+ $cluster_uuid_option = "--cluster-uuid ${cluster_uuid}"
|
|
+ }
|
|
+
|
|
+ if $uuid {
|
|
+ $uuid_option = "--osd-uuid ${uuid}"
|
|
+ }
|
|
+
|
|
if $ensure == present {
|
|
|
|
$ceph_check_udev = "ceph-osd-check-udev-${name}"
|
|
@@ -120,25 +130,15 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
|
|
Exec[$ceph_check_udev] -> Exec[$ceph_prepare]
|
|
# ceph-disk: prepare should be idempotent http://tracker.ceph.com/issues/7475
|
|
exec { $ceph_prepare:
|
|
- command => "/bin/true # comment to satisfy puppet syntax requirements
|
|
-set -ex
|
|
-disk=$(readlink -f ${data})
|
|
-if ! test -b \$disk ; then
|
|
- echo \$disk | egrep -e '^/dev' -q -v
|
|
- mkdir -p \$disk
|
|
- if getent passwd ceph >/dev/null 2>&1; then
|
|
- chown -h ceph:ceph \$disk
|
|
- fi
|
|
-fi
|
|
-ceph-disk prepare ${cluster_option} ${fsid_option} $(readlink -f ${data}) $(readlink -f ${journal})
|
|
-udevadm settle
|
|
-",
|
|
- unless => "/bin/true # comment to satisfy puppet syntax requirements
|
|
-set -ex
|
|
-disk=$(readlink -f ${data})
|
|
-ceph-disk list | egrep \" *(\${disk}1?|\${disk}p1?) .*ceph data, (prepared|active)\" ||
|
|
-{ test -f \$disk/fsid && test -f \$disk/ceph_fsid && test -f \$disk/magic ;}
|
|
-",
|
|
+
|
|
+ command => "/usr/sbin/ceph-disk prepare ${cluster_option} ${cluster_uuid_option} ${uuid_option} --fs-type xfs --zap-disk ${data} ${journal}",
|
|
+ # We don't want to erase the disk if:
|
|
+ # 1. There is already ceph data on the disk for our cluster AND
|
|
+ # 2. The uuid for the OSD we are configuring matches the uuid for the
|
|
+ # OSD on the disk. We don't want to attempt to re-use an OSD that
|
|
+ # had previously been deleted.
|
|
+ unless => "/usr/sbin/ceph-disk list | grep -v 'unknown cluster' | grep ' *${data}.*ceph data' | grep 'osd uuid ${uuid}'",
|
|
+
|
|
logoutput => true,
|
|
timeout => $exec_timeout,
|
|
tag => 'prepare',
|
|
diff --git a/manifests/rgw.pp b/manifests/rgw.pp
|
|
index 2612785..ebc83ce 100644
|
|
--- a/manifests/rgw.pp
|
|
+++ b/manifests/rgw.pp
|
|
@@ -185,6 +185,13 @@ define ceph::rgw (
|
|
provider => $::ceph::params::service_provider,
|
|
}
|
|
# Everything else that is supported by puppet-ceph should run systemd.
|
|
+ } elsif $::service_provider == 'systemd' {
|
|
+ Service {
|
|
+ name => "radosgw-${name}",
|
|
+ start => "systemctl start ceph-radosgw",
|
|
+ stop => "systemctl stop ceph-radosgw",
|
|
+ status => "systemctl status ceph-radosgw",
|
|
+ }
|
|
} else {
|
|
Service {
|
|
name => "ceph-radosgw@${name}",
|
|
--
|
|
2.7.4
|
|
|