]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: Make easy manager modules development 35262/head
authorJuan Miguel Olmo Martínez <jolmomar@redhat.com>
Wed, 27 May 2020 07:57:14 +0000 (09:57 +0200)
committerJuan Miguel Olmo Martínez <jolmomar@redhat.com>
Tue, 2 Jun 2020 08:33:37 +0000 (10:33 +0200)
A volume replaces content  in </usr/share/mgr> folder in manager containers.
The new argument <shared_mgr_folder> sets the source folder for the volume

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
src/cephadm/cephadm

index e5253d5225c0e84b311d7e9c4db22d700df6d3cb..7855977592ad81d5c4f38aed87d08e65edb6df14 100755 (executable)
@@ -87,6 +87,12 @@ cached_stdin = None
 
 DATEFMT = '%Y-%m-%dT%H:%M:%S.%f'
 
+
+class termcolor:
+    yellow = '\033[93m'
+    red = '\033[31m'
+    end = '\033[0m'
+
 class Error(Exception):
     pass
 
@@ -1111,14 +1117,12 @@ def infer_config(func):
 
 def _get_default_image():
     if DEFAULT_IMAGE_IS_MASTER:
-        yellow = '\033[93m'
-        end = '\033[0m'
         warn = '''This is a development version of cephadm.
 For information regarding the latest stable release:
     https://docs.ceph.com/docs/{}/cephadm/install
 '''.format(LATEST_STABLE_RELEASE)
         for line in warn.splitlines():
-            logger.warning('{}{}{}'.format(yellow, line, end))
+            logger.warning('{}{}{}'.format(termcolor.yellow, line, termcolor.end))
     return DEFAULT_IMAGE
 
 def infer_image(func):
@@ -1620,6 +1624,22 @@ def get_container_mounts(fsid, daemon_type, daemon_id,
         mounts['/run/lvm'] = '/run/lvm'
         mounts['/run/lock/lvm'] = '/run/lock/lvm'
 
+    try:
+        if args.shared_ceph_folder:  # make easy manager modules/ceph-volume development
+            ceph_folder = pathify(args.shared_ceph_folder)
+            if os.path.exists(ceph_folder):
+                mounts[ceph_folder + '/src/ceph-volume/ceph_volume'] = '/usr/lib/python3.6/site-packages/ceph_volume'
+                mounts[ceph_folder + '/src/pybind/mgr'] = '/usr/share/ceph/mgr'
+                mounts[ceph_folder + '/src/python-common/ceph'] = '/usr/lib/python3.6/site-packages/ceph'
+                mounts[ceph_folder + '/monitoring/grafana/dashboards'] = '/etc/grafana/dashboards/ceph-dashboard'
+                mounts[ceph_folder + '/monitoring/prometheus/alerts'] = '/etc/prometheus/ceph'
+            else:
+                logger.error('{}{}{}'.format(termcolor.red,
+                'Ceph shared source folder does not exist.',
+                termcolor.end))
+    except AttributeError:
+        pass
+
     if daemon_type in Monitoring.components and daemon_id:
         data_dir = get_data_dir(fsid, daemon_type, daemon_id)
         if daemon_type == 'prometheus':
@@ -4542,6 +4562,11 @@ def _get_parser():
         action='store_true',
         help='Do not automatically provision monitoring stack (prometheus, grafana, alertmanager, node-exporter)')
 
+    parser_bootstrap.add_argument(
+        '--shared_ceph_folder',
+        metavar='CEPH_SOURCE_FOLDER',
+        help='Development mode. Several folders in containers are volumes mapped to different sub-folders in the ceph source folder')
+
     parser_deploy = subparsers.add_parser(
         'deploy', help='deploy a daemon')
     parser_deploy.set_defaults(func=command_deploy)