puppet-ceph: osd use filestore and configured id

* integrate create filestore OSD patch
    The ceph-disk default create bluestore in mimic version.
    For maximize compability, still create filestore OSD here.

* prepare osd to be started via init script
    use osd id already configured in the database
    instead of generating a new one

* fix ceph osd disk partition for nvme disks

Story: 2003605

Depends-On: Ic9c4aed8dbab5d3e141cf9c1b2b1892731b14779
Change-Id: Iaa3319a7647e5622037d12c53673da0e4199ceb4
Co-Authored-By: Daniel Badea <daniel.badea@intel.com>
Signed-off-by: Changcheng Liu <changcheng.liu@intel.com>
Signed-off-by: Daniel Badea <daniel.badea@windriver.com>
This commit is contained in:
Changcheng Liu 2019-01-31 18:40:24 +08:00 committed by Daniel Badea
parent 27426985a3
commit e6ddff6eb0
8 changed files with 278 additions and 1 deletions

View File

@ -1 +1 @@
TIS_PATCH_VER=7
TIS_PATCH_VER=11

View File

@ -0,0 +1,32 @@
From bc377fe17be8f077ac8fb59da9ba7551dcf0bc98 Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Fri, 29 Mar 2019 08:00:12 +0000
Subject: [PATCH] ceph-mimic-prepare-activate-osd.patch
---
SPECS/puppet-ceph.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SPECS/puppet-ceph.spec b/SPECS/puppet-ceph.spec
index e5cc64c..891ccfd 100644
--- a/SPECS/puppet-ceph.spec
+++ b/SPECS/puppet-ceph.spec
@@ -15,6 +15,7 @@ Patch0004: 0004-US92424-Add-OSD-support-for-persistent-naming.patch
Patch0005: 0005-Remove-puppetlabs-apt-as-ceph-requirement.patch
Patch0006: 0006-ceph-disk-prepare-invalid-data-disk-value.patch
Patch0007: 0007-Add-StarlingX-specific-restart-command-for-Ceph-moni.patch
+Patch0008: 0008-ceph-mimic-prepare-activate-osd.patch
BuildArch: noarch
@@ -37,6 +38,7 @@ Community Developed Ceph Module
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
+%patch0008 -p1
find . -type f -name ".*" -exec rm {} +
find . -size 0 -exec rm {} +
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From 88ffd373172ecabdda7235cce1efa3b7014a839f Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Thu, 25 Apr 2019 15:42:38 +0000
Subject: [PATCH] fix ceph osd disk partition for nvme disks
---
SPECS/puppet-ceph.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SPECS/puppet-ceph.spec b/SPECS/puppet-ceph.spec
index 95c1f0e..6b6cac2 100644
--- a/SPECS/puppet-ceph.spec
+++ b/SPECS/puppet-ceph.spec
@@ -16,6 +16,7 @@ Patch0005: 0005-Remove-puppetlabs-apt-as-ceph-requirement.patch
Patch0006: 0006-ceph-disk-prepare-invalid-data-disk-value.patch
Patch0007: 0007-Add-StarlingX-specific-restart-command-for-Ceph-moni.patch
Patch0008: 0008-ceph-mimic-prepare-activate-osd.patch
+Patch0009: 0009-fix-ceph-osd-disk-partition-for-nvme-disks.patch
BuildArch: noarch
@@ -39,6 +40,7 @@ Community Developed Ceph Module
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
+%patch0009 -p1
find . -type f -name ".*" -exec rm {} +
find . -size 0 -exec rm {} +
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From 1a7e85dafe9cc85daff394af6d30055f5e416d13 Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Fri, 26 Apr 2019 00:24:03 +0000
Subject: [PATCH] wipe unprepared disks
---
SPECS/puppet-ceph.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SPECS/puppet-ceph.spec b/SPECS/puppet-ceph.spec
index 6b6cac2..102fccd 100644
--- a/SPECS/puppet-ceph.spec
+++ b/SPECS/puppet-ceph.spec
@@ -17,6 +17,7 @@ Patch0006: 0006-ceph-disk-prepare-invalid-data-disk-value.patch
Patch0007: 0007-Add-StarlingX-specific-restart-command-for-Ceph-moni.patch
Patch0008: 0008-ceph-mimic-prepare-activate-osd.patch
Patch0009: 0009-fix-ceph-osd-disk-partition-for-nvme-disks.patch
+Patch0010: 0010-wipe-unprepared-disks.patch
BuildArch: noarch
@@ -41,6 +42,7 @@ Community Developed Ceph Module
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
+%patch0010 -p1
find . -type f -name ".*" -exec rm {} +
find . -size 0 -exec rm {} +
--
1.8.3.1

View File

@ -5,3 +5,6 @@
0005-meta-patch-for-patch5.patch
0006-add-ceph-disk-prepare-invalid-data-disk-value-patch.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

@ -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