diff --git a/manifests/osd.pp b/manifests/osd.pp index 6805b4e2..d24b95ed 100644 --- a/manifests/osd.pp +++ b/manifests/osd.pp @@ -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 ", diff --git a/releasenotes/notes/support-nvme0n1-as-osd-46e4a00ec699f718.yaml b/releasenotes/notes/support-nvme0n1-as-osd-46e4a00ec699f718.yaml new file mode 100644 index 00000000..0ebe17f5 --- /dev/null +++ b/releasenotes/notes/support-nvme0n1-as-osd-46e4a00ec699f718.yaml @@ -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) diff --git a/spec/defines/ceph_osd_spec.rb b/spec/defines/ceph_osd_spec.rb index a552698c..a0b917f7 100644 --- a/spec/defines/ceph_osd_spec.rb +++ b/spec/defines/ceph_osd_spec.rb @@ -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