]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/ceph-volume/ceph_volume/devices/lvm/activate.py
import quincy beta 17.1.0
[ceph.git] / ceph / src / ceph-volume / ceph_volume / devices / lvm / activate.py
index 70fceeab6457257416b3368044f41c359ec9249d..53ed6aa47918e786ae6109b3299cf26f60cec444 100644 (file)
@@ -3,7 +3,7 @@ import argparse
 import logging
 import os
 from textwrap import dedent
-from ceph_volume import process, conf, decorators, terminal, __release__, configuration
+from ceph_volume import process, conf, decorators, terminal, configuration
 from ceph_volume.util import system, disk
 from ceph_volume.util import prepare as prepare_utils
 from ceph_volume.util import encryption as encryption_utils
@@ -140,7 +140,7 @@ def get_osd_device_path(osd_lvs, device_type, dmcrypt_secret=None):
     raise RuntimeError('could not find %s with uuid %s' % (device_type, device_uuid))
 
 
-def activate_bluestore(osd_lvs, no_systemd=False):
+def activate_bluestore(osd_lvs, no_systemd=False, no_tmpfs=False):
     for lv in osd_lvs:
         if lv.tags.get('ceph.type') == 'block':
             osd_block_lv = lv
@@ -153,12 +153,14 @@ def activate_bluestore(osd_lvs, no_systemd=False):
     osd_id = osd_block_lv.tags['ceph.osd_id']
     conf.cluster = osd_block_lv.tags['ceph.cluster_name']
     osd_fsid = osd_block_lv.tags['ceph.osd_fsid']
+    configuration.load_ceph_conf_path(osd_block_lv.tags['ceph.cluster_name'])
+    configuration.load()
 
     # mount on tmpfs the osd directory
     osd_path = '/var/lib/ceph/osd/%s-%s' % (conf.cluster, osd_id)
     if not system.path_is_mounted(osd_path):
         # mkdir -p and mount as tmpfs
-        prepare_utils.create_osd_path(osd_id, tmpfs=True)
+        prepare_utils.create_osd_path(osd_id, tmpfs=not no_tmpfs)
     # XXX This needs to be removed once ceph-bluestore-tool can deal with
     # symlinks that exist in the osd dir
     for link_name in ['block', 'block.db', 'block.wal']:
@@ -185,11 +187,7 @@ def activate_bluestore(osd_lvs, no_systemd=False):
     prime_command = [
         'ceph-bluestore-tool', '--cluster=%s' % conf.cluster,
         'prime-osd-dir', '--dev', osd_lv_path,
-        '--path', osd_path]
-
-    if __release__ != "luminous":
-        # mon-config changes are not available in Luminous
-        prime_command.append('--no-mon-config')
+        '--path', osd_path, '--no-mon-config']
 
     process.run(prime_command)
     # always re-do the symlink regardless if it exists, so that the block,
@@ -295,9 +293,15 @@ class Activate(object):
                         'assuming bluestore')
 
             return activate_bluestore(lvs, args.no_systemd)
-        if args.bluestore:
-            activate_bluestore(lvs, args.no_systemd)
-        elif args.filestore:
+
+        # explicit filestore/bluestore flags take precedence
+        if getattr(args, 'bluestore', False):
+            activate_bluestore(lvs, args.no_systemd, getattr(args, 'no_tmpfs', False))
+        elif getattr(args, 'filestore', False):
+            activate_filestore(lvs, args.no_systemd)
+        elif any('ceph.block_device' in lv.tags for lv in lvs):
+            activate_bluestore(lvs, args.no_systemd, getattr(args, 'no_tmpfs', False))
+        elif any('ceph.data_device' in lv.tags for lv in lvs):
             activate_filestore(lvs, args.no_systemd)
 
     def main(self):
@@ -342,12 +346,12 @@ class Activate(object):
         parser.add_argument(
             '--bluestore',
             action='store_true',
-            help='bluestore objectstore (default)',
+            help='force bluestore objectstore activation',
         )
         parser.add_argument(
             '--filestore',
             action='store_true',
-            help='filestore objectstore',
+            help='force filestore objectstore activation',
         )
         parser.add_argument(
             '--all',
@@ -361,14 +365,15 @@ class Activate(object):
             action='store_true',
             help='Skip creating and enabling systemd units and starting OSD services',
         )
+        parser.add_argument(
+            '--no-tmpfs',
+            action='store_true',
+            help='Do not use a tmpfs mount for OSD data dir'
+        )
         if len(self.argv) == 0:
             print(sub_command_help)
             return
         args = parser.parse_args(self.argv)
-        # Default to bluestore here since defaulting it in add_argument may
-        # cause both to be True
-        if not args.bluestore and not args.filestore:
-            args.bluestore = True
         if args.activate_all:
             self.activate_all(args)
         else: