cephadm: Add '--mount' option to mount host file or directory

Fixes: https://tracker.ceph.com/issues/45284

Signed-off-by: Ricardo Marques <rimarques@suse.com>
This commit is contained in:
Ricardo Marques 2020-04-27 15:11:56 +01:00
parent ec2fcf3035
commit 71c58f18b5
2 changed files with 13 additions and 2 deletions

View File

@ -110,7 +110,7 @@ Enable Ceph CLI
===============
Cephadm does not require any Ceph packages to be installed on the
host. However, we recommend enabling easy access to the the ``ceph``
host. However, we recommend enabling easy access to the ``ceph``
command. There are several ways to do this:
* The ``cephadm shell`` command launches a bash shell in a container
@ -119,7 +119,9 @@ command. There are several ways to do this:
host, they are passed into the container environment so that the
shell is fully functional. Note that when executed on a MON host,
``cephadm shell`` will infer the ``config`` from the MON container
instead of using the default configuration::
instead of using the default configuration. If ``--mount <path>``
is given, then the host ``<path>`` (file or directory) will appear
under ``/mnt`` inside the container::
# cephadm shell

View File

@ -2778,6 +2778,12 @@ def command_shell():
mounts[pathify(args.config)] = '/etc/ceph/ceph.conf:z'
if args.keyring:
mounts[pathify(args.keyring)] = '/etc/ceph/ceph.keyring:z'
if args.mount:
mount = pathify(args.mount)
filename = ''
if os.path.isfile(mount):
_, filename = os.path.split(mount)
mounts[mount] = '/mnt/{}:z'.format(filename)
if args.command:
command = args.command
else:
@ -4301,6 +4307,9 @@ def _get_parser():
parser_shell.add_argument(
'--keyring', '-k',
help='ceph.keyring to pass through to the container')
parser_shell.add_argument(
'--mount', '-m',
help='file or directory path that will be mounted in container /mnt')
parser_shell.add_argument(
'--env', '-e',
action='append',