debian: Replace puppet-module-ceph-3.1.1 with 2.4.1

This work is part of Debian integration effort. This work only affects
debian.

We package the same version of ceph for both CentOS and Debian.
Since we know the puppet-ceph module on CentOS is supposed to work,
use this on Debian also to reduce testing and possible issues.

Patches were copied from CentOS and not touched.
Drop one patch to metadata.json, we know we have some work to do in
that area to clear puppet warnings, but will be done part of a
generic clearing puppet warnings effort.

The sources need to be patched to work with debhelper-compat 13, which
we don't care now.

There are some integration issues, but testing so far revealed that
during a puppet replay for aio manifest ceph data and ceph journal
partitions were created.

Story: 2009101
Task: 43431
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I90adc736ea52e6c4f9946520156f53e572c224cc
This commit is contained in:
Dan Voiculeasa 2022-03-10 16:33:50 +02:00
parent 6db1ffba37
commit bac46cc0e0
25 changed files with 669 additions and 154 deletions

View File

@ -0,0 +1,5 @@
puppet-module-ceph (2.4.1-1) unstable; urgency=medium
* Initial release.
-- Dan Voiculeasa <dan.voiculeasa@windriver.com> Thu, 10 Mar 202 15:50:00 +0200

View File

@ -0,0 +1,30 @@
Source: puppet-module-ceph
Section: admin
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends:
debhelper-compat (= 11),
openstack-pkg-tools,
python3-all,
python3-pbr,
python3-setuptools,
Standards-Version: 4.4.1
Homepage: https://www.starlingx.io
Package: puppet-module-ceph
Architecture: all
Depends: ${misc:Depends},
puppet,
puppet-module-duritong-sysctl,
puppet-module-puppetlabs-apache,
puppet-module-puppetlabs-concat,
puppet-module-puppetlabs-inifile,
puppet-module-puppetlabs-stdlib,
Description: Puppet module for Ceph
Puppet lets you centrally manage every important aspect of your system using a
cross-platform specification language that manages all the separate elements
normally aggregated in different files, like users, cron jobs, and hosts,
along with obviously discrete elements like packages, services, and files.
.
This module manages both the installation and configuration of the Ceph
distributed storage system.

View File

