]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: Add '--mount' option to mount host file or directory
authorRicardo Marques <rimarques@suse.com>
Mon, 27 Apr 2020 14:11:56 +0000 (15:11 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 21 May 2020 21:33:18 +0000 (23:33 +0200)
Fixes: https://tracker.ceph.com/issues/45284
Signed-off-by: Ricardo Marques <rimarques@suse.com>
(cherry picked from commit 71c58f18b5b01e45e7ff1d0a0c086cd682d10307)

doc/cephadm/install.rst
src/cephadm/cephadm

index 81779ab64cf045fc2eefb48d14696030ead26107..aa54738a6af7317908e37eea1d7949295d443636 100644 (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
 
index 082a2dd3c4d53cb32dba9b8bf29730078de1ca71..934b1f6017d032b1162f2b63748c2e215cd2bc50 100755 (executable)
@@ -2785,6 +2785,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:
@@ -4309,6 +4315,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',