Fix example and test values for journal disks

* if providing an external journal disk, provide the disk and not
  the partition
* do not put things into /tmp

Change-Id: If6e4ae171d4339d06352108fcac3a27854c448b8
This commit is contained in:
David Gurtner
2015-10-08 10:08:12 +02:00
parent c60c6209ac
commit bf32e98123
10 changed files with 49 additions and 49 deletions

View File

@ -44,6 +44,6 @@ ceph::profile::params::client_keys:
ceph::profile::params::osds:
'/dev/sdc':
journal: '/dev/sdb1'
journal: '/dev/sdb'
'/dev/sdd':
journal: '/dev/sdb2'
journal: '/dev/sdb'

View File

@ -2,5 +2,5 @@
######## OSD
ceph::profile::params::osds:
'/dev/sdb':
journal: '/tmp/journal'
journal: '/srv/journal'

View File

@ -2,5 +2,5 @@
######## OSD
ceph::profile::params::osds:
'/dev/sdb':
journal: '/tmp/journal'
journal: '/srv/journal'

View File

@ -24,7 +24,7 @@ describe 'ceph::osds' do
{
:args => {
'/dev/sdb' => {
'journal' => '/tmp/journal',
'journal' => '/srv/journal',
},
'/srv/data' => {
},
@ -38,7 +38,7 @@ describe 'ceph::osds' do
it {
is_expected.to contain_ceph__osd('/dev/sdb').with(
:ensure => 'present',
:journal => '/tmp/journal',
:journal => '/srv/journal',
:cluster => 'CLUSTER'
)
is_expected.to contain_ceph__osd('/srv/data').with(

View File

@ -27,8 +27,8 @@ describe 'ceph::profile::osd' do
end
it { is_expected.to contain_class('ceph::profile::client') }
it { is_expected.to contain_ceph__osd('/dev/sdc').with(:journal => '/dev/sdb1') }
it { is_expected.to contain_ceph__osd('/dev/sdd').with(:journal => '/dev/sdb2') }
it { is_expected.to contain_ceph__osd('/dev/sdc').with(:journal => '/dev/sdb') }
it { is_expected.to contain_ceph__osd('/dev/sdd').with(:journal => '/dev/sdb') }
end
context 'with the host specific first.yaml' do
@ -38,7 +38,7 @@ describe 'ceph::profile::osd' do
end
it { is_expected.to contain_class('ceph::profile::client') }
it { is_expected.to contain_ceph__osd('/dev/sdb').with( :journal => '/tmp/journal') }
it { is_expected.to contain_ceph__osd('/dev/sdb').with( :journal => '/srv/journal') }
end
end

View File

@ -26,39 +26,39 @@ describe 'ceph::osd' do
describe "with default params" do
let :title do
'/tmp'
'/srv'
end
it { is_expected.to contain_exec('ceph-osd-prepare-/tmp').with(
it { is_expected.to contain_exec('ceph-osd-prepare-/srv').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b /tmp ; then
mkdir -p /tmp
if ! test -b /srv ; then
mkdir -p /srv
fi
ceph-disk prepare /tmp
ceph-disk prepare /srv
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
ceph-disk list | grep -E ' */tmp1? .*ceph data, (prepared|active)' ||
ls -l /var/lib/ceph/osd/ceph-* | grep ' /tmp\$'
ceph-disk list | grep -E ' */srv1? .*ceph data, (prepared|active)' ||
ls -l /var/lib/ceph/osd/ceph-* | grep ' /srv\$'
",
'logoutput' => true
) }
it { is_expected.to contain_exec('ceph-osd-activate-/tmp').with(
it { is_expected.to contain_exec('ceph-osd-activate-/srv').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b /tmp ; then
mkdir -p /tmp
if ! test -b /srv ; then
mkdir -p /srv
fi
# activate happens via udev when using the entire device
if ! test -b /tmp || ! test -b /tmp1 ; then
ceph-disk activate /tmp || true
if ! test -b /srv || ! test -b /srv1 ; then
ceph-disk activate /srv || true
fi
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
ceph-disk list | grep -E ' */tmp1? .*ceph data, active' ||
ls -ld /var/lib/ceph/osd/ceph-* | grep ' /tmp\$'
ceph-disk list | grep -E ' */srv1? .*ceph data, active' ||
ls -ld /var/lib/ceph/osd/ceph-* | grep ' /srv\$'
",
'logoutput' => true
) }
@ -67,46 +67,46 @@ ls -ld /var/lib/ceph/osd/ceph-* | grep ' /tmp\$'
describe "with custom params" do
let :title do
'/tmp/data'
'/srv/data'
end
let :params do
{
:cluster => 'testcluster',
:journal => '/tmp/journal',
:journal => '/srv/journal',
}
end
it { is_expected.to contain_exec('ceph-osd-prepare-/tmp/data').with(
it { is_expected.to contain_exec('ceph-osd-prepare-/srv/data').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b /tmp/data ; then
mkdir -p /tmp/data
if ! test -b /srv/data ; then
mkdir -p /srv/data
fi
ceph-disk prepare --cluster testcluster /tmp/data /tmp/journal
ceph-disk prepare --cluster testcluster /srv/data /srv/journal
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
ceph-disk list | grep -E ' */tmp/data1? .*ceph data, (prepared|active)' ||
ls -l /var/lib/ceph/osd/testcluster-* | grep ' /tmp/data\$'
ceph-disk list | grep -E ' */srv/data1? .*ceph data, (prepared|active)' ||
ls -l /var/lib/ceph/osd/testcluster-* | grep ' /srv/data\$'
",
'logoutput' => true
) }
it { is_expected.to contain_exec('ceph-osd-activate-/tmp/data').with(
it { is_expected.to contain_exec('ceph-osd-activate-/srv/data').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b /tmp/data ; then
mkdir -p /tmp/data
if ! test -b /srv/data ; then
mkdir -p /srv/data
fi
# activate happens via udev when using the entire device
if ! test -b /tmp/data || ! test -b /tmp/data1 ; then
ceph-disk activate /tmp/data || true
if ! test -b /srv/data || ! test -b /srv/data1 ; then
ceph-disk activate /srv/data || true
fi
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
ceph-disk list | grep -E ' */tmp/data1? .*ceph data, active' ||
ls -ld /var/lib/ceph/osd/testcluster-* | grep ' /tmp/data\$'
ceph-disk list | grep -E ' */srv/data1? .*ceph data, active' ||
ls -ld /var/lib/ceph/osd/testcluster-* | grep ' /srv/data\$'
",
'logoutput' => true
) }
@ -115,7 +115,7 @@ ls -ld /var/lib/ceph/osd/testcluster-* | grep ' /tmp/data\$'
describe "with ensure absent" do
let :title do
'/tmp'
'/srv'
end
let :params do
@ -124,14 +124,14 @@ ls -ld /var/lib/ceph/osd/testcluster-* | grep ' /tmp/data\$'
}
end
it { is_expected.to contain_exec('remove-osd-/tmp').with(
it { is_expected.to contain_exec('remove-osd-/srv').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if [ -z \"\$id\" ] ; then
id=\$(ceph-disk list | sed -nEe 's:^ */tmp1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p')
id=\$(ceph-disk list | sed -nEe 's:^ */srv1? .*(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]+) *-> */tmp\$:\\1:p' || true)
id=\$(ls -ld /var/lib/ceph/osd/ceph-* | sed -nEe 's:.*/ceph-([0-9]+) *-> */srv\$:\\1:p' || true)
fi
if [ \"\$id\" ] ; then
stop ceph-osd cluster=ceph id=\$id || true
@ -146,10 +146,10 @@ fi
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if [ -z \"\$id\" ] ; then
id=\$(ceph-disk list | sed -nEe 's:^ */tmp1? .*(ceph data|mounted on).*osd\\.([0-9]+).*:\\2:p')
id=\$(ceph-disk list | sed -nEe 's:^ */srv1? .*(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]+) *-> */tmp\$:\\1:p' || true)
id=\$(ls -ld /var/lib/ceph/osd/ceph-* | sed -nEe 's:.*/ceph-([0-9]+) *-> */srv\$:\\1:p' || true)
fi
if [ \"\$id\" ] ; then
test ! -d /var/lib/ceph/osd/ceph-\$id

View File

@ -41,6 +41,6 @@ ceph::profile::params::client_keys:
cap_osd: 'allow class-read object_prefix rbd_children, allow rwx pool=volumes'
ceph::profile::params::osds:
'/dev/sdc':
journal: '/dev/sdb1'
journal: '/dev/sdb'
'/dev/sdd':
journal: '/dev/sdb2'
journal: '/dev/sdb'

View File

@ -2,5 +2,5 @@
######## OSD
ceph::profile::params::osds:
'/dev/sdb':
journal: '/tmp/journal'
journal: '/srv/journal'

View File

@ -228,7 +228,7 @@ describe 'ceph::osd' do
authentication_type => 'none',
}
ceph::osd { '#{data}':
journal => '/tmp/journal'
journal => '/srv/journal'
}
EOS

View File

@ -135,7 +135,7 @@ ceph::profile::params::release: '#{release}'
ceph::profile::params::authentication_type: 'none'
ceph::profile::params::osds:
'/dev/sdb':
journal: '/tmp/journal'
journal: '/srv/journal'
EOS
file = Tempfile.new('hieradata')