@ -0,0 +1,39 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: puppet-ceph
Source: https://github.com/openstack/puppet-ceph
Files: *
Copyright: (c) 2006-2008, Junio C Hamano
(c) 2013-2014, Cloudwatt <libre.licensing@cloudwatt.com>
(c) 2013-2015, iWeb Technologies Inc.
(c) 2013-2015, Red Hat, Inc.
(c) 2013-2016, Mirantis Inc.
(c) 2013, Dan Bode <bodepd@gmail.com>
(c) 2013, Hewlett-Packard Development Company, L.P.
(c) 2014, Catalyst IT Limited.
(c) 2014, Nine Internet Solutions AG
(c) 2015, David Gurtner
(c) 2016, Keith Schincke
(c) 2016, Puppet OpenStack Developers
(c) 2017, VEXXHOST, Inc.
License: Apache-2.0
Files: debian/*
Copyright: (c) 2022, Dan Voiculeasa <dan.voiculeasa@windriver.com>
License: Apache-2.0
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in /usr/share/common-licenses/Apache-2.0.

View File

@ -0,0 +1,4 @@
lib usr/share/puppet/modules.available/puppet-ceph
manifests usr/share/puppet/modules.available/puppet-ceph
metadata.json usr/share/puppet/modules.available/puppet-ceph
spec usr/share/puppet/modules.available/puppet-ceph

View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
if [ "${1}" = "configure" ] ; then
update-alternatives --install /usr/share/puppet/modules/ceph puppet-module-ceph \
/usr/share/puppet/modules.available/puppet-ceph 500
fi
#DEBHELPER#
exit 0

View File

@ -0,0 +1,11 @@
#!/bin/sh
set -e
if [ "${1}" = "remove" ] || [ "${1}" = "disappear" ]; then
update-alternatives --remove puppet-module-ceph /usr/share/puppet/modules.available/puppet-ceph
fi
#DEBHELPER#
exit 0

View File

@ -0,0 +1,11 @@
#!/bin/sh
set -e
if [ "${1}" = "remove" ] || [ "${1}" = "upgrade" || [ "${1}" = "deconfigure" ]; then
update-alternatives --remove puppet-module-ceph /usr/share/puppet/modules.available/puppet-ceph
fi
#DEBHELPER#
exit 0

View File

@ -0,0 +1,11 @@
#!/usr/bin/make -f
#export DH_VERBOSE = 1
%:
dh $@
override_dh_auto_clean:
override_dh_auto_install:
override_dh_auto_build:

View File

@ -0,0 +1,10 @@
---
debver: 2.4.1-1
debname: puppet-module-ceph
dl_path:
name: puppet-module-ceph-debian-2.4.1-1.tar.gz
url: https://salsa.debian.org/openstack-team/puppet/puppet-module-ceph/-/archive/2.4.1/puppet-module-ceph-2.4.1.tar.gz
md5sum: 63e1c4e7174631957f96126b32c60360
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -0,0 +1,148 @@
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

View File

@ -1,7 +1,7 @@
From e45ab36e8ea77500f80abd2f96cca2c6cf3a4b66 Mon Sep 17 00:00:00 2001
From 570520c5197dd36c3e4a7956d5916426fb75856a Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Tue, 7 Feb 2017 15:49:02 -0500
Subject: [PATCH 2/5] Newton rebase fixes
Subject: [PATCH] Newton rebase fixes
---
manifests/mon.pp | 9 ++++++---
@ -9,7 +9,7 @@ Subject: [PATCH 2/5] Newton rebase fixes
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/manifests/mon.pp b/manifests/mon.pp
index cbf753a..eb5c125 100644
index fa99df5..b3458d6 100644
--- a/manifests/mon.pp
+++ b/manifests/mon.pp
@@ -99,10 +99,13 @@ define ceph::mon (
@ -30,18 +30,18 @@ index cbf753a..eb5c125 100644
}
diff --git a/manifests/osd.pp b/manifests/osd.pp
index 7de3a53..1972caa 100644
index 9b8cd99..2187361 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -77,7 +77,7 @@ define ceph::osd (
$store_type = undef,
$exec_timeout = $ceph::params::exec_timeout,
@@ -56,7 +56,7 @@ define ceph::osd (
$uuid = undef,
$exec_timeout = $::ceph::params::exec_timeout,
$selinux_file_context = 'ceph_var_lib_t',
- $fsid = $ceph::profile::params::fsid,
- $fsid = $::ceph::profile::params::fsid,
+ $fsid = undef,
$dmcrypt = false,
$dmcrypt_key_dir = '/etc/ceph/dmcrypt-keys',
) {
--
2.30.2
include ::ceph::params
--
2.7.4

View File

@ -0,0 +1,110 @@
From c9a5520620d313c08e7f751f3469ec5f4c220486 Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Thu, 23 Mar 2017 08:04:31 +0000
Subject: [PATCH] ceph jewel rebase
---
manifests/mon.pp | 1 +
manifests/rgw.pp | 33 +++++++++++++++++++++++++--------
manifests/rgw/keystone.pp | 6 +++---
3 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/manifests/mon.pp b/manifests/mon.pp
index b3458d6..17cb925 100644
--- a/manifests/mon.pp
+++ b/manifests/mon.pp
@@ -106,6 +106,7 @@ define ceph::mon (
start => "service ceph start mon.${id}",
stop => "service ceph stop mon.${id}",
status => "service ceph status mon.${id}",
+ enable => $mon_enable,
}
}
diff --git a/manifests/rgw.pp b/manifests/rgw.pp
index ebc83ce..56fb4a8 100644
--- a/manifests/rgw.pp
+++ b/manifests/rgw.pp
@@ -193,23 +193,40 @@ define ceph::rgw (
status => "systemctl status ceph-radosgw",
}
} else {
+ if $rgw_enable {
+ file { "${rgw_data}/sysvinit":
+ ensure => present,
+ before => Service["radosgw-${name}"],
+ }
+ }
+
Service {
- name => "ceph-radosgw@${name}",
- enable => $rgw_enable,
+ name => "radosgw-${name}",
+ start => 'service radosgw start',
+ stop => 'service radosgw stop',
+ status => 'service radosgw status',
+ provider => $::ceph::params::service_provider,
}
}
- service { $rgw_service:
+ #for RHEL/CentOS7, systemctl needs to reload to pickup the ceph-radosgw init file
+ if (($::operatingsystem == 'RedHat' or $::operatingsystem == 'CentOS') and (versioncmp($::operatingsystemmajrelease, '7') >= 0))
+ {
+ exec { 'systemctl-reload-from-rgw': #needed for the new init file
+ command => '/usr/bin/systemctl daemon-reload',
+ }
+ }
+ service { "radosgw-${name}":
ensure => $rgw_ensure,
- tag => ['ceph-radosgw']
+ tag => ['radosgw']
}
- Ceph_config<||> ~> Service<| tag == 'ceph-radosgw' |>
+ Ceph_config<||> -> Service["radosgw-${name}"]
Package<| tag == 'ceph' |> -> File['/var/lib/ceph/radosgw']
Package<| tag == 'ceph' |> -> File[$log_file]
File['/var/lib/ceph/radosgw']
-> File[$rgw_data]
- -> Service<| tag == 'ceph-radosgw' |>
- File[$log_file] -> Service<| tag == 'ceph-radosgw' |>
- Ceph::Pool<||> -> Service<| tag == 'ceph-radosgw' |>
+ -> Service["radosgw-${name}"]
+ File[$log_file] -> Service["radosgw-${name}"]
+ Ceph::Pool<||> -> Service["radosgw-${name}"]
}
diff --git a/manifests/rgw/keystone.pp b/manifests/rgw/keystone.pp
index 8351177..c371fd0 100644
--- a/manifests/rgw/keystone.pp
+++ b/manifests/rgw/keystone.pp
@@ -148,7 +148,7 @@ define ceph::rgw::keystone (
exec { "${name}-nssdb-ca":
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
-wget --no-check-certificate ${rgw_keystone_url}/v2.0/certificates/ca -O - |
+wget --no-check-certificate ${rgw_keystone_url}/${rgw_keystone_version}/certificates/ca -O - |
openssl x509 -pubkey | certutil -A -d ${nss_db_path} -n ca -t \"TCu,Cu,Tuw\"
",
unless => "/bin/true # comment to satisfy puppet syntax requirements
@@ -161,7 +161,7 @@ certutil -d ${nss_db_path} -L | grep ^ca
exec { "${name}-nssdb-signing":
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
-wget --no-check-certificate ${rgw_keystone_url}/v2.0/certificates/signing -O - |
+wget --no-check-certificate ${rgw_keystone_url}/${rgw_keystone_version}/certificates/signing -O - |
openssl x509 -pubkey | certutil -A -d ${nss_db_path} -n signing_cert -t \"P,P,P\"
",
unless => "/bin/true # comment to satisfy puppet syntax requirements
@@ -176,7 +176,7 @@ certutil -d ${nss_db_path} -L | grep ^signing_cert
-> File[$nss_db_path]
-> Exec["${name}-nssdb-ca"]
-> Exec["${name}-nssdb-signing"]
- ~> Service<| tag == 'ceph-radosgw' |>
+ ~> Service<| tag == 'radosgw' |>
} else {
ceph_config {
"client.${name}/nss_db_path": ensure => absent;
--
2.7.4

View File

@ -1,7 +1,7 @@
From c207c353cbf883befa6070ccd80c2b4980a434fe Mon Sep 17 00:00:00 2001
From 7a4c325194885dc43fc87f7094873e0067801652 Mon Sep 17 00:00:00 2001
From: Robert Church <robert.church@windriver.com>
Date: Thu, 13 Apr 2017 20:31:21 -0500
Subject: [PATCH 4/5] US92424: Add OSD support for persistent naming
Subject: [PATCH] US92424: Add OSD support for persistent naming
This allows the manifest to provide udev generated /dev/disk/by-* links
to configure the OSDs without requiring any additional changes. The
@ -12,12 +12,12 @@ associated with udev link.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/manifests/osd.pp b/manifests/osd.pp
index 1972caa..2bda784 100644
index 2187361..d9cf5b1 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -84,7 +84,7 @@ define ceph::osd (
@@ -61,7 +61,7 @@ define ceph::osd (
include ceph::params
include ::ceph::params
- $data = $name
+ $data = generate('/bin/bash','-c',"/bin/readlink -f ${name}")
@ -25,5 +25,5 @@ index 1972caa..2bda784 100644
if $cluster {
$cluster_name = $cluster
--
2.30.2
2.7.4

View File

@ -0,0 +1,68 @@
From 5d8f3dd5d18d611151b4658c5c876e8a3ad8fe51 Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Wed, 31 Oct 2018 16:28:45 +0000
Subject: [PATCH] ceph-disk prepare invalid data disk value
ceph-disk prepare data OSD parameter contains a new line causing
puppet manifest to fail:
1. $data = generate('/bin/bash','-c',"/bin/readlink -f ${name}")
is expanded together with a new line in:
exec { $ceph_prepare:
command => "/usr/sbin/ceph-disk prepare ${cluster_option}
${cluster_uuid_option} ${uuid_option}
--fs-type xfs --zap-disk ${data} ${journal}"
just before ${journal} is expanded. Puppet reports:
sh: line 1: : command not found
when trying to run '' (default journal value).
2. 'readlink' should be called when running ceph-disk prepare
command, not when the puppet resource is defined. Let
exec's shell call readlink instead of using puppet's
generate() . See also:
https://github.com/openstack/puppet-ceph/commit/ff2b2e689846dd3d980c7c706c591e8cfb8f33a9
Added --verbose and --log-stdout options to log commands executed
by 'ceph-disk prepare' and identify where it fails.
---
manifests/osd.pp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/manifests/osd.pp b/manifests/osd.pp
index d9cf5b1..889d28a 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -61,7 +61,7 @@ define ceph::osd (
include ::ceph::params
- $data = generate('/bin/bash','-c',"/bin/readlink -f ${name}")
+ $data = $name
if $cluster {
$cluster_name = $cluster
@@ -131,13 +131,13 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
# ceph-disk: prepare should be idempotent http://tracker.ceph.com/issues/7475
exec { $ceph_prepare:
- command => "/usr/sbin/ceph-disk prepare ${cluster_option} ${cluster_uuid_option} ${uuid_option} --fs-type xfs --zap-disk ${data} ${journal}",
+ 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})",
# 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}'",
+ unless => "/usr/sbin/ceph-disk list | grep -v 'unknown cluster' | grep \" *$(readlink -f ${data}).*ceph data\" | grep 'osd uuid ${uuid}'",
logoutput => true,
timeout => $exec_timeout,
--
2.16.5

View File

@ -1,7 +1,7 @@
From 5169d43ce8085726d1d9945fef636154a21eaf17 Mon Sep 17 00:00:00 2001
From a364f37cacab78cdaad5ebd23ab24cf400a3fa40 Mon Sep 17 00:00:00 2001
From: Ovidiu Poncea <ovidiu.poncea@windriver.com>
Date: Thu, 20 Dec 2018 07:18:55 -0500
Subject: [PATCH 5/5] Add StarlingX specific restart command for Ceph monitors
Subject: [PATCH] Add StarlingX specific restart command for Ceph monitors
Since we don't use systemd to manage Ceph and we have pmon monitoring we
have to make sure that:
@ -19,7 +19,7 @@ Signed-off-by: Ovidiu Poncea <Ovidiu.Poncea@windriver.com>
1 file changed, 1 insertion(+)
diff --git a/manifests/mon.pp b/manifests/mon.pp
index 7cbec0d..3936529 100644
index 17cb925..62d5059 100644
--- a/manifests/mon.pp
+++ b/manifests/mon.pp
@@ -106,6 +106,7 @@ define ceph::mon (
@ -31,5 +31,5 @@ index 7cbec0d..3936529 100644
}
}
--
2.30.2
1.8.3.1

View File

@ -0,0 +1,64 @@
From 4c2e2a196cb5a6890e35098c8499688fc1c26f5c Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Thu, 4 Apr 2019 16:52:12 +0000
Subject: [PATCH] ceph-mimic-prepare-activate-osd
Prepare and activate disk using filestore
and given OSD id.
---
manifests/osd.pp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/manifests/osd.pp b/manifests/osd.pp
index 889d28a..c51a445 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -54,6 +54,7 @@ define ceph::osd (
$cluster = undef,
$cluster_uuid = undef,
$uuid = undef,
+ $osdid = undef,
$exec_timeout = $::ceph::params::exec_timeout,
$selinux_file_context = 'ceph_var_lib_t',
$fsid = undef,
@@ -78,6 +79,10 @@ define ceph::osd (
$uuid_option = "--osd-uuid ${uuid}"
}
+ if $osdid {
+ $osdid_option = "--osd-id ${osdid}"
+ }
+
if $ensure == present {
$ceph_check_udev = "ceph-osd-check-udev-${name}"
@@ -131,7 +136,16 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
# ceph-disk: prepare should be idempotent http://tracker.ceph.com/issues/7475
exec { $ceph_prepare:
- 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})",
+ command => "/bin/true # comment to satisfy puppet syntax requirements
+set -ex
+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})
+mkdir -p /var/lib/ceph/osd/ceph-${osdid}
+ceph auth del osd.${osdid} || true
+mount $(readlink -f ${data})1 /var/lib/ceph/osd/ceph-${osdid}
+ceph-osd --id ${osdid} --mkfs --mkkey --mkjournal
+ceph auth add osd.${osdid} osd 'allow *' mon 'allow rwx' -i /var/lib/ceph/osd/ceph-${osdid}/keyring
+umount /var/lib/ceph/osd/ceph-${osdid}
+",
# 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
@@ -171,7 +185,7 @@ if ! test -b \$disk ; then
fi
# activate happens via udev when using the entire device
if ! test -b \$disk || ! test -b \${disk}1 || ! test -b \${disk}p1 ; then
- ceph-disk activate \$disk || true
+ ceph-disk activate \${disk}1 || true
fi
if test -f ${udev_rules_file}.disabled && ( test -b \${disk}1 || test -b \${disk}p1 ); then
ceph-disk activate \${disk}1 || true
--
1.8.3.1

View File

@ -0,0 +1,89 @@
From b0dd34d2d580c817f9ef6eb62927ba63bebe73c3 Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Thu, 25 Apr 2019 15:37:53 +0000
Subject: [PATCH] fix ceph osd disk partition for nvme disks
---
manifests/osd.pp | 38 +++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/manifests/osd.pp b/manifests/osd.pp
index c51a445..5bd30c5 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -138,10 +138,17 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
-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})
+disk=$(readlink -f ${data})
+ceph-disk --verbose --log-stdout prepare --filestore ${cluster_uuid_option} ${uuid_option} ${osdid_option} --fs-type xfs --zap-disk \${disk} $(readlink -f ${journal})
mkdir -p /var/lib/ceph/osd/ceph-${osdid}
ceph auth del osd.${osdid} || true
-mount $(readlink -f ${data})1 /var/lib/ceph/osd/ceph-${osdid}
+part=\${disk}
+if [[ \$part == *nvme* ]]; then
+ part=\${part}p1
+else
+ part=\${part}1
+fi
+mount $(readlink -f \${part}) /var/lib/ceph/osd/ceph-${osdid}
ceph-osd --id ${osdid} --mkfs --mkkey --mkjournal
ceph auth add osd.${osdid} osd 'allow *' mon 'allow rwx' -i /var/lib/ceph/osd/ceph-${osdid}/keyring
umount /var/lib/ceph/osd/ceph-${osdid}
@@ -183,12 +190,17 @@ if ! test -b \$disk ; then
chown -h ceph:ceph \$disk
fi
fi
-# activate happens via udev when using the entire device
+part=\${disk}
+if [[ \${part} == *nvme* ]]; then
+ part=\${part}p1
+else
+ part=\${part}1
+fi
if ! test -b \$disk || ! test -b \${disk}1 || ! test -b \${disk}p1 ; then
- ceph-disk activate \${disk}1 || true
+ ceph-disk activate \${part} || true
fi
if test -f ${udev_rules_file}.disabled && ( test -b \${disk}1 || test -b \${disk}p1 ); then
- ceph-disk activate \${disk}1 || true
+ ceph-disk activate \${part} || true
fi
",
unless => "/bin/true # comment to satisfy puppet syntax requirements
@@ -206,8 +218,14 @@ ls -ld /var/lib/ceph/osd/${cluster_name}-* | grep \" $(readlink -f ${data})\$\"
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f ${data})
+part=\${disk}
+if [[ \${part} == *nvme* ]]; then
+ part=\${part}p1
+else
+ part=\${part}1
+fi
if [ -z \"\$id\" ] ; then
- id=$(ceph-disk list | sed -nEe \"s:^ *\${disk}1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
+ id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
fi
if [ -z \"\$id\" ] ; then
id=$(ls -ld /var/lib/ceph/osd/${cluster_name}-* | sed -nEe \"s:.*/${cluster_name}-([0-9]+) *-> *\${disk}\$:\\1:p\" || true)
@@ -227,8 +245,14 @@ fi
unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
disk=$(readlink -f ${data})
+part=${disk}
+if [[ \$part == *nvme* ]]; then
+ part=\${part}p1
+else
+ part=\${part}1
+fi
if [ -z \"\$id\" ] ; then
- id=$(ceph-disk list | sed -nEe \"s:^ *\${disk}1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
+ id=$(ceph-disk list | sed -nEe \"s:^ *\${part}? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
fi
if [ -z \"\$id\" ] ; then
id=$(ls -ld /var/lib/ceph/osd/${cluster_name}-* | sed -nEe \"s:.*/${cluster_name}-([0-9]+) *-> *\${disk}\$:\\1:p\" || true)
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From 828af5dec53192207637d15397887e058d6ea0fb Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Fri, 26 Apr 2019 00:22:12 +0000
Subject: [PATCH] wipe unprepared disks
---
manifests/osd.pp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/manifests/osd.pp b/manifests/osd.pp
index 5bd30c5..ab65924 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -158,7 +158,7 @@ umount /var/lib/ceph/osd/ceph-${osdid}
# 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 \" *$(readlink -f ${data}).*ceph data\" | grep 'osd uuid ${uuid}'",
+ unless => "/usr/sbin/ceph-disk list | grep -v 'unknown cluster' | grep \" *$(readlink -f ${data}).*ceph data\" | grep -v unprepared | grep 'osd uuid ${uuid}'",
logoutput => true,
timeout => $exec_timeout,
--
1.8.3.1

View File

@ -0,0 +1,9 @@
0001-Roll-up-TIS-patches.patch
0002-Newton-rebase-fixes.patch
0003-Ceph-Jewel-rebase.patch
0004-US92424-Add-OSD-support-for-persistent-naming.patch
0006-ceph-disk-prepare-invalid-data-disk-value.patch
0007-Add-StarlingX-specific-restart-command-for-Ceph-moni.patch
0008-ceph-mimic-prepare-activate-osd.patch
0009-fix-ceph-osd-disk-partition-for-nvme-disks.patch
0010-wipe-unprepared-disks.patch

View File

@ -1,11 +0,0 @@
---
debver: 3.1.1-1
debname: puppet-module-ceph
dl_path:
name: puppet-module-ceph-debian-3.1.1-1.tar.gz
url: https://salsa.debian.org/openstack-team/puppet/puppet-module-ceph/-/archive/debian/3.1.1-1/puppet-module-ceph-debian-3.1.1-1.tar.gz
md5sum: abbb478a9dd85ba8b628296668459dec
sha256sum: 143e9b63f0e39a196b947c437da38a5e762879fce43f86c55450c778f7972e6c
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -1,92 +0,0 @@
From 6a7e54f768b4f28a69ed5948a60765c10d5a4840 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 | 13 ++++++++++---
manifests/osd.pp | 9 +++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/manifests/mon.pp b/manifests/mon.pp
index f8dad43..cbf753a 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,
) {
@@ -115,6 +117,9 @@ define ceph::mon (
if $key and $keyring {
fail("key (set to ${key}) and keyring (set to ${keyring}) are mutually exclusive")
}
+ if $fsid {
+ $fsid_option = "--fsid ${fsid}"
+ }
if $key {
$keyring_path = "/tmp/ceph-mon-keyring-${id}"
@@ -176,7 +181,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 +192,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 +210,7 @@ test -d \$mon_data
timeout => $exec_timeout,
}
-> service { $mon_service:
- ensure => running,
+ ensure => $service_ennsure,
}
# if the service is running before we setup the configs, notify service
diff --git a/manifests/osd.pp b/manifests/osd.pp
index ac44a2c..7de3a53 100644
--- a/manifests/osd.pp
+++ b/manifests/osd.pp
@@ -70,6 +70,8 @@ define ceph::osd (
$ensure = present,
$journal = undef,
$cluster = undef,
+ $cluser_uuid = undef,
+ $uuid = undef,
$bluestore_wal = undef,
$bluestore_db = undef,
$store_type = undef,
@@ -91,6 +93,13 @@ define ceph::osd (
}
$cluster_option = "--cluster ${cluster_name}"
+ if $cluster_uuid {
+ $cluster_uuid_option = "--cluster-uuid ${cluster_uuid}"
+ }
+ if $uuid {
+ $uuid_option = "--os-uuid ${uuid}"
+ }
+
if $store_type {
$osd_type = "--${store_type}"
} else {
--
2.30.2

View File

@ -1,24 +0,0 @@
From 5d5949edf970141d12acf50cb8ad624c53f15296 Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Thu, 23 Mar 2017 08:04:31 +0000
Subject: [PATCH 3/5] ceph jewel rebase
---
manifests/mon.pp | 1 +
1 file changed, 1 insertion(+)
diff --git a/manifests/mon.pp b/manifests/mon.pp
index eb5c125..7cbec0d 100644
--- a/manifests/mon.pp
+++ b/manifests/mon.pp
@@ -106,6 +106,7 @@ define ceph::mon (
start => "service ceph start mon.${id}",
stop => "service ceph stop mon.${id}",
status => "service ceph status mon.${id}",
+ enable => $mon_enable,
}
}
--
2.30.2

View File

@ -1,5 +0,0 @@
0001-Roll-up-TIS-patches.patch
0002-Newton-rebase-fixes.patch
0003-ceph-jewel-rebase.patch
0004-US92424-Add-OSD-support-for-persistent-naming.patch
0005-Add-StarlingX-specific-restart-command-for-Ceph-moni.patch

View File

@ -12,7 +12,7 @@ centos-debian-compat
ceph/ceph
config/facter
config/puppet-5.5.22
config/puppet-modules/openstack/puppet-ceph-3.1.1
config/puppet-modules/openstack/puppet-ceph-2.4.1
config/puppet-modules/openstack/puppet-keystone-17.4.0
config/puppet-modules/openstack/puppet-openstacklib-17.4.0
config/puppet-modules/openstack/puppet-oslo-17.4.0