ceph-daemon: only set up crash dir mount if it exists

Sometimes we run containers on a host that doesn't have a crash dir set
up (becuase no daemon has been deployed).  Examples include shell and
ceph-volume.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2019-10-24 08:41:33 -05:00
parent 8b56c456b5
commit f56a8db34d
2 changed files with 7 additions and 1 deletions

View File

@ -30,6 +30,10 @@ $SUDO $CEPH_DAEMON --image $IMAGE version | grep 'ceph version'
# try force docker; this won't work if docker isn't installed
which docker && ( $SUDO $CEPH_DAEMON --docker version | grep 'ceph version' )
## test shell before bootstrap, when crash dir isn't (yet) present on this host
$SUDO $CEPH_DAEMON shell -- ceph -v | grep 'ceph version'
$SUDO $CEPH_DAEMON shell --fsid $FSID -- ceph -v | grep 'ceph version'
## bootstrap
ORIG_CONFIG=`mktemp -p $TMPDIR`
CONFIG=`mktemp -p $TMPDIR`

View File

@ -339,7 +339,9 @@ def get_container_mounts(fsid, daemon_type, daemon_id):
if fsid:
log_dir = get_log_dir(fsid)
mounts[log_dir] = '/var/log/ceph:z'
mounts['/var/lib/ceph/%s/crash' % fsid] = '/var/lib/ceph/crash:z'
crash_dir = '/var/lib/ceph/%s/crash' % fsid
if os.path.exists(crash_dir):
mounts[crash_dir] = '/var/lib/ceph/crash:z'
if daemon_id:
data_dir = get_data_dir(fsid, daemon_type, daemon_id)