Correctly configure /dev/nvme0n1 devices as OSDs
Change pupppet-ceph's assumption that all devices which end with a "1" have a first partition so that it can correctly configure NVMe SSDs, which appear as /dev/nvme0n1 and whose partitions appear as /dev/nvme0n1p1, /dev/nvme0n1p2 and so on. Closes-Bug: #1687114 Change-Id: I433fd3ab3ce240c661e7e9faeb758fd0d0215f6a
This commit is contained in:
parent
ff2b2e6898
commit
0754aecaa9
@ -136,7 +136,7 @@ udevadm settle
|
||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f ${data})
|
||||
ceph-disk list | egrep \" *\${disk}1? .*ceph data, (prepared|active)\" ||
|
||||
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 ;}
|
||||
",
|
||||
logoutput => true,
|
||||
@ -170,10 +170,10 @@ if ! test -b \$disk ; then
|
||||
fi
|
||||
fi
|
||||
# activate happens via udev when using the entire device
|
||||
if ! test -b \$disk || ! test -b \${disk}1 ; then
|
||||
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 ; then
|
||||
if test -f ${udev_rules_file}.disabled && ( test -b \${disk}1 || test -b \${disk}p1 ); then
|
||||
ceph-disk activate \${disk}1 || true
|
||||
fi
|
||||
",
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
fixes:
|
||||
- Bug 1687114 puppet-ceph does not configure devices like /dev/nvme0n1 or HP Smart Array controllers (/dev/cciss/c0d0) as OSDs (only as journals)
|
@ -59,7 +59,7 @@ udevadm settle
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv)
|
||||
ceph-disk list | egrep \" *${disk}1? .*ceph data, (prepared|active)\" ||
|
||||
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 ;}
|
||||
",
|
||||
'logoutput' => true
|
||||
@ -76,10 +76,10 @@ if ! test -b $disk ; then
|
||||
fi
|
||||
fi
|
||||
# activate happens via udev when using the entire device
|
||||
if ! test -b $disk || ! test -b ${disk}1 ; then
|
||||
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 ; then
|
||||
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
|
||||
fi
|
||||
",
|
||||
@ -146,7 +146,7 @@ udevadm settle
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
disk=$(readlink -f /srv/data)
|
||||
ceph-disk list | egrep \" *${disk}1? .*ceph data, (prepared|active)\" ||
|
||||
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 ;}
|
||||
",
|
||||
'logoutput' => true
|
||||
@ -163,10 +163,10 @@ if ! test -b $disk ; then
|
||||
fi
|
||||
fi
|
||||
# activate happens via udev when using the entire device
|
||||
if ! test -b $disk || ! test -b ${disk}1 ; then
|
||||
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 ; then
|
||||
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
|
||||
fi
|
||||
",
|
||||
@ -178,6 +178,142 @@ ls -ld /var/lib/ceph/osd/testcluster-* | grep \" $(readlink -f /srv/data)\$\"
|
||||
) }
|
||||
end
|
||||
|
||||
describe "with NVMe param" do
|
||||
|
||||
let :title do
|
||||
'/dev/nvme0n1'
|
||||
end
|
||||
|
||||
it { is_expected.to 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}}')
|
||||
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/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
|
||||
fi
|
||||
ceph-disk prepare --cluster ceph $(readlink -f /dev/nvme0n1) $(readlink -f '')
|
||||
udevadm settle
|
||||
",
|
||||
'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)\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { is_expected.to 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
|
||||
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
|
||||
fi
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/nvme0n1)\$\"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
end
|
||||
|
||||
describe "with cciss param" do
|
||||
|
||||
let :title do
|
||||
'/dev/cciss/c0d0'
|
||||
end
|
||||
|
||||
it { is_expected.to 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}}')
|
||||
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/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
|
||||
fi
|
||||
ceph-disk prepare --cluster ceph $(readlink -f /dev/cciss/c0d0) $(readlink -f '')
|
||||
udevadm settle
|
||||
",
|
||||
'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)\" ||
|
||||
{ test -f $disk/fsid && test -f $disk/ceph_fsid && test -f $disk/magic ;}
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
it { is_expected.to 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
|
||||
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
|
||||
fi
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ls -ld /var/lib/ceph/osd/ceph-* | grep \" $(readlink -f /dev/cciss/c0d0)\$\"
|
||||
",
|
||||
'logoutput' => true
|
||||
) }
|
||||
end
|
||||
|
||||
describe "with ensure absent" do
|
||||
|
||||
let :title do
|
||||
|
Loading…
Reference in New Issue
Block a user