Fail deployment if non-existent block devices are passed for OSDs

If a user passes a block device, e.g. /dev/sdx, that doesn't actually
exist, then the user made a mistake and the deployment should fail.
Without this change if /dev/sdx doesn't exist, then a directory is
created called /dev/sdx and set up as a directory-backed OSD. This
patch adds a check to fail the deployment if the requested OSD is
a directory with a name starting with /dev.

Change-Id: I5f03fc332b8df3914dc8609a203eb38693cb87a7
Closes-Bug: 1665697
This commit is contained in:
John Fulton 2017-02-17 23:33:46 +00:00
parent 55ae425b19
commit 7451d6ea29
3 changed files with 9 additions and 0 deletions

View File

@ -160,6 +160,7 @@ test -z \$(ceph-disk list ${data} | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b ${data} ; then
echo ${data} | egrep -e '^/dev' -q -v
mkdir -p ${data}
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph ${data}
@ -192,6 +193,7 @@ ceph-disk list | grep -E ' *${data}1? .*ceph data, (prepared|active)' ||
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b ${data} ; then
echo ${data} | egrep -e '^/dev' -q -v
mkdir -p ${data}
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph ${data}

View File

@ -0,0 +1,3 @@
---
fixes:
- Bug 1665697 non-existent block device should make deploy fail, not create directory whose name starts with /dev

View File

@ -60,6 +60,7 @@ test -f /usr/lib/udev/rules.d/95-ceph-osd.rules && test \$DISABLE_UDEV -eq 1
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b /srv ; then
echo /srv | egrep -e '^/dev' -q -v
mkdir -p /srv
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph /srv
@ -79,6 +80,7 @@ ceph-disk list | grep -E ' */srv1? .*ceph data, (prepared|active)' ||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b /srv ; then
echo /srv | egrep -e '^/dev' -q -v
mkdir -p /srv
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph /srv
@ -170,6 +172,7 @@ test -z \$(ceph-disk list /srv/data | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b /srv/data ; then
echo /srv/data | egrep -e '^/dev' -q -v
mkdir -p /srv/data
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph /srv/data
@ -189,6 +192,7 @@ ceph-disk list | grep -E ' */srv/data1? .*ceph data, (prepared|active)' ||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if ! test -b /srv/data ; then
echo /srv/data | egrep -e '^/dev' -q -v
mkdir -p /srv/data
if getent passwd ceph >/dev/null 2>&1; then
chown -h ceph:ceph /srv/data