Support Ceph Nautilus release in puppet-ceph
This patch introduces the changes required by osd configuration tasks to support Nautilus release: - ceph-disk has been removed and replaced by ceph-volume - OSDs can not be based on directories anymore, only disks or vg/lv paths. - udev configuration is not needed since some releases back. To pass CI, this job requires to merge [1] and viceversa. To solve chicken-and-egg, I'm setting p-o-i jobs as non-voting in this patch. I'll make them voting again after merging both [1] and this one. [1] https://review.opendev.org/#/c/650281/ Change-Id: I15f061dd38ca6729a454ec96c8c8f5ea28c6f0c6
This commit is contained in:
12
.zuul.yaml
12
.zuul.yaml
@ -2,6 +2,14 @@
|
||||
templates:
|
||||
- puppet-openstack-check-jobs
|
||||
- puppet-openstack-module-unit-jobs
|
||||
- puppet-openstack-integration-jobs-scenario001
|
||||
- puppet-openstack-integration-jobs-scenario004
|
||||
- release-notes-jobs-python3
|
||||
check:
|
||||
jobs:
|
||||
- puppet-openstack-integration-5-scenario001-tempest-ubuntu-bionic-mimic:
|
||||
voting: false
|
||||
- puppet-openstack-integration-5-scenario001-tempest-centos-7-luminous:
|
||||
voting: false
|
||||
- puppet-openstack-integration-5-scenario004-tempest-ubuntu-bionic-mimic:
|
||||
voting: false
|
||||
- puppet-openstack-integration-5-scenario004-tempest-centos-7-mimic:
|
||||
voting: false
|
||||
|
121
manifests/osd.pp
121
manifests/osd.pp
@ -24,7 +24,7 @@
|
||||
# === Parameters:
|
||||
#
|
||||
# [*title*] The OSD data path.
|
||||
# Mandatory. A path in which the OSD data is to be stored.
|
||||
# Mandatory. The path for a disk or vg/lv used for the OSD
|
||||
#
|
||||
# [*ensure*] Installs ( present ) or remove ( absent ) an OSD
|
||||
# Optional. Defaults to present.
|
||||
@ -68,7 +68,7 @@
|
||||
#
|
||||
define ceph::osd (
|
||||
$ensure = present,
|
||||
$journal = "''",
|
||||
$journal = undef,
|
||||
$cluster = undef,
|
||||
$bluestore_wal = undef,
|
||||
$bluestore_db = undef,
|
||||
@ -97,15 +97,17 @@ define ceph::osd (
|
||||
|
||||
if ($bluestore_wal) or ($bluestore_db) {
|
||||
if $bluestore_wal {
|
||||
$wal_opts = "--block.wal $(readlink -f ${bluestore_wal})"
|
||||
$wal_opts = "--block.wal ${bluestore_wal}"
|
||||
}
|
||||
if $bluestore_db {
|
||||
$block_opts = "--block.db $(readlink -f ${bluestore_db})"
|
||||
$block_opts = "--block.db ${bluestore_db}"
|
||||
}
|
||||
$journal_opts = "${wal_opts} ${block_opts}"
|
||||
|
||||
} elsif $journal {
|
||||
$journal_opts = "--journal ${journal}"
|
||||
} else {
|
||||
$journal_opts = "$(readlink -f ${journal})"
|
||||
$journal_opts = ''
|
||||
}
|
||||
|
||||
if $dmcrypt {
|
||||
@ -116,11 +118,9 @@ define ceph::osd (
|
||||
|
||||
if $ensure == present {
|
||||
|
||||
$ceph_check_udev = "ceph-osd-check-udev-${name}"
|
||||
$ceph_prepare = "ceph-osd-prepare-${name}"
|
||||
$ceph_activate = "ceph-osd-activate-${name}"
|
||||
|
||||
Package<| tag == 'ceph' |> -> Exec[$ceph_check_udev]
|
||||
Ceph_config<||> -> Exec[$ceph_prepare]
|
||||
Ceph::Mon<||> -> Exec[$ceph_prepare]
|
||||
Ceph::Key<||> -> Exec[$ceph_prepare]
|
||||
@ -128,63 +128,47 @@ define ceph::osd (
|
||||
# Ensure none is activated before prepare is finished for all
|
||||
Exec<| tag == 'prepare' |> -> Exec<| tag == 'activate' |>
|
||||
|
||||
$udev_rules_file = '/usr/lib/udev/rules.d/95-ceph-osd.rules'
|
||||
exec { $ceph_check_udev:
|
||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
# Before Infernalis the udev rules race causing the activation to fail so we
|
||||
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
|
||||
mv -f ${udev_rules_file} ${udev_rules_file}.disabled && udevadm control --reload || true
|
||||
",
|
||||
onlyif => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
DISABLE_UDEV=$(ceph --version | awk 'match(\$3, /[0-9]+\\.[0-9]+/) {if (substr(\$3, RSTART, RLENGTH) <= 0.94) {print 1} else { print 0 } }')
|
||||
test -f ${udev_rules_file} && test \$DISABLE_UDEV -eq 1
|
||||
",
|
||||
logoutput => true,
|
||||
}
|
||||
|
||||
if $fsid {
|
||||
$fsid_option = "--cluster-uuid ${fsid}"
|
||||
$fsid_option = "--cluster-fsid ${fsid}"
|
||||
$ceph_check_fsid_mismatch = "ceph-osd-check-fsid-mismatch-${name}"
|
||||
Exec[$ceph_check_udev] -> Exec[$ceph_check_fsid_mismatch]
|
||||
Exec[$ceph_check_fsid_mismatch] -> Exec[$ceph_prepare]
|
||||
# return error if $(readlink -f ${data}) has fsid differing from ${fsid}, unless there is no fsid
|
||||
exec { $ceph_check_fsid_mismatch:
|
||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
test ${fsid} = $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||
exit 1
|
||||
",
|
||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||
if [ -z $(ceph-volume lvm list ${data} |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ') ]; then
|
||||
exit 0
|
||||
fi
|
||||
test ${fsid} = $(ceph-volume lvm list ${data} |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ')
|
||||
",
|
||||
logoutput => true,
|
||||
timeout => $exec_timeout,
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
if [ $(echo ${data}|cut -c 1) = '/' ]; then
|
||||
disk=${data}
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev/${data}
|
||||
fi
|
||||
ceph-disk prepare ${osd_type} ${cluster_option}${dmcrypt_options} ${fsid_option} $(readlink -f ${data}) ${journal_opts}
|
||||
udevadm settle
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
ceph-volume lvm prepare ${osd_type} ${cluster_option}${dmcrypt_options} ${fsid_option} --data ${data} ${journal_opts}
|
||||
",
|
||||
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)|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, (prepared|active), for (\${disk}1?|\${disk}p1?))\" ||
|
||||
{ test -f \$disk/fsid && test -f \$disk/ceph_fsid && test -f \$disk/magic ;}
|
||||
ceph-volume lvm list ${data}
|
||||
",
|
||||
logoutput => true,
|
||||
timeout => $exec_timeout,
|
||||
@ -208,27 +192,24 @@ restorecon -R $(readlink -f ${data})
|
||||
exec { $ceph_activate:
|
||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f ${data})
|
||||
if [ $(echo ${data}|cut -c 1) = '/' ]; then
|
||||
disk=${data}
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev/${data}
|
||||
fi
|
||||
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
|
||||
# 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
|
||||
fi
|
||||
if test -f ${udev_rules_file}.disabled && ( test -b \${disk}1 || test -b \${disk}p1 ); then
|
||||
ceph-disk activate \${disk}1 || true
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
id=$(ceph-volume lvm list ${data} | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
fsid=$(ceph-volume lvm list ${data} | grep 'osd fsid'|awk -F 'osd fsid' '{print \$2}'|tr -d ' ')
|
||||
ceph-volume lvm activate \$id \$fsid
|
||||
",
|
||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph-disk list | egrep \" *((\${disk}1?|\${disk}p1?) .*ceph data, active|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, active, for (\${disk}1?|\${disk}p1?))\" ||
|
||||
ls -ld /var/lib/ceph/osd/${cluster_name}-* | grep \" $(readlink -f ${data})\$\"
|
||||
id=$(ceph-volume lvm list ${data} | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
",
|
||||
logoutput => true,
|
||||
tag => 'activate',
|
||||
@ -240,14 +221,9 @@ ls -ld /var/lib/ceph/osd/${cluster_name}-* | grep \" $(readlink -f ${data})\$\"
|
||||
exec { "remove-osd-${name}":
|
||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f ${data})
|
||||
if [ -z \"\$id\" ] ; then
|
||||
id=$(ceph-disk list | sed -nEe \"s:^ *\${disk}1? .*(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)
|
||||
fi
|
||||
id=$(ceph-volume lvm list ${data} | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
if [ \"\$id\" ] ; then
|
||||
ceph ${cluster_option} osd out osd.\$id
|
||||
stop ceph-osd cluster=${cluster_name} id=\$id || true
|
||||
service ceph stop osd.\$id || true
|
||||
systemctl stop ceph-osd@\$id || true
|
||||
@ -257,21 +233,16 @@ if [ \"\$id\" ] ; then
|
||||
rm -fr /var/lib/ceph/osd/${cluster_name}-\$id/*
|
||||
umount /var/lib/ceph/osd/${cluster_name}-\$id || true
|
||||
rm -fr /var/lib/ceph/osd/${cluster_name}-\$id
|
||||
ceph-volume lvm zap ${data}
|
||||
fi
|
||||
",
|
||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f ${data})
|
||||
if [ -z \"\$id\" ] ; then
|
||||
id=$(ceph-disk list | sed -nEe \"s:^ *\${disk}1? .*(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)
|
||||
fi
|
||||
if [ \"\$id\" ] ; then
|
||||
test ! -d /var/lib/ceph/osd/${cluster_name}-\$id
|
||||
set -x
|
||||
ceph-volume lvm list ${data}
|
||||
if [ \$? -eq 0 ]; then
|
||||
exit 1
|
||||
else
|
||||
true # if there is no id we do nothing
|
||||
exit 0
|
||||
fi
|
||||
",
|
||||
logoutput => true,
|
||||
|
@ -23,69 +23,52 @@ describe 'ceph::osd' do
|
||||
shared_examples 'ceph osd' do
|
||||
describe "with default params" do
|
||||
let :title do
|
||||
'/srv'
|
||||
'vg_test/lv_test'
|
||||
end
|
||||
|
||||
it { should contain_exec('ceph-osd-check-udev-/srv').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
# Before Infernalis the udev rules race causing the activation to fail so we
|
||||
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
|
||||
mv -f /usr/lib/udev/rules.d/95-ceph-osd.rules /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && udevadm control --reload || true
|
||||
",
|
||||
'onlyif' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
DISABLE_UDEV=$(ceph --version | awk 'match(\$3, /[0-9]+\\.[0-9]+/) {if (substr(\$3, RSTART, RLENGTH) <= 0.94) {print 1} else { print 0 } }')
|
||||
test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
|
||||
",
|
||||
'logoutput' => true,
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-prepare-/srv').with(
|
||||
it { should contain_exec('ceph-osd-prepare-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv)
|
||||
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
|
||||
|
||||
if [ $(echo vg_test/lv_test|cut -c 1) = '/' ]; then
|
||||
disk=vg_test/lv_test
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev/vg_test/lv_test
|
||||
fi
|
||||
ceph-disk prepare --cluster ceph $(readlink -f /srv) $(readlink -f '')
|
||||
udevadm settle
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
ceph-volume lvm prepare --cluster ceph --data vg_test/lv_test
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv)
|
||||
ceph-disk list | egrep \" *((${disk}1?|${disk}p1?) .*ceph data, (prepared|active)|\\
|
||||
(${disk}5?|${disk}p5?) .*ceph lockbox, (prepared|active), for (${disk}1?|${disk}p1?))\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
ceph-volume lvm list vg_test/lv_test
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-activate-/srv').with(
|
||||
it { should contain_exec('ceph-osd-activate-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv)
|
||||
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
|
||||
if [ $(echo vg_test/lv_test|cut -c 1) = '/' ]; then
|
||||
disk=vg_test/lv_test
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev/vg_test/lv_test
|
||||
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
|
||||
fi
|
||||
if test -f /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && ( test -b ${disk}1 || test -b ${disk}p1 ); then
|
||||
ceph-disk activate ${disk}1 || true
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
id=$(ceph-volume lvm list vg_test/lv_test | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
fsid=$(ceph-volume lvm list vg_test/lv_test | grep 'osd fsid'|awk -F 'osd fsid' '{print \$2}'|tr -d ' ')
|
||||
ceph-volume lvm activate \$id \$fsid
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph-disk list | egrep \" *((\${disk}1?|\${disk}p1?) .*ceph data, active|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, active, for (\${disk}1?|\${disk}p1?))\" ||
|
||||
ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /srv)\$\"
|
||||
id=$(ceph-volume lvm list vg_test/lv_test | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
@ -93,7 +76,7 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /srv)\$\"
|
||||
|
||||
describe "with bluestore params" do
|
||||
let :title do
|
||||
'/srv/data'
|
||||
'vg_test/lv_test'
|
||||
end
|
||||
|
||||
let :params do
|
||||
@ -102,82 +85,68 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /srv)\$\"
|
||||
:journal => '/srv/journal',
|
||||
:fsid => 'f39ace04-f967-4c3d-9fd2-32af2d2d2cd5',
|
||||
:store_type => 'bluestore',
|
||||
:bluestore_wal => '/srv/wal',
|
||||
:bluestore_db => '/srv/db',
|
||||
:bluestore_wal => 'vg_test/lv_wal',
|
||||
:bluestore_db => 'vg_test/lv_db',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_exec('ceph-osd-check-udev-/srv/data').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
# Before Infernalis the udev rules race causing the activation to fail so we
|
||||
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
|
||||
mv -f /usr/lib/udev/rules.d/95-ceph-osd.rules /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && udevadm control --reload || true
|
||||
",
|
||||
'onlyif' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
DISABLE_UDEV=$(ceph --version | awk 'match(\$3, /[0-9]+\\.[0-9]+/) {if (substr(\$3, RSTART, RLENGTH) <= 0.94) {print 1} else { print 0 } }')
|
||||
test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
|
||||
",
|
||||
'logoutput' => true,
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-check-fsid-mismatch-/srv/data').with(
|
||||
it { should contain_exec('ceph-osd-check-fsid-mismatch-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
test f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 = $(ceph-disk list $(readlink -f /srv/data) | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||
exit 1
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
test -z $(ceph-disk list $(readlink -f /srv/data) | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||
if [ -z $(ceph-volume lvm list vg_test/lv_test |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ') ]; then
|
||||
exit 0
|
||||
fi
|
||||
test f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 = $(ceph-volume lvm list vg_test/lv_test |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ')
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-prepare-/srv/data').with(
|
||||
it { should contain_exec('ceph-osd-prepare-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv/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
|
||||
|
||||
if [ $(echo vg_test/lv_test|cut -c 1) = '/' ]; then
|
||||
disk=vg_test/lv_test
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev/vg_test/lv_test
|
||||
fi
|
||||
ceph-disk prepare --bluestore --cluster testcluster --cluster-uuid f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 $(readlink -f /srv/data) --block.wal $(readlink -f /srv/wal) --block.db $(readlink -f /srv/db)
|
||||
udevadm settle
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
ceph-volume lvm prepare --bluestore --cluster testcluster --cluster-fsid f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 --data vg_test/lv_test --block.wal vg_test/lv_wal --block.db vg_test/lv_db
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv/data)
|
||||
ceph-disk list | egrep \" *((${disk}1?|${disk}p1?) .*ceph data, (prepared|active)|\\
|
||||
(${disk}5?|${disk}p5?) .*ceph lockbox, (prepared|active), for (${disk}1?|${disk}p1?))\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
ceph-volume lvm list vg_test/lv_test
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-activate-/srv/data').with(
|
||||
it { should contain_exec('ceph-osd-activate-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv/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
|
||||
if [ $(echo vg_test/lv_test|cut -c 1) = '/' ]; then
|
||||
disk=vg_test/lv_test
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev/vg_test/lv_test
|
||||
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
|
||||
fi
|
||||
if test -f /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && ( test -b ${disk}1 || test -b ${disk}p1 ); then
|
||||
ceph-disk activate ${disk}1 || true
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
id=$(ceph-volume lvm list vg_test/lv_test | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
fsid=$(ceph-volume lvm list vg_test/lv_test | grep 'osd fsid'|awk -F 'osd fsid' '{print \$2}'|tr -d ' ')
|
||||
ceph-volume lvm activate \$id \$fsid
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph-disk list | egrep \" *((\${disk}1?|\${disk}p1?) .*ceph data, active|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, active, for (\${disk}1?|\${disk}p1?))\" ||
|
||||
ls -ld /var/lib/ceph/osd/testcluster-* | grep \" $(readlink -f /srv/data)\$\"
|
||||
id=$(ceph-volume lvm list vg_test/lv_test | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
@ -195,66 +164,49 @@ ls -ld /var/lib/ceph/osd/testcluster-* | grep \" $(readlink -f /srv/data)\$\"
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec('ceph-osd-check-udev-/dev/sdc').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
# Before Infernalis the udev rules race causing the activation to fail so we
|
||||
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
|
||||
mv -f /usr/lib/udev/rules.d/95-ceph-osd.rules /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && udevadm control --reload || true
|
||||
",
|
||||
'onlyif' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
DISABLE_UDEV=$(ceph --version | awk 'match(\$3, /[0-9]+\\.[0-9]+/) {if (substr(\$3, RSTART, RLENGTH) <= 0.94) {print 1} else { print 0 } }')
|
||||
test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
|
||||
",
|
||||
'logoutput' => true,
|
||||
) }
|
||||
it { is_expected.to contain_exec('ceph-osd-prepare-/dev/sdc').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/sdc)
|
||||
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
|
||||
|
||||
if [ $(echo /dev/sdc|cut -c 1) = '/' ]; then
|
||||
disk=/dev/sdc
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev//dev/sdc
|
||||
fi
|
||||
ceph-disk prepare --cluster ceph --dmcrypt --dmcrypt-key-dir '/etc/ceph/dmcrypt-keys' $(readlink -f /dev/sdc) $(readlink -f '')
|
||||
udevadm settle
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
ceph-volume lvm prepare --cluster ceph --dmcrypt --dmcrypt-key-dir '/etc/ceph/dmcrypt-keys' --data /dev/sdc
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/sdc)
|
||||
ceph-disk list | egrep \" *((${disk}1?|${disk}p1?) .*ceph data, (prepared|active)|\\
|
||||
(${disk}5?|${disk}p5?) .*ceph lockbox, (prepared|active), for (${disk}1?|${disk}p1?))\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
ceph-volume lvm list /dev/sdc
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { is_expected.to contain_exec('ceph-osd-activate-/dev/sdc').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/sdc)
|
||||
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
|
||||
if [ $(echo /dev/sdc|cut -c 1) = '/' ]; then
|
||||
disk=/dev/sdc
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev//dev/sdc
|
||||
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
|
||||
fi
|
||||
if test -f /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && ( test -b ${disk}1 || test -b ${disk}p1 ); then
|
||||
ceph-disk activate ${disk}1 || true
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
id=$(ceph-volume lvm list /dev/sdc | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
fsid=$(ceph-volume lvm list /dev/sdc | grep 'osd fsid'|awk -F 'osd fsid' '{print \$2}'|tr -d ' ')
|
||||
ceph-volume lvm activate \$id \$fsid
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph-disk list | egrep \" *((\${disk}1?|\${disk}p1?) .*ceph data, active|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, active, for (\${disk}1?|\${disk}p1?))\" ||
|
||||
ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/sdc)\$\"
|
||||
id=$(ceph-volume lvm list /dev/sdc | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
@ -273,66 +225,49 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/sdc)\$\"
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec('ceph-osd-check-udev-/dev/sdc').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
# Before Infernalis the udev rules race causing the activation to fail so we
|
||||
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
|
||||
mv -f /usr/lib/udev/rules.d/95-ceph-osd.rules /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && udevadm control --reload || true
|
||||
",
|
||||
'onlyif' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
DISABLE_UDEV=$(ceph --version | awk 'match(\$3, /[0-9]+\\.[0-9]+/) {if (substr(\$3, RSTART, RLENGTH) <= 0.94) {print 1} else { print 0 } }')
|
||||
test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
|
||||
",
|
||||
'logoutput' => true,
|
||||
) }
|
||||
it { is_expected.to contain_exec('ceph-osd-prepare-/dev/sdc').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/sdc)
|
||||
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
|
||||
|
||||
if [ $(echo /dev/sdc|cut -c 1) = '/' ]; then
|
||||
disk=/dev/sdc
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev//dev/sdc
|
||||
fi
|
||||
ceph-disk prepare --cluster ceph --dmcrypt --dmcrypt-key-dir '/srv/ceph/keys' $(readlink -f /dev/sdc) $(readlink -f '')
|
||||
udevadm settle
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
ceph-volume lvm prepare --cluster ceph --dmcrypt --dmcrypt-key-dir '/srv/ceph/keys' --data /dev/sdc
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/sdc)
|
||||
ceph-disk list | egrep \" *((${disk}1?|${disk}p1?) .*ceph data, (prepared|active)|\\
|
||||
(${disk}5?|${disk}p5?) .*ceph lockbox, (prepared|active), for (${disk}1?|${disk}p1?))\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
ceph-volume lvm list /dev/sdc
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { is_expected.to contain_exec('ceph-osd-activate-/dev/sdc').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/sdc)
|
||||
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
|
||||
if [ $(echo /dev/sdc|cut -c 1) = '/' ]; then
|
||||
disk=/dev/sdc
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev//dev/sdc
|
||||
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
|
||||
fi
|
||||
if test -f /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && ( test -b ${disk}1 || test -b ${disk}p1 ); then
|
||||
ceph-disk activate ${disk}1 || true
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
id=$(ceph-volume lvm list /dev/sdc | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
fsid=$(ceph-volume lvm list /dev/sdc | grep 'osd fsid'|awk -F 'osd fsid' '{print \$2}'|tr -d ' ')
|
||||
ceph-volume lvm activate \$id \$fsid
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph-disk list | egrep \" *((\${disk}1?|\${disk}p1?) .*ceph data, active|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, active, for (\${disk}1?|\${disk}p1?))\" ||
|
||||
ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/sdc)\$\"
|
||||
id=$(ceph-volume lvm list /dev/sdc | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
@ -340,89 +275,75 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/sdc)\$\"
|
||||
|
||||
describe "with custom params" do
|
||||
let :title do
|
||||
'/srv/data'
|
||||
'vg_test/lv_test'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:cluster => 'testcluster',
|
||||
:journal => '/srv/journal',
|
||||
:journal => 'vg_test/lv_journal',
|
||||
:fsid => 'f39ace04-f967-4c3d-9fd2-32af2d2d2cd5',
|
||||
:store_type => 'filestore'
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_exec('ceph-osd-check-udev-/srv/data').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
# Before Infernalis the udev rules race causing the activation to fail so we
|
||||
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
|
||||
mv -f /usr/lib/udev/rules.d/95-ceph-osd.rules /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && udevadm control --reload || true
|
||||
",
|
||||
'onlyif' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
DISABLE_UDEV=$(ceph --version | awk 'match(\$3, /[0-9]+\\.[0-9]+/) {if (substr(\$3, RSTART, RLENGTH) <= 0.94) {print 1} else { print 0 } }')
|
||||
test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
|
||||
",
|
||||
'logoutput' => true,
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-check-fsid-mismatch-/srv/data').with(
|
||||
it { should contain_exec('ceph-osd-check-fsid-mismatch-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
test f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 = $(ceph-disk list $(readlink -f /srv/data) | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||
exit 1
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
test -z $(ceph-disk list $(readlink -f /srv/data) | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||
if [ -z $(ceph-volume lvm list vg_test/lv_test |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ') ]; then
|
||||
exit 0
|
||||
fi
|
||||
test f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 = $(ceph-volume lvm list vg_test/lv_test |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ')
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-prepare-/srv/data').with(
|
||||
it { should contain_exec('ceph-osd-prepare-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv/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
|
||||
|
||||
if [ $(echo vg_test/lv_test|cut -c 1) = '/' ]; then
|
||||
disk=vg_test/lv_test
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev/vg_test/lv_test
|
||||
fi
|
||||
ceph-disk prepare --filestore --cluster testcluster --cluster-uuid f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 $(readlink -f /srv/data) $(readlink -f /srv/journal)
|
||||
udevadm settle
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
ceph-volume lvm prepare --filestore --cluster testcluster --cluster-fsid f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 --data vg_test/lv_test --journal vg_test/lv_journal
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv/data)
|
||||
ceph-disk list | egrep \" *((${disk}1?|${disk}p1?) .*ceph data, (prepared|active)|\\
|
||||
(${disk}5?|${disk}p5?) .*ceph lockbox, (prepared|active), for (${disk}1?|${disk}p1?))\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
ceph-volume lvm list vg_test/lv_test
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-activate-/srv/data').with(
|
||||
it { should contain_exec('ceph-osd-activate-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv/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
|
||||
if [ $(echo vg_test/lv_test|cut -c 1) = '/' ]; then
|
||||
disk=vg_test/lv_test
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev/vg_test/lv_test
|
||||
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
|
||||
fi
|
||||
if test -f /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && ( test -b ${disk}1 || test -b ${disk}p1 ); then
|
||||
ceph-disk activate ${disk}1 || true
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
id=$(ceph-volume lvm list vg_test/lv_test | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
fsid=$(ceph-volume lvm list vg_test/lv_test | grep 'osd fsid'|awk -F 'osd fsid' '{print \$2}'|tr -d ' ')
|
||||
ceph-volume lvm activate \$id \$fsid
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph-disk list | egrep \" *((\${disk}1?|\${disk}p1?) .*ceph data, active|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, active, for (\${disk}1?|\${disk}p1?))\" ||
|
||||
ls -ld /var/lib/ceph/osd/testcluster-* | grep \" $(readlink -f /srv/data)\$\"
|
||||
id=$(ceph-volume lvm list vg_test/lv_test | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
@ -434,66 +355,49 @@ ls -ld /var/lib/ceph/osd/testcluster-* | grep \" $(readlink -f /srv/data)\$\"
|
||||
'/dev/nvme0n1'
|
||||
end
|
||||
|
||||
it { should contain_exec('ceph-osd-check-udev-/dev/nvme0n1').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
# Before Infernalis the udev rules race causing the activation to fail so we
|
||||
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
|
||||
mv -f /usr/lib/udev/rules.d/95-ceph-osd.rules /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && udevadm control --reload || true
|
||||
",
|
||||
'onlyif' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
DISABLE_UDEV=$(ceph --version | awk 'match(\$3, /[0-9]+\\.[0-9]+/) {if (substr(\$3, RSTART, RLENGTH) <= 0.94) {print 1} else { print 0 } }')
|
||||
test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
|
||||
",
|
||||
'logoutput' => true,
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-prepare-/dev/nvme0n1').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/nvme0n1)
|
||||
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
|
||||
|
||||
if [ $(echo /dev/nvme0n1|cut -c 1) = '/' ]; then
|
||||
disk=/dev/nvme0n1
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev//dev/nvme0n1
|
||||
fi
|
||||
ceph-disk prepare --cluster ceph $(readlink -f /dev/nvme0n1) $(readlink -f '')
|
||||
udevadm settle
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
ceph-volume lvm prepare --cluster ceph --data /dev/nvme0n1
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/nvme0n1)
|
||||
ceph-disk list | egrep \" *((${disk}1?|${disk}p1?) .*ceph data, (prepared|active)|\\
|
||||
(${disk}5?|${disk}p5?) .*ceph lockbox, (prepared|active), for (${disk}1?|${disk}p1?))\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
ceph-volume lvm list /dev/nvme0n1
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-activate-/dev/nvme0n1').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/nvme0n1)
|
||||
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
|
||||
if [ $(echo /dev/nvme0n1|cut -c 1) = '/' ]; then
|
||||
disk=/dev/nvme0n1
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev//dev/nvme0n1
|
||||
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
|
||||
fi
|
||||
if test -f /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && ( test -b ${disk}1 || test -b ${disk}p1 ); then
|
||||
ceph-disk activate ${disk}1 || true
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
id=$(ceph-volume lvm list /dev/nvme0n1 | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
fsid=$(ceph-volume lvm list /dev/nvme0n1 | grep 'osd fsid'|awk -F 'osd fsid' '{print \$2}'|tr -d ' ')
|
||||
ceph-volume lvm activate \$id \$fsid
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph-disk list | egrep \" *((\${disk}1?|\${disk}p1?) .*ceph data, active|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, active, for (\${disk}1?|\${disk}p1?))\" ||
|
||||
ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/nvme0n1)\$\"
|
||||
id=$(ceph-volume lvm list /dev/nvme0n1 | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
@ -505,66 +409,49 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/nvme0n1)\$\"
|
||||
'/dev/cciss/c0d0'
|
||||
end
|
||||
|
||||
it { should contain_exec('ceph-osd-check-udev-/dev/cciss/c0d0').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
# Before Infernalis the udev rules race causing the activation to fail so we
|
||||
# disable them. More at: http://www.spinics.net/lists/ceph-devel/msg28436.html
|
||||
mv -f /usr/lib/udev/rules.d/95-ceph-osd.rules /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && udevadm control --reload || true
|
||||
",
|
||||
'onlyif' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
DISABLE_UDEV=$(ceph --version | awk 'match(\$3, /[0-9]+\\.[0-9]+/) {if (substr(\$3, RSTART, RLENGTH) <= 0.94) {print 1} else { print 0 } }')
|
||||
test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
|
||||
",
|
||||
'logoutput' => true,
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-prepare-/dev/cciss/c0d0').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/cciss/c0d0)
|
||||
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
|
||||
|
||||
if [ $(echo /dev/cciss/c0d0|cut -c 1) = '/' ]; then
|
||||
disk=/dev/cciss/c0d0
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev//dev/cciss/c0d0
|
||||
fi
|
||||
ceph-disk prepare --cluster ceph $(readlink -f /dev/cciss/c0d0) $(readlink -f '')
|
||||
udevadm settle
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
ceph-volume lvm prepare --cluster ceph --data /dev/cciss/c0d0
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/cciss/c0d0)
|
||||
ceph-disk list | egrep \" *((${disk}1?|${disk}p1?) .*ceph data, (prepared|active)|\\
|
||||
(${disk}5?|${disk}p5?) .*ceph lockbox, (prepared|active), for (${disk}1?|${disk}p1?))\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
ceph-volume lvm list /dev/cciss/c0d0
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { should contain_exec('ceph-osd-activate-/dev/cciss/c0d0').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /dev/cciss/c0d0)
|
||||
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
|
||||
if [ $(echo /dev/cciss/c0d0|cut -c 1) = '/' ]; then
|
||||
disk=/dev/cciss/c0d0
|
||||
else
|
||||
# If data is vg/lv, block device is /dev/vg/lv
|
||||
disk=/dev//dev/cciss/c0d0
|
||||
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
|
||||
fi
|
||||
if test -f /usr/lib/udev/rules.d/95-ceph-osd.rules.disabled && ( test -b ${disk}1 || test -b ${disk}p1 ); then
|
||||
ceph-disk activate ${disk}1 || true
|
||||
if ! test -b \$disk ; then
|
||||
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
|
||||
exit 1
|
||||
fi
|
||||
id=$(ceph-volume lvm list /dev/cciss/c0d0 | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
fsid=$(ceph-volume lvm list /dev/cciss/c0d0 | grep 'osd fsid'|awk -F 'osd fsid' '{print \$2}'|tr -d ' ')
|
||||
ceph-volume lvm activate \$id \$fsid
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph-disk list | egrep \" *((\${disk}1?|\${disk}p1?) .*ceph data, active|\\
|
||||
(\${disk}5?|\${disk}p5?) .*ceph lockbox, active, for (\${disk}1?|\${disk}p1?))\" ||
|
||||
ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/cciss/c0d0)\$\"
|
||||
id=$(ceph-volume lvm list /dev/cciss/c0d0 | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
@ -573,7 +460,7 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/cciss/c0d0)\$\"
|
||||
describe "with ensure absent" do
|
||||
|
||||
let :title do
|
||||
'/srv'
|
||||
'vg_test/lv_test'
|
||||
end
|
||||
|
||||
let :params do
|
||||
@ -582,41 +469,31 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/cciss/c0d0)\$\"
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_exec('remove-osd-/srv').with(
|
||||
it { should contain_exec('remove-osd-vg_test/lv_test').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv)
|
||||
if [ -z \"\$id\" ] ; then
|
||||
id=$(ceph-disk list | sed -nEe \"s:^ *${disk}1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
|
||||
fi
|
||||
if [ -z \"\$id\" ] ; then
|
||||
id=$(ls -ld /var/lib/ceph/osd/ceph-* | sed -nEe \"s:.*/ceph-([0-9]+) *-> *${disk}\$:\\1:p\" || true)
|
||||
fi
|
||||
id=$(ceph-volume lvm list vg_test/lv_test | grep 'osd id'|awk -F 'osd id' '{print \$2}'|tr -d ' ')
|
||||
if [ \"\$id\" ] ; then
|
||||
ceph --cluster ceph osd out osd.\$id
|
||||
stop ceph-osd cluster=ceph id=\$id || true
|
||||
service ceph stop osd.\$id || true
|
||||
systemctl stop ceph-osd@$id || true
|
||||
systemctl stop ceph-osd@\$id || true
|
||||
ceph --cluster ceph osd crush remove osd.\$id
|
||||
ceph --cluster ceph auth del osd.\$id
|
||||
ceph --cluster ceph osd rm \$id
|
||||
rm -fr /var/lib/ceph/osd/ceph-\$id/*
|
||||
umount /var/lib/ceph/osd/ceph-\$id || true
|
||||
rm -fr /var/lib/ceph/osd/ceph-\$id
|
||||
ceph-volume lvm zap vg_test/lv_test
|
||||
fi
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv)
|
||||
if [ -z \"\$id\" ] ; then
|
||||
id=$(ceph-disk list | sed -nEe \"s:^ *${disk}1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p\")
|
||||
fi
|
||||
if [ -z \"\$id\" ] ; then
|
||||
id=$(ls -ld /var/lib/ceph/osd/ceph-* | sed -nEe \"s:.*/ceph-([0-9]+) *-> *${disk}\$:\\1:p\" || true)
|
||||
fi
|
||||
if [ \"\$id\" ] ; then
|
||||
test ! -d /var/lib/ceph/osd/ceph-\$id
|
||||
set -x
|
||||
ceph-volume lvm list vg_test/lv_test
|
||||
if [ \$? -eq 0 ]; then
|
||||
exit 1
|
||||
else
|
||||
true # if there is no id we do nothing
|
||||
exit 0
|
||||
fi
|
||||
",
|
||||
'logoutput' => true
|
||||
|
Reference in New Issue
Block a user